fix: add finalize operator to set false the modalBusy

resolves #2093
pull/2094/head
mehmet-erim 5 years ago
parent 2d7adf1f01
commit 208a5e3ab5

@ -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;
});
}

@ -90,8 +90,8 @@ export class RolesComponent implements OnInit {
? new UpdateRole({ ...this.selected, ...this.form.value, id: this.selected.id })
: new CreateRole(this.form.value),
)
.pipe(finalize(() => (this.modalBusy = false)))
.subscribe(() => {
this.modalBusy = false;
this.isModalVisible = false;
});
}

@ -186,8 +186,8 @@ export class UsersComponent implements OnInit {
roleNames: mappedRoleNames,
}),
)
.pipe(finalize(() => (this.modalBusy = false)))
.subscribe(() => {
this.modalBusy = false;
this.isModalVisible = false;
});
}

@ -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 {

Loading…
Cancel
Save