|
|
@ -1,6 +1,7 @@ |
|
|
import { ABP } from '@abp/ng.core'; |
|
|
import { ABP, ListService } from '@abp/ng.core'; |
|
|
import { ConfirmationService, Confirmation, getPasswordValidators } from '@abp/ng.theme.shared'; |
|
|
import { eFeatureManagementComponents } from '@abp/ng.feature-management'; |
|
|
import { Component, OnInit, TemplateRef, ViewChild, ChangeDetectorRef } from '@angular/core'; |
|
|
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 { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { Observable } from 'rxjs'; |
|
|
@ -14,7 +15,6 @@ import { |
|
|
} from '../../actions/tenant-management.actions'; |
|
|
} from '../../actions/tenant-management.actions'; |
|
|
import { TenantManagementService } from '../../services/tenant-management.service'; |
|
|
import { TenantManagementService } from '../../services/tenant-management.service'; |
|
|
import { TenantManagementState } from '../../states/tenant-management.state'; |
|
|
import { TenantManagementState } from '../../states/tenant-management.state'; |
|
|
import { eFeatureManagementComponents } from '@abp/ng.feature-management'; |
|
|
|
|
|
|
|
|
|
|
|
interface SelectedModalContent { |
|
|
interface SelectedModalContent { |
|
|
type: 'saveConnStr' | 'saveTenant'; |
|
|
type: 'saveConnStr' | 'saveTenant'; |
|
|
@ -25,6 +25,7 @@ interface SelectedModalContent { |
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'abp-tenants', |
|
|
selector: 'abp-tenants', |
|
|
templateUrl: './tenants.component.html', |
|
|
templateUrl: './tenants.component.html', |
|
|
|
|
|
providers: [ListService], |
|
|
}) |
|
|
}) |
|
|
export class TenantsComponent implements OnInit { |
|
|
export class TenantsComponent implements OnInit { |
|
|
@Select(TenantManagementState.get) |
|
|
@Select(TenantManagementState.get) |
|
|
@ -51,16 +52,8 @@ export class TenantsComponent implements OnInit { |
|
|
|
|
|
|
|
|
_useSharedDatabase: boolean; |
|
|
_useSharedDatabase: boolean; |
|
|
|
|
|
|
|
|
pageQuery: ABP.PageQueryParams = { maxResultCount: 10 }; |
|
|
|
|
|
|
|
|
|
|
|
loading = false; |
|
|
|
|
|
|
|
|
|
|
|
modalBusy = false; |
|
|
modalBusy = false; |
|
|
|
|
|
|
|
|
sortOrder = ''; |
|
|
|
|
|
|
|
|
|
|
|
sortKey = ''; |
|
|
|
|
|
|
|
|
|
|
|
featureManagementKey = eFeatureManagementComponents.FeatureManagement; |
|
|
featureManagementKey = eFeatureManagementComponents.FeatureManagement; |
|
|
|
|
|
|
|
|
get hasSelectedTenant(): boolean { |
|
|
get hasSelectedTenant(): boolean { |
|
|
@ -106,6 +99,7 @@ export class TenantsComponent implements OnInit { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
|
|
|
public readonly list: ListService, |
|
|
private confirmationService: ConfirmationService, |
|
|
private confirmationService: ConfirmationService, |
|
|
private tenantService: TenantManagementService, |
|
|
private tenantService: TenantManagementService, |
|
|
private fb: FormBuilder, |
|
|
private fb: FormBuilder, |
|
|
@ -116,11 +110,6 @@ export class TenantsComponent implements OnInit { |
|
|
this.get(); |
|
|
this.get(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onSearch(value: string) { |
|
|
|
|
|
this.pageQuery.filter = value; |
|
|
|
|
|
this.get(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private createTenantForm() { |
|
|
private createTenantForm() { |
|
|
const tenantForm = this.fb.group({ |
|
|
const tenantForm = this.fb.group({ |
|
|
name: [this.selected.name || '', [Validators.required, Validators.maxLength(256)]], |
|
|
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() { |
|
|
get() { |
|
|
this.loading = true; |
|
|
this.list.hookToQuery(query => this.store.dispatch(new GetTenants(query))).subscribe(); |
|
|
this.store |
|
|
|
|
|
.dispatch(new GetTenants(this.pageQuery)) |
|
|
|
|
|
.pipe(finalize(() => (this.loading = false))) |
|
|
|
|
|
.subscribe(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onSharedDatabaseChange(value: boolean) { |
|
|
onSharedDatabaseChange(value: boolean) { |
|
|
@ -295,4 +274,10 @@ export class TenantsComponent implements OnInit { |
|
|
this.visibleFeatures = true; |
|
|
this.visibleFeatures = true; |
|
|
}, 0); |
|
|
}, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sort(data) { |
|
|
|
|
|
const { prop, dir } = data.sorts[0]; |
|
|
|
|
|
this.list.sortKey = prop; |
|
|
|
|
|
this.list.sortOrder = dir; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|