Browse Source
Merge pull request #2043 from abpframework/fix/tenant-management/multiple-requests
fix(tenant-management): add modalBusy controls
pull/2070/head
Yasin Aydın
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
6 deletions
-
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts
-
npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts
|
|
|
@ -156,6 +156,8 @@ export class TenantsComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
saveConnectionString() { |
|
|
|
if (this.modalBusy) return; |
|
|
|
|
|
|
|
this.modalBusy = true; |
|
|
|
if (this.useSharedDatabase || (!this.useSharedDatabase && !this.connectionString)) { |
|
|
|
this.tenantService |
|
|
|
@ -181,13 +183,13 @@ export class TenantsComponent implements OnInit { |
|
|
|
} |
|
|
|
|
|
|
|
saveTenant() { |
|
|
|
if (!this.tenantForm.valid) return; |
|
|
|
if (!this.tenantForm.valid || this.modalBusy) return; |
|
|
|
this.modalBusy = true; |
|
|
|
|
|
|
|
this.store |
|
|
|
.dispatch( |
|
|
|
this.selected.id |
|
|
|
? new UpdateTenant({ ...this.tenantForm.value, id: this.selected.id }) |
|
|
|
? new UpdateTenant({ ...this.selected, ...this.tenantForm.value, id: this.selected.id }) |
|
|
|
: new CreateTenant(this.tenantForm.value), |
|
|
|
) |
|
|
|
.pipe(finalize(() => (this.modalBusy = false))) |
|
|
|
|
|
|
|
@ -62,9 +62,8 @@ export class TenantManagementState { |
|
|
|
|
|
|
|
@Action(UpdateTenant) |
|
|
|
update({ dispatch, getState }: StateContext<TenantManagement.State>, { payload }: UpdateTenant) { |
|
|
|
return dispatch(new GetTenantById(payload.id)).pipe( |
|
|
|
switchMap(() => this.tenantManagementService.updateTenant({ ...getState().selectedItem, ...payload })), |
|
|
|
switchMap(() => dispatch(new GetTenants())), |
|
|
|
); |
|
|
|
return this.tenantManagementService |
|
|
|
.updateTenant({ ...getState().selectedItem, ...payload }) |
|
|
|
.pipe(switchMap(() => dispatch(new GetTenants()))); |
|
|
|
} |
|
|
|
} |
|
|
|
|