From 3ec86f150e5ef1f9728137eff0aa8210248cb015 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 6 Nov 2019 09:01:16 +0300 Subject: [PATCH] fix: add finalize operator to set false the modalBusy resolves #2093 --- .../feature-management.component.ts | 16 ++++++++-------- .../src/lib/components/roles/roles.component.ts | 2 +- .../src/lib/components/users/users.component.ts | 2 +- .../permission-management.component.ts | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts index bf8e5b2e5e4..a25d6b41ee3 100644 --- a/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts +++ b/npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.ts @@ -5,11 +5,11 @@ import { GetFeatures, UpdateFeatures } from '../../actions'; import { FeatureManagement } from '../../models/feature-management'; import { FeatureManagementState } from '../../states'; import { FormGroup, FormControl } from '@angular/forms'; -import { pluck, tap } from 'rxjs/operators'; +import { pluck, finalize } from 'rxjs/operators'; @Component({ selector: 'abp-feature-management', - templateUrl: './feature-management.component.html' + templateUrl: './feature-management.component.html', }) export class FeatureManagementComponent { @Input() @@ -56,8 +56,8 @@ export class FeatureManagementComponent { .dispatch( new GetFeatures({ providerKey: this.providerKey, - providerName: this.providerName - }) + providerName: this.providerName, + }), ) .pipe(pluck('FeatureManagementState', 'features')) .subscribe(features => { @@ -82,7 +82,7 @@ export class FeatureManagementComponent { features = features.map((feature, i) => ({ name: feature.name, - value: !this.form.value[i] || this.form.value[i] === 'false' ? null : this.form.value[i] + value: !this.form.value[i] || this.form.value[i] === 'false' ? null : this.form.value[i], })); this.store @@ -90,11 +90,11 @@ export class FeatureManagementComponent { new UpdateFeatures({ providerKey: this.providerKey, providerName: this.providerName, - features - }) + features, + }), ) + .pipe(finalize(() => (this.modalBusy = false))) .subscribe(() => { - this.modalBusy = false; this.visible = false; }); } diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts index 96cf0efdc5a..27b7d349470 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts @@ -95,8 +95,8 @@ export class RolesComponent implements OnInit { ? new UpdateRole({ ...this.form.value, id: this.selected.id }) : new CreateRole(this.form.value), ) + .pipe(finalize(() => (this.modalBusy = false))) .subscribe(() => { - this.modalBusy = false; this.isModalVisible = false; }); } diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts index d010abf3dd9..8e71813c93f 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.ts @@ -149,8 +149,8 @@ export class UsersComponent implements OnInit { roleNames: mappedRoleNames, }), ) + .pipe(finalize(() => (this.modalBusy = false))) .subscribe(() => { - this.modalBusy = false; this.isModalVisible = false; }); } diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts index c968df1e3dc..15848cde252 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts +++ b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts @@ -11,7 +11,7 @@ import { } from '@angular/core'; import { Select, Store } from '@ngxs/store'; import { from, Observable } from 'rxjs'; -import { map, pluck, take } from 'rxjs/operators'; +import { map, pluck, take, finalize } from 'rxjs/operators'; import { GetPermissions, UpdatePermissions } from '../actions/permission-management.actions'; import { PermissionManagement } from '../models/permission-management'; import { PermissionManagementState } from '../states/permission-management.state'; @@ -208,8 +208,8 @@ export class PermissionManagementComponent implements OnInit, OnChanges { permissions: changedPermissions }) ) + .pipe(finalize(() => (this.modalBusy = false))) .subscribe(() => { - this.modalBusy = false; this.visible = false; }); } else {