Browse Source

Merge branch 'dev' of https://github.com/abpframework/abp into dev

pull/4209/head
Halil İbrahim Kalkan 6 years ago
parent
commit
3385e6511e
  1. 21
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs
  2. 22
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  3. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs
  4. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs
  5. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs
  6. 1
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
  7. 2
      npm/ng-packs/apps/dev-app/src/app/app.module.ts
  8. 1
      npm/ng-packs/packages/core/src/lib/models/common.ts
  9. 14
      npm/ng-packs/packages/core/src/lib/services/rest.service.ts

21
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs

@ -48,16 +48,22 @@ namespace Volo.Abp.Cli.Commands
var outputFolder = GetOutPutFolder(commandLineArgs); var outputFolder = GetOutPutFolder(commandLineArgs);
Logger.LogInformation("Output folder: " + outputFolder); Logger.LogInformation("Output folder: " + outputFolder);
var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);
if (gitHubLocalRepositoryPath != null) if (gitHubAbpLocalRepositoryPath != null)
{ {
Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath); Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
}
var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);
if (gitHubVoloLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Volo Local Repository Path: " + gitHubVoloLocalRepositoryPath);
} }
commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command);
await _sourceCodeDownloadService.DownloadAsync( await _sourceCodeDownloadService.DownloadAsync(
commandLineArgs.Target, outputFolder, version, gitHubLocalRepositoryPath, commandLineArgs.Options); commandLineArgs.Target, outputFolder, version, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, commandLineArgs.Options);
} }
private static string GetOutPutFolder(CommandLineArgs commandLineArgs) private static string GetOutPutFolder(CommandLineArgs commandLineArgs)
@ -117,11 +123,16 @@ namespace Volo.Abp.Cli.Commands
public const string Long = "output-folder"; public const string Long = "output-folder";
} }
public static class GitHubLocalRepositoryPath public static class GitHubAbpLocalRepositoryPath
{ {
public const string Long = "abp-path"; public const string Long = "abp-path";
} }
public static class GitHubVoloLocalRepositoryPath
{
public const string Long = "volo-path";
}
public static class Version public static class Version
{ {
public const string Short = "v"; public const string Short = "v";

22
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -86,10 +86,16 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("Mobile App: " + mobileApp); Logger.LogInformation("Mobile App: " + mobileApp);
} }
var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long);
if (gitHubLocalRepositoryPath != null) if (gitHubAbpLocalRepositoryPath != null)
{ {
Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath); Logger.LogInformation("GitHub Abp Local Repository Path: " + gitHubAbpLocalRepositoryPath);
}
var gitHubVoloLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubVoloLocalRepositoryPath.Long);
if (gitHubVoloLocalRepositoryPath != null)
{
Logger.LogInformation("GitHub Volo Local Repository Path: " + gitHubVoloLocalRepositoryPath);
} }
var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Short, Options.TemplateSource.Long); var templateSource = commandLineArgs.Options.GetOrNull(Options.TemplateSource.Short, Options.TemplateSource.Long);
@ -127,7 +133,8 @@ namespace Volo.Abp.Cli.Commands
databaseProvider, databaseProvider,
uiFramework, uiFramework,
mobileApp, mobileApp,
gitHubLocalRepositoryPath, gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
templateSource, templateSource,
commandLineArgs.Options, commandLineArgs.Options,
connectionString connectionString
@ -299,11 +306,16 @@ namespace Volo.Abp.Cli.Commands
public const string Long = "output-folder"; public const string Long = "output-folder";
} }
public static class GitHubLocalRepositoryPath public static class GitHubAbpLocalRepositoryPath
{ {
public const string Long = "abp-path"; public const string Long = "abp-path";
} }
public static class GitHubVoloLocalRepositoryPath
{
public const string Long = "volo-path";
}
public static class Version public static class Version
{ {
public const string Short = "v"; public const string Short = "v";

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs

@ -25,7 +25,7 @@ namespace Volo.Abp.Cli.Commands.Services
Logger = NullLogger<SourceCodeDownloadService>.Instance; Logger = NullLogger<SourceCodeDownloadService>.Instance;
} }
public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubLocalRepositoryPath, AbpCommandLineOptions options) public async Task DownloadAsync(string moduleName, string outputFolder, string version, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath, AbpCommandLineOptions options)
{ {
Logger.LogInformation("Downloading source code of " + moduleName); Logger.LogInformation("Downloading source code of " + moduleName);
Logger.LogInformation("Version: " + version); Logger.LogInformation("Version: " + version);
@ -39,7 +39,8 @@ namespace Volo.Abp.Cli.Commands.Services
DatabaseProvider.NotSpecified, DatabaseProvider.NotSpecified,
UiFramework.NotSpecified, UiFramework.NotSpecified,
null, null,
gitHubLocalRepositoryPath, gitHubAbpLocalRepositoryPath,
gitHubVoloLocalRepositoryPath,
null, null,
options options
) )

25
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs

@ -22,10 +22,13 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
return; return;
} }
var localVoloRepoPath = context.BuildArgs.VoloGitHubLocalRepositoryPath;
new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer( new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer(
context.Files, context.Files,
context.Module?.Namespace ?? "MyCompanyName.MyProjectName", context.Module?.Namespace ?? "MyCompanyName.MyProjectName",
localAbpRepoPath localAbpRepoPath,
localVoloRepoPath
).Run(); ).Run();
} }
else else
@ -177,12 +180,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
public class LocalProjectPathReferenceReplacer : ProjectReferenceReplacer public class LocalProjectPathReferenceReplacer : ProjectReferenceReplacer
{ {
private readonly string _gitHubLocalRepositoryPath; private readonly string _gitHubAbpLocalRepositoryPath;
private readonly string _gitHubVoloLocalRepositoryPath;
public LocalProjectPathReferenceReplacer(List<FileEntry> entries, string projectName, string gitHubLocalRepositoryPath) public LocalProjectPathReferenceReplacer(List<FileEntry> entries, string projectName, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath)
: base(entries, projectName) : base(entries, projectName)
{ {
_gitHubLocalRepositoryPath = gitHubLocalRepositoryPath; _gitHubAbpLocalRepositoryPath = gitHubAbpLocalRepositoryPath;
_gitHubVoloLocalRepositoryPath = gitHubVoloLocalRepositoryPath;
} }
protected override XmlElement GetNewReferenceNode(XmlDocument doc, string oldNodeIncludeValue) protected override XmlElement GetNewReferenceNode(XmlDocument doc, string oldNodeIncludeValue)
@ -204,9 +209,17 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps
includeValue = includeValue.TrimStart('\\'); includeValue = includeValue.TrimStart('\\');
} }
includeValue = _gitHubLocalRepositoryPath.EnsureEndsWith('\\') + includeValue; if (!string.IsNullOrWhiteSpace(_gitHubVoloLocalRepositoryPath))
{
if (includeValue.StartsWith("abp\\", StringComparison.InvariantCultureIgnoreCase))
{
return _gitHubAbpLocalRepositoryPath.EnsureEndsWith('\\') + includeValue.Substring("abp\\".Length);
}
return _gitHubVoloLocalRepositoryPath.EnsureEndsWith('\\') + "abp\\" + includeValue;
}
return includeValue; return _gitHubAbpLocalRepositoryPath.EnsureEndsWith('\\') + includeValue;
} }
} }
} }

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs

@ -24,6 +24,9 @@ namespace Volo.Abp.Cli.ProjectBuilding
[CanBeNull] [CanBeNull]
public string AbpGitHubLocalRepositoryPath { get; set; } public string AbpGitHubLocalRepositoryPath { get; set; }
[CanBeNull]
public string VoloGitHubLocalRepositoryPath { get; set; }
[CanBeNull] [CanBeNull]
public string TemplateSource { get; set; } public string TemplateSource { get; set; }
@ -41,6 +44,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
UiFramework uiFramework = UiFramework.NotSpecified, UiFramework uiFramework = UiFramework.NotSpecified,
MobileApp? mobileApp = null, MobileApp? mobileApp = null,
[CanBeNull] string abpGitHubLocalRepositoryPath = null, [CanBeNull] string abpGitHubLocalRepositoryPath = null,
[CanBeNull] string voloGitHubLocalRepositoryPath = null,
[CanBeNull] string templateSource = null, [CanBeNull] string templateSource = null,
Dictionary<string, string> extraProperties = null, Dictionary<string, string> extraProperties = null,
[CanBeNull] string connectionString = null) [CanBeNull] string connectionString = null)
@ -52,6 +56,7 @@ namespace Volo.Abp.Cli.ProjectBuilding
UiFramework = uiFramework; UiFramework = uiFramework;
MobileApp = mobileApp; MobileApp = mobileApp;
AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath; AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath;
VoloGitHubLocalRepositoryPath = voloGitHubLocalRepositoryPath;
TemplateSource = templateSource; TemplateSource = templateSource;
ExtraProperties = extraProperties ?? new Dictionary<string, string>(); ExtraProperties = extraProperties ?? new Dictionary<string, string>();
ConnectionString = connectionString; ConnectionString = connectionString;

1
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -129,6 +129,7 @@ namespace Volo.Abp.Cli.ProjectModification
targetModuleFolder, targetModuleFolder,
version, version,
null, null,
null,
null null
); );

2
npm/ng-packs/apps/dev-app/src/app/app.module.ts

@ -23,6 +23,8 @@ const LOGGERS = [NgxsLoggerPluginModule.forRoot({ disabled: false })];
AppRoutingModule, AppRoutingModule,
CoreModule.forRoot({ CoreModule.forRoot({
environment, environment,
sendNullsAsQueryParam: false,
skipGetAppConfiguration: false,
}), }),
ThemeSharedModule.forRoot(), ThemeSharedModule.forRoot(),
AccountConfigModule.forRoot({ redirectUrl: '/' }), AccountConfigModule.forRoot({ redirectUrl: '/' }),

1
npm/ng-packs/packages/core/src/lib/models/common.ts

@ -13,6 +13,7 @@ export namespace ABP {
*/ */
requirements?: Config.Requirements; requirements?: Config.Requirements;
skipGetAppConfiguration?: boolean; skipGetAppConfiguration?: boolean;
sendNullsAsQueryParam?: boolean;
} }
export interface Test { export interface Test {

14
npm/ng-packs/packages/core/src/lib/services/rest.service.ts

@ -1,5 +1,5 @@
import { HttpClient, HttpRequest } from '@angular/common/http'; import { HttpClient, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable, Inject } from '@angular/core';
import { Store } from '@ngxs/store'; import { Store } from '@ngxs/store';
import { Observable, throwError } from 'rxjs'; import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
@ -7,12 +7,18 @@ import { RestOccurError } from '../actions/rest.actions';
import { Rest } from '../models/rest'; import { Rest } from '../models/rest';
import { ConfigState } from '../states/config.state'; import { ConfigState } from '../states/config.state';
import { isUndefinedOrEmptyString } from '../utils/common-utils'; import { isUndefinedOrEmptyString } from '../utils/common-utils';
import { ABP } from '../models/common';
import { CORE_OPTIONS } from '../tokens/options.token';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
export class RestService { export class RestService {
constructor(private http: HttpClient, private store: Store) {} constructor(
@Inject(CORE_OPTIONS) private options: ABP.Root,
private http: HttpClient,
private store: Store,
) {}
private getApiFromStore(apiName: string): string { private getApiFromStore(apiName: string): string {
return this.store.selectSnapshot(ConfigState.getApiUrl(apiName)); return this.store.selectSnapshot(ConfigState.getApiUrl(apiName));
@ -41,8 +47,10 @@ export class RestService {
params: Object.keys(params).reduce((acc, key) => { params: Object.keys(params).reduce((acc, key) => {
const value = params[key]; const value = params[key];
if (!isUndefinedOrEmptyString(value)) acc[key] = value; if (isUndefinedOrEmptyString(value)) return acc;
if (value === null && !this.options.sendNullsAsQueryParam) return acc;
acc[key] = value;
return acc; return acc;
}, {}), }, {}),
}), }),

Loading…
Cancel
Save