From fbaac23b78b3166da88142d2f55b3e0a15bc8d20 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 16 Sep 2020 16:16:42 +0300 Subject: [PATCH 1/7] fix: resolve filter problem in ListService --- .../packages/core/src/lib/services/list.service.ts | 2 ++ .../src/lib/directives/ngx-datatable-list.directive.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/npm/ng-packs/packages/core/src/lib/services/list.service.ts b/npm/ng-packs/packages/core/src/lib/services/list.service.ts index 3ebb6dc193..1a1e7c1aeb 100644 --- a/npm/ng-packs/packages/core/src/lib/services/list.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/list.service.ts @@ -17,6 +17,8 @@ import { LIST_QUERY_DEBOUNCE_TIME } from '../tokens/list.token'; export class ListService implements OnDestroy { private _filter = ''; set filter(value: string) { + if (this._filter !== value) this._page = 0; + this._filter = value; this.get(); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts index b721e1142a..6cd2ef4031 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts @@ -18,6 +18,7 @@ import { Subscription } from 'rxjs'; }) export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { private subscription = new Subscription(); + private querySubscription: Subscription; @Input() list: ListService; @@ -66,12 +67,21 @@ export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { this.subscription.add(sub); } + private subscribeToQuery() { + this.querySubscription = this.list.query$.subscribe(() => { + if (this.list.page !== this.table.offset) this.table.offset = this.list.page; + }); + } + ngOnChanges({ list }: SimpleChanges) { if (!list.firstChange) return; const { maxResultCount, page } = list.currentValue; this.table.limit = maxResultCount; this.table.offset = page; + + if (this.querySubscription) this.querySubscription.unsubscribe(); + this.subscribeToQuery(); } ngOnDestroy() { From 05a8fd5ec1b423905daf0f2f858801e0b9b7f260 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 16 Sep 2020 16:18:50 +0300 Subject: [PATCH 2/7] refactor: add unsubscribe for query subscription --- .../lib/directives/ngx-datatable-list.directive.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts index 6cd2ef4031..7dc81ab6b9 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/ngx-datatable-list.directive.ts @@ -18,7 +18,7 @@ import { Subscription } from 'rxjs'; }) export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { private subscription = new Subscription(); - private querySubscription: Subscription; + private querySubscription = new Subscription(); @Input() list: ListService; @@ -68,9 +68,11 @@ export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { } private subscribeToQuery() { - this.querySubscription = this.list.query$.subscribe(() => { - if (this.list.page !== this.table.offset) this.table.offset = this.list.page; - }); + this.querySubscription.add( + this.list.query$.subscribe(() => { + if (this.list.page !== this.table.offset) this.table.offset = this.list.page; + }), + ); } ngOnChanges({ list }: SimpleChanges) { @@ -80,12 +82,13 @@ export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { this.table.limit = maxResultCount; this.table.offset = page; - if (this.querySubscription) this.querySubscription.unsubscribe(); + this.querySubscription.unsubscribe(); this.subscribeToQuery(); } ngOnDestroy() { this.subscription.unsubscribe(); + this.querySubscription.unsubscribe(); } ngOnInit() { From c6e8ac3d0e971936cc823fb307faeffee04920c5 Mon Sep 17 00:00:00 2001 From: bnymncoskuner Date: Wed, 16 Sep 2020 17:44:37 +0300 Subject: [PATCH 3/7] feat: provide ApiInterceptor in root and useExisting in CoreModule --- npm/ng-packs/packages/core/src/lib/core.module.ts | 2 +- .../packages/core/src/lib/interceptors/api.interceptor.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 597e114d4a..8cf9a90886 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -187,7 +187,7 @@ export class CoreModule { }, { provide: HTTP_INTERCEPTORS, - useClass: ApiInterceptor, + useExisting: ApiInterceptor, multi: true, }, { diff --git a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts index 2bcdadaf22..b27c7fa80a 100644 --- a/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts +++ b/npm/ng-packs/packages/core/src/lib/interceptors/api.interceptor.ts @@ -6,7 +6,9 @@ import { SessionState } from '../states'; import { StartLoader, StopLoader } from '../actions/loader.actions'; import { finalize } from 'rxjs/operators'; -@Injectable() +@Injectable({ + providedIn: 'root', +}) export class ApiInterceptor implements HttpInterceptor { constructor(private oAuthService: OAuthService, private store: Store) {} From 3b9b566d98387c2f8ca6863320b2663318ff56a7 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Wed, 16 Sep 2020 18:41:19 +0300 Subject: [PATCH 4/7] fix: use Please instead of Plese in schematics prompts --- npm/ng-packs/packages/schematics/src/commands/api/schema.json | 4 ++-- .../packages/schematics/src/commands/proxy-add/schema.json | 4 ++-- .../packages/schematics/src/commands/proxy-index/schema.json | 2 +- .../schematics/src/commands/proxy-refresh/schema.json | 4 ++-- .../packages/schematics/src/commands/proxy-remove/schema.json | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/commands/api/schema.json b/npm/ng-packs/packages/schematics/src/commands/api/schema.json index db58ed73ce..d003d3a4b2 100644 --- a/npm/ng-packs/packages/schematics/src/commands/api/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/api/schema.json @@ -29,7 +29,7 @@ "$source": "argv", "index": 2 }, - "x-prompt": "Plese enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" }, "target": { "description": "Target Angular project to place the generated code", @@ -38,7 +38,7 @@ "$source": "argv", "index": 3 }, - "x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" } }, "required": [] diff --git a/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json b/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json index c817882730..8ac8fb2b68 100644 --- a/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/proxy-add/schema.json @@ -29,7 +29,7 @@ "$source": "argv", "index": 2 }, - "x-prompt": "Plese enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" }, "target": { "description": "Target Angular project to place the generated code", @@ -38,7 +38,7 @@ "$source": "argv", "index": 3 }, - "x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" } }, "required": [] diff --git a/npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json b/npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json index 632c6d7e51..9447cd397b 100644 --- a/npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/proxy-index/schema.json @@ -11,7 +11,7 @@ "$source": "argv", "index": 0 }, - "x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" } }, "required": [] diff --git a/npm/ng-packs/packages/schematics/src/commands/proxy-refresh/schema.json b/npm/ng-packs/packages/schematics/src/commands/proxy-refresh/schema.json index c817882730..8ac8fb2b68 100644 --- a/npm/ng-packs/packages/schematics/src/commands/proxy-refresh/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/proxy-refresh/schema.json @@ -29,7 +29,7 @@ "$source": "argv", "index": 2 }, - "x-prompt": "Plese enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" }, "target": { "description": "Target Angular project to place the generated code", @@ -38,7 +38,7 @@ "$source": "argv", "index": 3 }, - "x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" } }, "required": [] diff --git a/npm/ng-packs/packages/schematics/src/commands/proxy-remove/schema.json b/npm/ng-packs/packages/schematics/src/commands/proxy-remove/schema.json index c817882730..8ac8fb2b68 100644 --- a/npm/ng-packs/packages/schematics/src/commands/proxy-remove/schema.json +++ b/npm/ng-packs/packages/schematics/src/commands/proxy-remove/schema.json @@ -29,7 +29,7 @@ "$source": "argv", "index": 2 }, - "x-prompt": "Plese enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter source Angular project for API definition URL & root namespace resolution. (default: workspace \"defaultProject\")" }, "target": { "description": "Target Angular project to place the generated code", @@ -38,7 +38,7 @@ "$source": "argv", "index": 3 }, - "x-prompt": "Plese enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" + "x-prompt": "Please enter target Angular project to place the generated code. (default: workspace \"defaultProject\")" } }, "required": [] From 94c08c4f9850d27bf40989778a707e7645db822f Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Wed, 16 Sep 2020 18:47:17 +0300 Subject: [PATCH 5/7] fix: return empty string when equal to rootNamespace --- npm/ng-packs/packages/schematics/src/utils/namespace.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/npm/ng-packs/packages/schematics/src/utils/namespace.ts b/npm/ng-packs/packages/schematics/src/utils/namespace.ts index 88c574db8a..779c7b9770 100644 --- a/npm/ng-packs/packages/schematics/src/utils/namespace.ts +++ b/npm/ng-packs/packages/schematics/src/utils/namespace.ts @@ -7,6 +7,8 @@ export function parseNamespace(solution: string, type: string) { .slice(0, -1) .join('.'); + if (solution === namespace) return ''; + solution.split('.').reduceRight((acc, part) => { acc = `${part}\\.${acc}`; const regex = new RegExp(`^${acc}(Controllers\\.)?`); From 3913cf5b34629802d8717a0fbb05b8851224f189 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 16 Sep 2020 19:00:26 +0300 Subject: [PATCH 6/7] feat: update CurrentUser type resolves https://github.com/volosoft/volo/issues/3239 --- .../core/src/lib/models/application-configuration.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts b/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts index 1f3bb65f4e..c974f842a2 100644 --- a/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts +++ b/npm/ng-packs/packages/core/src/lib/models/application-configuration.ts @@ -63,10 +63,15 @@ export namespace ApplicationConfiguration { export interface CurrentUser { email: string; + emailVerified: false; id: string; isAuthenticated: boolean; roles: string[]; tenantId: string; userName: string; + name: string; + phoneNumber: string; + phoneNumberVerified: boolean; + surName: string; } } From 5a57aca669b99679bb96239258bfae0b16ea172e Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 16 Sep 2020 19:10:53 +0300 Subject: [PATCH 7/7] ci: updated the order of packages to build --- npm/ng-packs/scripts/build.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/npm/ng-packs/scripts/build.ts b/npm/ng-packs/scripts/build.ts index 8ced29ec77..312351b346 100644 --- a/npm/ng-packs/scripts/build.ts +++ b/npm/ng-packs/scripts/build.ts @@ -36,9 +36,8 @@ import fse from 'fs-extra'; '--angular', '--prod', '--no-watch', - '--all-packages', - '--excluded-packages', - '@abp/ng.schematics,@abp/ng.core,@abp/ng.theme.shared,@abp/ng.components,@abp/ng.feature-management,@abp/ng.permission-management', + '--packages', + '@abp/ng.feature-management,@abp/ng.permission-management', ], { stdout: 'inherit', cwd: '../' }, ); @@ -51,8 +50,9 @@ import fse from 'fs-extra'; '--angular', '--prod', '--no-watch', - '--packages', - '@abp/ng.feature-management,@abp/ng.permission-management', + '--all-packages', + '--excluded-packages', + '@abp/ng.schematics,@abp/ng.core,@abp/ng.theme.shared,@abp/ng.components,@abp/ng.feature-management,@abp/ng.permission-management', ], { stdout: 'inherit', cwd: '../' }, );