Skip to content

Commit a621c9d

Browse files
authored
Merge pull request #584 from iyilm4z/unwanted-modal-delay-on-closing
Fixes unwanted modal delay on closing
2 parents 963bf8e + 8b14759 commit a621c9d

File tree

8 files changed

+58
-80
lines changed

8 files changed

+58
-80
lines changed

angular/src/account/tenant/tenant-change-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Component, Injector } from '@angular/core';
2-
import { finalize } from 'rxjs/operators';
32
import { BsModalRef } from 'ngx-bootstrap/modal';
43
import { AppComponentBase } from '@shared/app-component-base';
54
import { AccountServiceProxy } from '@shared/service-proxies/service-proxies';
@@ -36,14 +35,8 @@ export class TenantChangeDialogComponent extends AppComponentBase {
3635
input.tenancyName = this.tenancyName;
3736

3837
this.saving = true;
39-
this._accountService
40-
.isTenantAvailable(input)
41-
.pipe(
42-
finalize(() => {
43-
this.saving = false;
44-
})
45-
)
46-
.subscribe((result: IsTenantAvailableOutput) => {
38+
this._accountService.isTenantAvailable(input).subscribe(
39+
(result: IsTenantAvailableOutput) => {
4740
switch (result.state) {
4841
case AppTenantAvailabilityState.Available:
4942
abp.multiTenancy.setTenantIdCookie(result.tenantId);
@@ -58,6 +51,10 @@ export class TenantChangeDialogComponent extends AppComponentBase {
5851
);
5952
break;
6053
}
61-
});
54+
},
55+
() => {
56+
this.saving = false;
57+
}
58+
);
6259
}
6360
}

angular/src/app/roles/create-role/create-role-dialog.component.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
EventEmitter,
66
Output,
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { AppComponentBase } from '@shared/app-component-base';
1110
import {
@@ -84,15 +83,15 @@ export class CreateRoleDialogComponent extends AppComponentBase
8483

8584
this._roleService
8685
.create(role)
87-
.pipe(
88-
finalize(() => {
86+
.subscribe(
87+
() => {
88+
this.notify.info(this.l('SavedSuccessfully'));
89+
this.bsModalRef.hide();
90+
this.onSave.emit();
91+
},
92+
() => {
8993
this.saving = false;
90-
})
91-
)
92-
.subscribe(() => {
93-
this.notify.info(this.l('SavedSuccessfully'));
94-
this.bsModalRef.hide();
95-
this.onSave.emit();
96-
});
94+
}
95+
);
9796
}
9897
}

angular/src/app/roles/edit-role/edit-role-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
EventEmitter,
66
Output,
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { forEach as _forEach, includes as _includes, map as _map } from 'lodash-es';
1110
import { AppComponentBase } from '@shared/app-component-base';
@@ -84,17 +83,15 @@ export class EditRoleDialogComponent extends AppComponentBase
8483
role.init(this.role);
8584
role.grantedPermissions = this.getCheckedPermissions();
8685

87-
this._roleService
88-
.update(role)
89-
.pipe(
90-
finalize(() => {
91-
this.saving = false;
92-
})
93-
)
94-
.subscribe(() => {
86+
this._roleService.update(role).subscribe(
87+
() => {
9588
this.notify.info(this.l('SavedSuccessfully'));
9689
this.bsModalRef.hide();
9790
this.onSave.emit();
98-
});
91+
},
92+
() => {
93+
this.saving = false;
94+
}
95+
);
9996
}
10097
}

angular/src/app/tenants/create-tenant/create-tenant-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Output,
66
EventEmitter
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { AppComponentBase } from '@shared/app-component-base';
1110
import {
@@ -38,17 +37,15 @@ export class CreateTenantDialogComponent extends AppComponentBase
3837
save(): void {
3938
this.saving = true;
4039

41-
this._tenantService
42-
.create(this.tenant)
43-
.pipe(
44-
finalize(() => {
45-
this.saving = false;
46-
})
47-
)
48-
.subscribe(() => {
40+
this._tenantService.create(this.tenant).subscribe(
41+
() => {
4942
this.notify.info(this.l('SavedSuccessfully'));
5043
this.bsModalRef.hide();
5144
this.onSave.emit();
52-
});
45+
},
46+
() => {
47+
this.saving = false;
48+
}
49+
);
5350
}
5451
}

angular/src/app/tenants/edit-tenant/edit-tenant-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
Output,
66
EventEmitter
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { AppComponentBase } from '@shared/app-component-base';
1110
import {
@@ -41,17 +40,15 @@ export class EditTenantDialogComponent extends AppComponentBase
4140
save(): void {
4241
this.saving = true;
4342

44-
this._tenantService
45-
.update(this.tenant)
46-
.pipe(
47-
finalize(() => {
48-
this.saving = false;
49-
})
50-
)
51-
.subscribe(() => {
43+
this._tenantService.update(this.tenant).subscribe(
44+
() => {
5245
this.notify.info(this.l('SavedSuccessfully'));
5346
this.bsModalRef.hide();
5447
this.onSave.emit();
55-
});
48+
},
49+
() => {
50+
this.saving = false;
51+
}
52+
);
5653
}
5754
}

angular/src/app/users/create-user/create-user-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
EventEmitter,
66
Output
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { forEach as _forEach, map as _map } from 'lodash-es';
1110
import { AppComponentBase } from '@shared/app-component-base';
@@ -92,17 +91,15 @@ export class CreateUserDialogComponent extends AppComponentBase
9291

9392
this.user.roleNames = this.getCheckedRoles();
9493

95-
this._userService
96-
.create(this.user)
97-
.pipe(
98-
finalize(() => {
99-
this.saving = false;
100-
})
101-
)
102-
.subscribe(() => {
94+
this._userService.create(this.user).subscribe(
95+
() => {
10396
this.notify.info(this.l('SavedSuccessfully'));
10497
this.bsModalRef.hide();
10598
this.onSave.emit();
106-
});
99+
},
100+
() => {
101+
this.saving = false;
102+
}
103+
);
107104
}
108105
}

angular/src/app/users/edit-user/edit-user-dialog.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
EventEmitter,
66
Output
77
} from '@angular/core';
8-
import { finalize } from 'rxjs/operators';
98
import { BsModalRef } from 'ngx-bootstrap/modal';
109
import { forEach as _forEach, includes as _includes, map as _map } from 'lodash-es';
1110
import { AppComponentBase } from '@shared/app-component-base';
@@ -78,17 +77,15 @@ export class EditUserDialogComponent extends AppComponentBase
7877

7978
this.user.roleNames = this.getCheckedRoles();
8079

81-
this._userService
82-
.update(this.user)
83-
.pipe(
84-
finalize(() => {
85-
this.saving = false;
86-
})
87-
)
88-
.subscribe(() => {
80+
this._userService.update(this.user).subscribe(
81+
() => {
8982
this.notify.info(this.l('SavedSuccessfully'));
9083
this.bsModalRef.hide();
9184
this.onSave.emit();
92-
});
85+
},
86+
() => {
87+
this.saving = false;
88+
}
89+
);
9390
}
9491
}

angular/src/app/users/reset-password/reset-password.component.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Component, OnInit, Injector } from '@angular/core';
22
import { AppComponentBase } from '@shared/app-component-base';
3-
import { finalize } from 'rxjs/operators';
43
import {
54
UserServiceProxy,
65
ResetPasswordDto
@@ -37,16 +36,14 @@ export class ResetPasswordDialogComponent extends AppComponentBase
3736

3837
public resetPassword(): void {
3938
this.isLoading = true;
40-
this._userService
41-
.resetPassword(this.resetPasswordDto)
42-
.pipe(
43-
finalize(() => {
44-
this.isLoading = false;
45-
})
46-
)
47-
.subscribe(() => {
39+
this._userService.resetPassword(this.resetPasswordDto).subscribe(
40+
() => {
4841
this.notify.info('Password Reset');
4942
this.bsModalRef.hide();
50-
});
43+
},
44+
() => {
45+
this.isLoading = false;
46+
}
47+
);
5148
}
5249
}

0 commit comments

Comments
 (0)