From 250dd7caddd9b1c5dfb4c4608ff59468e967b146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20KILI=C3=87?= Date: Thu, 27 Oct 2022 15:46:50 +0300 Subject: [PATCH 01/11] add to Angular extensible table document. --- docs/en/UI/Angular/Extensions-Overall.md | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index c36be79a91..cdc6ef4ef0 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -8,3 +8,34 @@ See the documents below for the details: * [Data Table Column (or Entity Prop) Extensions](Data-Table-Column-Extensions.md) * [Page Toolbar Extension](Page-Toolbar-Extensions.md) * [Dynamic Form (or Form Prop) Extensions](Dynamic-Form-Extensions.md) + +## Extensible Table Component + +Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble table. + +````ts + +```` + +` actionsText : ` ** Column name of action column. + +` data : ` Items shows in your table. + +` list : ` Template of your table. + +`actionsColumnWidth : ` Width of your action column. + +` actionsTemplate : ` Template of action when click this button or whatever. Generally ng-template. + +` recordsTotal : ` Count of record total. + +` tableActivate : ` It is Output(). A cell or row was focused via keyboard or mouse click. +A cell or row was focused via keyboard or mouse click. From d1ea18fcb0607cc29ba796e3131f30c2ac3a451b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20KILI=C3=87?= Date: Thu, 27 Oct 2022 15:49:50 +0300 Subject: [PATCH 02/11] edit extensible table document. --- docs/en/UI/Angular/Extensions-Overall.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index cdc6ef4ef0..adc0c2f224 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -15,14 +15,14 @@ Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble ````ts + actionsText="Your Action" + [data]="items" + [recordsTotal]="totalCount" + [actionsColumnWidth]="38" + [actionsTemplate]="customAction" + [list]="list" + (tableActivate)="onTableSelect($event)" > + ```` ` actionsText : ` ** Column name of action column. From 4939a4d41eea06eec93faa2267ef4d0a5a66c0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20KILI=C3=87?= Date: Thu, 27 Oct 2022 16:04:09 +0300 Subject: [PATCH 03/11] edit extensible table document. --- docs/en/UI/Angular/Extensions-Overall.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index adc0c2f224..97a6d8e257 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -29,7 +29,7 @@ Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble ` data : ` Items shows in your table. -` list : ` Template of your table. +` list : ` Instance of ListService. `actionsColumnWidth : ` Width of your action column. From c94842532768eedf418e29d3abece938b924166d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20KILI=C3=87?= Date: Thu, 27 Oct 2022 16:51:16 +0300 Subject: [PATCH 04/11] edit extensible table document. --- docs/en/UI/Angular/Extensions-Overall.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index 97a6d8e257..8407b61487 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -25,17 +25,10 @@ Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble ```` -` actionsText : ` ** Column name of action column. - -` data : ` Items shows in your table. - -` list : ` Instance of ListService. - -`actionsColumnWidth : ` Width of your action column. - -` actionsTemplate : ` Template of action when click this button or whatever. Generally ng-template. - -` recordsTotal : ` Count of record total. - -` tableActivate : ` It is Output(). A cell or row was focused via keyboard or mouse click. -A cell or row was focused via keyboard or mouse click. + * ` actionsText : ` ** Column name of action column. **Type** : string + * ` data : ` Items shows in your table. **Type** : R[] + * ` list : ` Instance of ListService. **Type** : ListService + * `actionsColumnWidth : ` Width of your action column. **Type** : number + * ` actionsTemplate : ` Template of action when click this button or whatever. Generally ng-template. **Type** : TemplateRef + * ` recordsTotal : ` Count of record total. **Type** : number + * ` tableActivate : ` It is Output(). A cell or row was focused via keyboard or mouse click. **Type** : EventEmitter() From 1a934c47ef7069f47aa38e0ba225dbb17561435c Mon Sep 17 00:00:00 2001 From: muhammedaltug Date: Fri, 11 Nov 2022 15:52:03 +0300 Subject: [PATCH 05/11] fix entrypoint param, work without defaultProject --- npm/ng-packs/packages/schematics/src/utils/api.ts | 6 +++++- .../packages/schematics/src/utils/workspace.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/utils/api.ts b/npm/ng-packs/packages/schematics/src/utils/api.ts index 39483c2aa9..78f96f477b 100644 --- a/npm/ng-packs/packages/schematics/src/utils/api.ts +++ b/npm/ng-packs/packages/schematics/src/utils/api.ts @@ -2,5 +2,9 @@ import { chain, schematic } from '@angular-devkit/schematics'; import { GenerateProxySchema } from '../models'; export function createApisGenerator(schema: GenerateProxySchema, generated: string[]) { - return chain(generated.map(m => schematic('api', { ...schema, module: m }))); + return chain( + generated.map(m => + schematic('api', { ...schema, module: m, entryPoint: schema.entryPoint || '__default' }), + ), + ); } diff --git a/npm/ng-packs/packages/schematics/src/utils/workspace.ts b/npm/ng-packs/packages/schematics/src/utils/workspace.ts index 2daaf8b2b6..ed53e482e8 100644 --- a/npm/ng-packs/packages/schematics/src/utils/workspace.ts +++ b/npm/ng-packs/packages/schematics/src/utils/workspace.ts @@ -21,6 +21,14 @@ export function readEnvironment(tree: Tree, project: workspaces.ProjectDefinitio const source = readFileInTree(tree, envPath); return findEnvironmentExpression(source); } +export function getFirstApplication(tree: Tree) { + const workspace = readWorkspaceSchema(tree); + const [name, project] = + Object.entries(workspace.projects).find( + ([_, project]) => project.projectType === ProjectType.Application, + ) || []; + return { name, project }; +} export function readWorkspaceSchema(tree: Tree) { if (!tree.exists('/angular.json')) throw new SchematicsException(Exception.NoWorkspace); @@ -44,7 +52,7 @@ export async function resolveProject( // @typescript-eslint/no-explicit-any notFoundValue: T = NOT_FOUND_VALUE as unknown as any, ): Promise { - name = name || readWorkspaceSchema(tree).defaultProject!; + name = name || readWorkspaceSchema(tree).defaultProject || getFirstApplication(tree).name!; const workspace = await getWorkspace(tree); let definition: Project['definition'] | undefined; From 0d239f90535efe55429f926e9c4d1c92236af7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alper=20Ebi=C3=A7o=C4=9Flu?= <9526587+ebicoglu@users.noreply.github.com> Date: Tue, 15 Nov 2022 14:23:45 +0300 Subject: [PATCH 06/11] Update ProjectCreationCommandBase.cs --- .../Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index 0b822f9940..f761025c62 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -248,7 +248,7 @@ public abstract class ProjectCreationCommandBase { EventBus.PublishAsync(new ProjectCreationProgressEvent { - Message = "Extracting the solution archieve" + Message = "Unzipping the solution" }, false); using (var templateFileStream = new MemoryStream(project.ZipContent)) @@ -818,4 +818,4 @@ public abstract class ProjectCreationCommandBase public const string Long = "theme-style"; } } -} \ No newline at end of file +} From 126da886c11d62c50bfbdaaa49af387fa44095cd Mon Sep 17 00:00:00 2001 From: Hamza Albreem <94292623+braim23@users.noreply.github.com> Date: Tue, 15 Nov 2022 14:27:31 +0300 Subject: [PATCH 07/11] quick fix --- docs/en/UI/Angular/Extensions-Overall.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index 8407b61487..42b0eeea3c 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -25,10 +25,10 @@ Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble ```` - * ` actionsText : ` ** Column name of action column. **Type** : string - * ` data : ` Items shows in your table. **Type** : R[] + * ` actionsText : ` ** Column name of the action column. **Type** : string + * ` data : ` Items show in your table. **Type** : R[] * ` list : ` Instance of ListService. **Type** : ListService * `actionsColumnWidth : ` Width of your action column. **Type** : number - * ` actionsTemplate : ` Template of action when click this button or whatever. Generally ng-template. **Type** : TemplateRef - * ` recordsTotal : ` Count of record total. **Type** : number - * ` tableActivate : ` It is Output(). A cell or row was focused via keyboard or mouse click. **Type** : EventEmitter() + * ` actionsTemplate : ` Template of the action when "click this button" or whatever. Generally ng-template. **Type** : TemplateRef + * ` recordsTotal : ` Count of the record total. **Type** : number + * ` tableActivate : ` The Output(). A cell or row was focused via the keyboard or a mouse click. **Type** : EventEmitter() From bc03c7c0069e9be49f50ec021c0da23af4425c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20KILI=C3=87?= Date: Tue, 15 Nov 2022 22:52:21 +0300 Subject: [PATCH 08/11] edit edit extensible table document. --- docs/en/UI/Angular/Extensions-Overall.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/UI/Angular/Extensions-Overall.md b/docs/en/UI/Angular/Extensions-Overall.md index 8407b61487..85423ba186 100644 --- a/docs/en/UI/Angular/Extensions-Overall.md +++ b/docs/en/UI/Angular/Extensions-Overall.md @@ -26,7 +26,7 @@ Using [ngx-datatable](https://github.com/swimlane/ngx-datatable) in extensinble ```` * ` actionsText : ` ** Column name of action column. **Type** : string - * ` data : ` Items shows in your table. **Type** : R[] + * ` data : ` Items shows in your table. **Type** : Array * ` list : ` Instance of ListService. **Type** : ListService * `actionsColumnWidth : ` Width of your action column. **Type** : number * ` actionsTemplate : ` Template of action when click this button or whatever. Generally ng-template. **Type** : TemplateRef From 27acbdade69c6b98c7d1ad1f16987ab51fa88a47 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 21 Nov 2022 14:25:55 +0800 Subject: [PATCH 09/11] Fix RemoveUnnecessaryPortsStep --- .../Templates/RemoveUnnecessaryPortsStep.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs index be5948c8b6..4996585e78 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs @@ -25,35 +25,44 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep return; } - var portsToRemoveFromCors = new List(); + var portsToRemove = new List(); var appSettingsJson = JObject.Parse(httpApiHostAppSettings.Content); var appJson = (JObject)appSettingsJson["App"]; if (context.BuildArgs.UiFramework != UiFramework.Angular) { - var clientUrl = appJson.Property("ClientUrl")?.ToString(); - portsToRemoveFromCors.Add("http://localhost:4200"); + var angularUrl = appJson.Property("AngularUrl")?.ToString() ?? appJson.Property("ClientUrl")?.ToString(); + + portsToRemove.Add("http://localhost:4200"); - if (!clientUrl.IsNullOrWhiteSpace()) + if (!angularUrl.IsNullOrWhiteSpace()) { - httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(clientUrl, string.Empty)); + httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace($"{angularUrl.EnsureEndsWith(',')}\n ", string.Empty)); } } if (context.BuildArgs.UiFramework != UiFramework.Blazor) { - portsToRemoveFromCors.Add("https://localhost:44307"); + portsToRemove.Add("https://localhost:44307"); } if (appJson["CorsOrigins"] != null) { var corsOrigins = appJson["CorsOrigins"].ToString(); - var newCorsOrigins = string.Join(",", corsOrigins.Split(',').Where(x => !portsToRemoveFromCors.Contains(x))); + var newCorsOrigins = string.Join(",", corsOrigins.Split(',').Where(x => !portsToRemove.Contains(x))); httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(corsOrigins, newCorsOrigins)); } + + if (appJson["RedirectAllowedUrls"] != null) + { + var redirectAllowedUrls = appJson["RedirectAllowedUrls"].ToString(); + var newRedirectAllowedUrls = string.Join(",", redirectAllowedUrls.Split(',').Where(x => !portsToRemove.Contains(x))); + + httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(redirectAllowedUrls, newRedirectAllowedUrls)); + } } private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context) From 07164249eea7d3f8956d97b1631a24870debd8c0 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 21 Nov 2022 15:25:06 +0800 Subject: [PATCH 10/11] Update RemoveUnnecessaryPortsStep --- .../Templates/RemoveUnnecessaryPortsStep.cs | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs index 4996585e78..63d8443a5c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs @@ -25,21 +25,18 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep return; } + var lines = httpApiHostAppSettings.GetLines(); + var newlines = new List(); var portsToRemove = new List(); + var removeAngularUrl = false; var appSettingsJson = JObject.Parse(httpApiHostAppSettings.Content); var appJson = (JObject)appSettingsJson["App"]; if (context.BuildArgs.UiFramework != UiFramework.Angular) { - var angularUrl = appJson.Property("AngularUrl")?.ToString() ?? appJson.Property("ClientUrl")?.ToString(); - + removeAngularUrl = true; portsToRemove.Add("http://localhost:4200"); - - if (!angularUrl.IsNullOrWhiteSpace()) - { - httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace($"{angularUrl.EnsureEndsWith(',')}\n ", string.Empty)); - } } if (context.BuildArgs.UiFramework != UiFramework.Blazor) @@ -47,22 +44,27 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep portsToRemove.Add("https://localhost:44307"); } - - if (appJson["CorsOrigins"] != null) + foreach (var line in lines) { - var corsOrigins = appJson["CorsOrigins"].ToString(); - var newCorsOrigins = string.Join(",", corsOrigins.Split(',').Where(x => !portsToRemove.Contains(x))); + var newLine = line; + if(removeAngularUrl && (line.Contains("AngularUrl")|| line.Contains("ClientUrl"))) + { + continue; + } - httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(corsOrigins, newCorsOrigins)); - } - - if (appJson["RedirectAllowedUrls"] != null) - { - var redirectAllowedUrls = appJson["RedirectAllowedUrls"].ToString(); - var newRedirectAllowedUrls = string.Join(",", redirectAllowedUrls.Split(',').Where(x => !portsToRemove.Contains(x))); - - httpApiHostAppSettings.SetContent(httpApiHostAppSettings.Content.Replace(redirectAllowedUrls, newRedirectAllowedUrls)); + if(line.Contains("CorsOrigins") || line.Contains("RedirectAllowedUrls")) + { + var jsonValue = line.Contains("CorsOrigins") ? appJson["CorsOrigins"]?.ToString() : appJson["RedirectAllowedUrls"]?.ToString(); + if(!jsonValue.IsNullOrWhiteSpace()) + { + newLine = line.Replace(jsonValue, string.Join(",", jsonValue.Split(',').Where(x => !portsToRemove.Contains(x)))); + } + } + + newlines.Add(newLine); } + + httpApiHostAppSettings.SetContent(string.Join(Environment.NewLine, newlines)); } private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context) From f12fd7bd17ed4e620d4882d8f409cbaedb71f702 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 21 Nov 2022 15:29:49 +0800 Subject: [PATCH 11/11] Update RemoveUnnecessaryPortsStep --- .../ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs index 63d8443a5c..2c232bcecf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs @@ -63,8 +63,8 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep newlines.Add(newLine); } - - httpApiHostAppSettings.SetContent(string.Join(Environment.NewLine, newlines)); + + httpApiHostAppSettings.SetLines(newlines); } private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context)