diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index c57833c1f7..0a6155fa67 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/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); Logger.LogInformation("Output folder: " + outputFolder); - var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); - if (gitHubLocalRepositoryPath != null) + var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long); + 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); await _sourceCodeDownloadService.DownloadAsync( - commandLineArgs.Target, outputFolder, version, gitHubLocalRepositoryPath, commandLineArgs.Options); + commandLineArgs.Target, outputFolder, version, gitHubAbpLocalRepositoryPath, gitHubVoloLocalRepositoryPath, commandLineArgs.Options); } private static string GetOutPutFolder(CommandLineArgs commandLineArgs) @@ -117,11 +123,16 @@ namespace Volo.Abp.Cli.Commands public const string Long = "output-folder"; } - public static class GitHubLocalRepositoryPath + public static class GitHubAbpLocalRepositoryPath { public const string Long = "abp-path"; } + public static class GitHubVoloLocalRepositoryPath + { + public const string Long = "volo-path"; + } + public static class Version { public const string Short = "v"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 5605f357bf..c55e68916c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/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); } - var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); - if (gitHubLocalRepositoryPath != null) + var gitHubAbpLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubAbpLocalRepositoryPath.Long); + 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); @@ -127,7 +133,8 @@ namespace Volo.Abp.Cli.Commands databaseProvider, uiFramework, mobileApp, - gitHubLocalRepositoryPath, + gitHubAbpLocalRepositoryPath, + gitHubVoloLocalRepositoryPath, templateSource, commandLineArgs.Options, connectionString @@ -299,11 +306,16 @@ namespace Volo.Abp.Cli.Commands public const string Long = "output-folder"; } - public static class GitHubLocalRepositoryPath + public static class GitHubAbpLocalRepositoryPath { public const string Long = "abp-path"; } + public static class GitHubVoloLocalRepositoryPath + { + public const string Long = "volo-path"; + } + public static class Version { public const string Short = "v"; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs index 7c8d068e1e..ca01314758 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/Services/SourceCodeDownloadService.cs +++ b/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.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("Version: " + version); @@ -39,7 +39,8 @@ namespace Volo.Abp.Cli.Commands.Services DatabaseProvider.NotSpecified, UiFramework.NotSpecified, null, - gitHubLocalRepositoryPath, + gitHubAbpLocalRepositoryPath, + gitHubVoloLocalRepositoryPath, null, options ) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs index c7a6cc90f0..698c7f1d8d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs +++ b/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; } + var localVoloRepoPath = context.BuildArgs.VoloGitHubLocalRepositoryPath; + new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer( context.Files, context.Module?.Namespace ?? "MyCompanyName.MyProjectName", - localAbpRepoPath + localAbpRepoPath, + localVoloRepoPath ).Run(); } else @@ -177,12 +180,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps public class LocalProjectPathReferenceReplacer : ProjectReferenceReplacer { - private readonly string _gitHubLocalRepositoryPath; + private readonly string _gitHubAbpLocalRepositoryPath; + private readonly string _gitHubVoloLocalRepositoryPath; - public LocalProjectPathReferenceReplacer(List entries, string projectName, string gitHubLocalRepositoryPath) + public LocalProjectPathReferenceReplacer(List entries, string projectName, string gitHubAbpLocalRepositoryPath, string gitHubVoloLocalRepositoryPath) : base(entries, projectName) { - _gitHubLocalRepositoryPath = gitHubLocalRepositoryPath; + _gitHubAbpLocalRepositoryPath = gitHubAbpLocalRepositoryPath; + _gitHubVoloLocalRepositoryPath = gitHubVoloLocalRepositoryPath; } protected override XmlElement GetNewReferenceNode(XmlDocument doc, string oldNodeIncludeValue) @@ -204,9 +209,17 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps 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; } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs index 70cb98dff0..52fa76e551 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuildArgs.cs @@ -24,6 +24,9 @@ namespace Volo.Abp.Cli.ProjectBuilding [CanBeNull] public string AbpGitHubLocalRepositoryPath { get; set; } + [CanBeNull] + public string VoloGitHubLocalRepositoryPath { get; set; } + [CanBeNull] public string TemplateSource { get; set; } @@ -41,6 +44,7 @@ namespace Volo.Abp.Cli.ProjectBuilding UiFramework uiFramework = UiFramework.NotSpecified, MobileApp? mobileApp = null, [CanBeNull] string abpGitHubLocalRepositoryPath = null, + [CanBeNull] string voloGitHubLocalRepositoryPath = null, [CanBeNull] string templateSource = null, Dictionary extraProperties = null, [CanBeNull] string connectionString = null) @@ -52,6 +56,7 @@ namespace Volo.Abp.Cli.ProjectBuilding UiFramework = uiFramework; MobileApp = mobileApp; AbpGitHubLocalRepositoryPath = abpGitHubLocalRepositoryPath; + VoloGitHubLocalRepositoryPath = voloGitHubLocalRepositoryPath; TemplateSource = templateSource; ExtraProperties = extraProperties ?? new Dictionary(); ConnectionString = connectionString; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 51a8ee40df..a6ed12730a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -129,6 +129,7 @@ namespace Volo.Abp.Cli.ProjectModification targetModuleFolder, version, null, + null, null ); diff --git a/npm/ng-packs/apps/dev-app/src/app/app.module.ts b/npm/ng-packs/apps/dev-app/src/app/app.module.ts index 2416eb881d..e00a99d499 100644 --- a/npm/ng-packs/apps/dev-app/src/app/app.module.ts +++ b/npm/ng-packs/apps/dev-app/src/app/app.module.ts @@ -23,6 +23,8 @@ const LOGGERS = [NgxsLoggerPluginModule.forRoot({ disabled: false })]; AppRoutingModule, CoreModule.forRoot({ environment, + sendNullsAsQueryParam: false, + skipGetAppConfiguration: false, }), ThemeSharedModule.forRoot(), AccountConfigModule.forRoot({ redirectUrl: '/' }), diff --git a/npm/ng-packs/packages/core/src/lib/models/common.ts b/npm/ng-packs/packages/core/src/lib/models/common.ts index 3a218f3ddb..773233857f 100644 --- a/npm/ng-packs/packages/core/src/lib/models/common.ts +++ b/npm/ng-packs/packages/core/src/lib/models/common.ts @@ -13,6 +13,7 @@ export namespace ABP { */ requirements?: Config.Requirements; skipGetAppConfiguration?: boolean; + sendNullsAsQueryParam?: boolean; } export interface Test { diff --git a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts index 936bc2a768..4ece11a43f 100644 --- a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts @@ -1,5 +1,5 @@ import { HttpClient, HttpRequest } from '@angular/common/http'; -import { Injectable } from '@angular/core'; +import { Injectable, Inject } from '@angular/core'; import { Store } from '@ngxs/store'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; @@ -7,12 +7,18 @@ import { RestOccurError } from '../actions/rest.actions'; import { Rest } from '../models/rest'; import { ConfigState } from '../states/config.state'; import { isUndefinedOrEmptyString } from '../utils/common-utils'; +import { ABP } from '../models/common'; +import { CORE_OPTIONS } from '../tokens/options.token'; @Injectable({ providedIn: 'root', }) 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 { return this.store.selectSnapshot(ConfigState.getApiUrl(apiName)); @@ -41,8 +47,10 @@ export class RestService { params: Object.keys(params).reduce((acc, 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; }, {}), }),