diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html index 10761a3618..5508166f7a 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.html @@ -18,99 +18,88 @@ +
- + [(ngModel)]="list.filter" + /> +
- - - - - - - - - {{ 'AbpTenantManagement::Actions' | abpLocalization }} - - {{ 'AbpTenantManagement::TenantName' | abpLocalization }} - + +
+ +
+ + + -
- - - - -
- - {{ data.name }} - - - +
+
+ + + diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts index d04f384a79..7eb40e53e8 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts @@ -1,6 +1,7 @@ -import { ABP } from '@abp/ng.core'; -import { ConfirmationService, Confirmation, getPasswordValidators } from '@abp/ng.theme.shared'; -import { Component, OnInit, TemplateRef, ViewChild, ChangeDetectorRef } from '@angular/core'; +import { ABP, ListService } from '@abp/ng.core'; +import { eFeatureManagementComponents } from '@abp/ng.feature-management'; +import { Confirmation, ConfirmationService, getPasswordValidators } from '@abp/ng.theme.shared'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Select, Store } from '@ngxs/store'; import { Observable } from 'rxjs'; @@ -14,7 +15,6 @@ import { } from '../../actions/tenant-management.actions'; import { TenantManagementService } from '../../services/tenant-management.service'; import { TenantManagementState } from '../../states/tenant-management.state'; -import { eFeatureManagementComponents } from '@abp/ng.feature-management'; interface SelectedModalContent { type: 'saveConnStr' | 'saveTenant'; @@ -25,6 +25,7 @@ interface SelectedModalContent { @Component({ selector: 'abp-tenants', templateUrl: './tenants.component.html', + providers: [ListService], }) export class TenantsComponent implements OnInit { @Select(TenantManagementState.get) @@ -51,16 +52,8 @@ export class TenantsComponent implements OnInit { _useSharedDatabase: boolean; - pageQuery: ABP.PageQueryParams = { maxResultCount: 10 }; - - loading = false; - modalBusy = false; - sortOrder = ''; - - sortKey = ''; - featureManagementKey = eFeatureManagementComponents.FeatureManagement; get hasSelectedTenant(): boolean { @@ -106,6 +99,7 @@ export class TenantsComponent implements OnInit { }; constructor( + public readonly list: ListService, private confirmationService: ConfirmationService, private tenantService: TenantManagementService, private fb: FormBuilder, @@ -116,11 +110,6 @@ export class TenantsComponent implements OnInit { this.get(); } - onSearch(value: string) { - this.pageQuery.filter = value; - this.get(); - } - private createTenantForm() { const tenantForm = this.fb.group({ name: [this.selected.name || '', [Validators.required, Validators.maxLength(256)]], @@ -262,18 +251,8 @@ export class TenantsComponent implements OnInit { }); } - onPageChange(page: number) { - this.pageQuery.skipCount = (page - 1) * this.pageQuery.maxResultCount; - - this.get(); - } - get() { - this.loading = true; - this.store - .dispatch(new GetTenants(this.pageQuery)) - .pipe(finalize(() => (this.loading = false))) - .subscribe(); + this.list.hookToQuery(query => this.store.dispatch(new GetTenants(query))).subscribe(); } onSharedDatabaseChange(value: boolean) { @@ -295,4 +274,10 @@ export class TenantsComponent implements OnInit { this.visibleFeatures = true; }, 0); } + + sort(data) { + const { prop, dir } = data.sorts[0]; + this.list.sortKey = prop; + this.list.sortOrder = dir; + } }