Skip to content

Commit dcbb214

Browse files
committed
updated all compnents to work with RxJs 6
1 parent e06ef30 commit dcbb214

File tree

14 files changed

+56
-52
lines changed

14 files changed

+56
-52
lines changed

angular/src/account/login/login.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MessageService } from '@abp/message/message.service';
88
import { LogService } from '@abp/log/log.service';
99
import { TokenService } from '@abp/auth/token.service';
1010
import { UtilsService } from '@abp/utils/utils.service';
11+
import { finalize } from 'rxjs/operators';
1112

1213
@Injectable()
1314
export class LoginService {
@@ -35,7 +36,7 @@ export class LoginService {
3536

3637
this._tokenAuthService
3738
.authenticate(this.authenticateModel)
38-
.finally(finallyCallback)
39+
.pipe(finalize(() => { finallyCallback() }))
3940
.subscribe((result: AuthenticateResultModel) => {
4041
this.processAuthenticateResult(result);
4142
});

angular/src/account/register/register.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Component, Injector, ElementRef, AfterViewInit, ViewChild } from '@angular/core';
1+
import { Component, Injector, ElementRef, AfterViewInit, ViewChild } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { AccountServiceProxy, RegisterInput, RegisterOutput } from '@shared/service-proxies/service-proxies'
44
import { AppComponentBase } from '@shared/app-component-base';
55
import { LoginService } from '../login/login.service';
66
import { accountModuleAnimation } from '@shared/animations/routerTransition';
7+
import { finalize } from 'rxjs/operators';
78

89
@Component({
910
templateUrl: './register.component.html',
@@ -37,7 +38,7 @@ export class RegisterComponent extends AppComponentBase implements AfterViewInit
3738
save(): void {
3839
this.saving = true;
3940
this._accountService.register(this.model)
40-
.finally(() => { this.saving = false; })
41+
.pipe(finalize(() => { this.saving = false; }))
4142
.subscribe((result:RegisterOutput) => {
4243
if (!result.canLogin) {
4344
this.notify.success(this.l('SuccessfullyRegistered'));

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Component, OnInit, ViewChild, Injector, ElementRef } from '@angular/core';
1+
import { Component, OnInit, ViewChild, Injector, ElementRef } from '@angular/core';
22
import { AppComponentBase } from '@shared/app-component-base';
33
import { AccountServiceProxy } from '@shared/service-proxies/service-proxies';
4-
import { IsTenantAvailableInput } from '@shared/service-proxies/service-proxies';
4+
import { IsTenantAvailableInput, IsTenantAvailableOutput } from '@shared/service-proxies/service-proxies';
55
import { AppTenantAvailabilityState } from '@shared/AppEnums';
66
import { ModalDirective } from 'ngx-bootstrap';
7+
import { finalize } from 'rxjs/operators';
78

89
@Component({
910
selector: 'tenantChangeModal',
@@ -50,8 +51,8 @@ export class TenantChangeModalComponent extends AppComponentBase {
5051

5152
this.saving = true;
5253
this._accountService.isTenantAvailable(input)
53-
.finally(() => { this.saving = false; })
54-
.subscribe((result) => {
54+
.pipe(finalize(() => { this.saving = false; }))
55+
.subscribe((result: IsTenantAvailableOutput) => {
5556
switch (result.state) {
5657
case AppTenantAvailabilityState.Available:
5758
abp.multiTenancy.setTenantIdCookie(result.tenantId);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
1+
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
22
import { ModalDirective } from 'ngx-bootstrap';
33
import { RoleServiceProxy, CreateRoleDto, ListResultDtoOfPermissionDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
5+
import { finalize } from 'rxjs/operators';
56

67
@Component({
78
selector: 'create-role-modal',
@@ -58,7 +59,7 @@ export class CreateRoleComponent extends AppComponentBase implements OnInit {
5859

5960
this.saving = true;
6061
this._roleService.create(this.role)
61-
.finally(() => { this.saving = false; })
62+
.pipe(finalize(() => { this.saving = false; }))
6263
.subscribe(() => {
6364
this.notify.info(this.l('SavedSuccessfully'));
6465
this.close();

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
1+
import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
22
import { ModalDirective } from 'ngx-bootstrap';
33
import { RoleServiceProxy, RoleDto, ListResultDtoOfPermissionDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
5+
import { finalize } from 'rxjs/operators';
56

67
@Component({
78
selector: 'edit-role-modal',
@@ -34,10 +35,10 @@ export class EditRoleComponent extends AppComponentBase implements OnInit {
3435

3536
show(id: number): void {
3637
this._roleService.get(id)
37-
.finally(() => {
38+
.pipe(finalize(() => {
3839
this.active = true;
3940
this.modal.show();
40-
})
41+
}))
4142
.subscribe((result: RoleDto) => {
4243
this.role = result;
4344
});
@@ -69,7 +70,7 @@ export class EditRoleComponent extends AppComponentBase implements OnInit {
6970
this.role.permissions = permissions;
7071
this.saving = true;
7172
this._roleService.update(this.role)
72-
.finally(() => { this.saving = false; })
73+
.pipe(finalize(() => { this.saving = false; }))
7374
.subscribe(() => {
7475
this.notify.info(this.l('SavedSuccessfully'));
7576
this.close();

angular/src/app/roles/roles.component.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { Component, Injector, ViewChild } from '@angular/core';
1+
import { Component, Injector, ViewChild } from '@angular/core';
22
import { PagedListingComponentBase, PagedRequestDto } from "shared/paged-listing-component-base";
33
import { RoleServiceProxy, RoleDto, PagedResultDtoOfRoleDto } from "shared/service-proxies/service-proxies";
44
import { appModuleAnimation } from '@shared/animations/routerTransition';
55
import { CreateRoleComponent } from "app/roles/create-role/create-role.component";
66
import { EditRoleComponent } from "app/roles/edit-role/edit-role.component";
7+
import { finalize } from 'rxjs/operators';
78

89
@Component({
910
templateUrl: './roles.component.html',
@@ -24,10 +25,8 @@ export class RolesComponent extends PagedListingComponentBase<RoleDto> {
2425
}
2526

2627
list(request: PagedRequestDto, pageNumber: number, finishedCallback: Function): void {
27-
this.rolesService.getAll(request.skipCount, request.maxResultCount)
28-
.finally( ()=> {
29-
finishedCallback();
30-
})
28+
this.rolesService.getAll(request.skipCount, request.maxResultCount)
29+
.pipe(finalize(() => { finishedCallback() }))
3130
.subscribe((result: PagedResultDtoOfRoleDto)=>{
3231
this.roles = result.items;
3332
this.showPaging(result, pageNumber);
@@ -41,11 +40,11 @@ export class RolesComponent extends PagedListingComponentBase<RoleDto> {
4140
(result:boolean) =>{
4241
if(result)
4342
{
44-
this.rolesService.delete(role.id)
45-
.finally(() => {
46-
abp.notify.info("Deleted Role: " + role.displayName );
47-
this.refresh();
48-
})
43+
this.rolesService.delete(role.id)
44+
.pipe(finalize(() => {
45+
abp.notify.info("Deleted Role: " + role.displayName);
46+
this.refresh();
47+
}))
4948
.subscribe(() => { });
5049
}
5150
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef } from
22
import { ModalDirective } from 'ngx-bootstrap';
33
import { TenantServiceProxy, CreateTenantDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
5+
import { finalize } from 'rxjs/operators';
56

67
@Component({
78
selector: 'create-tenant-modal',
@@ -39,7 +40,7 @@ export class CreateTenantComponent extends AppComponentBase {
3940
save(): void {
4041
this.saving = true;
4142
this._tenantService.create(this.tenant)
42-
.finally(() => { this.saving = false; })
43+
.pipe(finalize(() => { this.saving = false; }))
4344
.subscribe(() => {
4445
this.notify.info(this.l('SavedSuccessfully'));
4546
this.close();

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef} from
22
import { ModalDirective } from 'ngx-bootstrap';
33
import { TenantServiceProxy, TenantDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
5+
import { finalize } from 'rxjs/operators';
56

67
@Component({
78
selector: 'edit-tenant-modal',
@@ -27,10 +28,10 @@ export class EditTenantComponent extends AppComponentBase{
2728

2829
show(id:number): void {
2930
this._tenantService.get(id)
30-
.finally(()=>{
31-
this.active = true;
32-
this.modal.show();
33-
})
31+
.pipe(finalize(() => {
32+
this.active = true;
33+
this.modal.show();
34+
}))
3435
.subscribe((result: TenantDto)=>{
3536
this.tenant = result;
3637
});
@@ -43,7 +44,7 @@ export class EditTenantComponent extends AppComponentBase{
4344
save(): void {
4445
this.saving = true;
4546
this._tenantService.update(this.tenant)
46-
.finally(() => { this.saving = false; })
47+
.pipe(finalize(() => { this.saving = false; }))
4748
.subscribe(() => {
4849
this.notify.info(this.l('SavedSuccessfully'));
4950
this.close();

angular/src/app/tenants/tenants.component.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Component, Injector, ViewChild } from '@angular/core';
1+
import { Component, Injector, ViewChild } from '@angular/core';
22
import { appModuleAnimation } from '@shared/animations/routerTransition';
33
import { TenantServiceProxy, TenantDto, PagedResultDtoOfTenantDto } from '@shared/service-proxies/service-proxies';
44

55
import { PagedListingComponentBase, PagedRequestDto } from "shared/paged-listing-component-base";
66
import { EditTenantComponent } from "app/tenants/edit-tenant/edit-tenant.component";
77
import { CreateTenantComponent } from "app/tenants/create-tenant/create-tenant.component";
8+
import { finalize } from 'rxjs/operators';
89

910
@Component({
1011
templateUrl: './tenants.component.html',
@@ -26,9 +27,7 @@ export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
2627

2728
list(request:PagedRequestDto, pageNumber:number, finishedCallback: Function): void {
2829
this._tenantService.getAll(request.skipCount, request.maxResultCount)
29-
.finally(()=>{
30-
finishedCallback();
31-
})
30+
.pipe(finalize(() => { finishedCallback() }))
3231
.subscribe((result:PagedResultDtoOfTenantDto)=>{
3332
this.tenants = result.items;
3433
this.showPaging(result, pageNumber);
@@ -40,11 +39,11 @@ export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
4039
"Delete tenant '"+ tenant.name +"'?",
4140
(result:boolean) => {
4241
if(result) {
43-
this._tenantService.delete(tenant.id)
44-
.finally(() => {
45-
abp.notify.info("Deleted tenant: " + tenant.name );
46-
this.refresh();
47-
})
42+
this._tenantService.delete(tenant.id)
43+
.pipe(finalize(() => {
44+
abp.notify.info("Deleted tenant: " + tenant.name);
45+
this.refresh();
46+
}))
4847
.subscribe(() => { });
4948
}
5049
}
@@ -59,4 +58,4 @@ export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
5958
editTenant(tenant:TenantDto): void{
6059
this.editTenantModal.show(tenant.id);
6160
}
62-
}
61+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, ViewChild, Injector, Output, EventEmitter, ElementRef, OnIni
22
import { ModalDirective } from 'ngx-bootstrap';
33
import { UserServiceProxy, CreateUserDto, RoleDto } from '@shared/service-proxies/service-proxies';
44
import { AppComponentBase } from '@shared/app-component-base';
5+
import { finalize } from 'rxjs/operators';
56

67
@Component({
78
selector: 'create-user-modal',
@@ -56,7 +57,7 @@ export class CreateUserComponent extends AppComponentBase implements OnInit {
5657
this.user.roleNames = roles;
5758
this.saving = true;
5859
this._userService.create(this.user)
59-
.finally(() => { this.saving = false; })
60+
.pipe(finalize(() => { this.saving = false; }))
6061
.subscribe(() => {
6162
this.notify.info(this.l('SavedSuccessfully'));
6263
this.close();

0 commit comments

Comments
 (0)