Browse Source

Merge branch 'master' into dev

pull/2047/head
mehmet-erim 7 years ago
parent
commit
d073bf2dec
  1. 6
      npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts
  2. 7
      npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts

6
npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts

@ -156,6 +156,8 @@ export class TenantsComponent implements OnInit {
} }
saveConnectionString() { saveConnectionString() {
if (this.modalBusy) return;
this.modalBusy = true; this.modalBusy = true;
if (this.useSharedDatabase || (!this.useSharedDatabase && !this.connectionString)) { if (this.useSharedDatabase || (!this.useSharedDatabase && !this.connectionString)) {
this.tenantService this.tenantService
@ -181,13 +183,13 @@ export class TenantsComponent implements OnInit {
} }
saveTenant() { saveTenant() {
if (!this.tenantForm.valid) return; if (!this.tenantForm.valid || this.modalBusy) return;
this.modalBusy = true; this.modalBusy = true;
this.store this.store
.dispatch( .dispatch(
this.selected.id 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), : new CreateTenant(this.tenantForm.value),
) )
.pipe(finalize(() => (this.modalBusy = false))) .pipe(finalize(() => (this.modalBusy = false)))

7
npm/ng-packs/packages/tenant-management/src/lib/states/tenant-management.state.ts

@ -62,9 +62,8 @@ export class TenantManagementState {
@Action(UpdateTenant) @Action(UpdateTenant)
update({ dispatch, getState }: StateContext<TenantManagement.State>, { payload }: UpdateTenant) { update({ dispatch, getState }: StateContext<TenantManagement.State>, { payload }: UpdateTenant) {
return dispatch(new GetTenantById(payload.id)).pipe( return this.tenantManagementService
switchMap(() => this.tenantManagementService.updateTenant({ ...getState().selectedItem, ...payload })), .updateTenant({ ...getState().selectedItem, ...payload })
switchMap(() => dispatch(new GetTenants())), .pipe(switchMap(() => dispatch(new GetTenants())));
);
} }
} }

Loading…
Cancel
Save