Skip to content

Commit

Permalink
fix: add finalize operator to set false the modalBusy
Browse files Browse the repository at this point in the history
resolves #2093
  • Loading branch information
mehmet-erim committed Nov 6, 2019
1 parent e5803aa commit 3ec86f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 => {
Expand All @@ -82,19 +82,19 @@ 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
.dispatch(
new UpdateFeatures({
providerKey: this.providerKey,
providerName: this.providerName,
features
})
features,
}),
)
.pipe(finalize(() => (this.modalBusy = false)))
.subscribe(() => {
this.modalBusy = false;
this.visible = false;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export class UsersComponent implements OnInit {
roleNames: mappedRoleNames,
}),
)
.pipe(finalize(() => (this.modalBusy = false)))
.subscribe(() => {
this.modalBusy = false;
this.isModalVisible = false;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 3ec86f1

Please sign in to comment.