Skip to content

Commit 11a9534

Browse files
committed
working on singleton services
1 parent 76b3120 commit 11a9534

File tree

16 files changed

+194
-121
lines changed

16 files changed

+194
-121
lines changed

config/development.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"api": {
3-
"baseUrl": "http://192.192.7.224:8000/api/v1/"
3+
"baseUrl": "http://localhost:8000/api/v1/"
44
},
55

66
"paths": {

src/app/admin/access/permission/permission.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export class PermissionComponent implements OnInit {
1414
constructor(private router: Router) { }
1515

1616
ngOnInit() {
17-
console.log('... Initializing Permissions component');
1817
}
1918

2019
}

src/app/admin/access/permission/permission.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ const containers = [
5252
CommonPipesModule,
5353
TooltipModule.forRoot(),
5454
BsDropdownModule.forRoot(),
55-
StoreModule.forFeature('accessPermission', reducers),
56-
EffectsModule.forFeature(effects),
5755
SweetAlert2Module,
5856
AngularMultiSelectModule,
5957
PermissionRoutingModule

src/app/admin/access/permission/permission.sandbox.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export class AccessPermissionSandbox extends Sandbox {
121121
) {
122122
super();
123123
this.registerAuthEvents();
124+
console.log("calling permission sandbox constructor");
124125
}
125126

126127
/**

src/app/admin/access/permission/store/reducers/create-permission.reducer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export function reducer(
4242
...state,
4343
loading: true,
4444
loaded: false,
45-
failed: false
45+
failed: false,
46+
error: null,
47+
permission: null
4648
}
4749
}
4850

src/app/admin/access/permission/store/reducers/update-permission.reducer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ export function reducer(
4242
...state,
4343
loading: true,
4444
loaded: false,
45-
failed: false
45+
failed: false,
46+
error: null,
47+
permission: null
4648
}
4749
}
4850

src/app/admin/access/role/containers/create-role/create-role.container.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="card">
2-
<form [formGroup]="roleForm" novalidate (ngSubmit)="onSubmit($event, roleForm.value)">
2+
<form [formGroup]="form" novalidate (ngSubmit)="onSubmit($event, form.value)">
33
<div class="card-header">
4-
<i class="fa fa-tag"></i> {{'accessRole.heading.create' | translate}}
4+
<i class="fa fa-tag"></i> {{ formTitle }}
55
</div>
66
<div class="card-body">
77
<div class="row">
@@ -65,12 +65,12 @@
6565
</div>
6666
</div>
6767
<div class="card-footer">
68-
<button class="btn btn-outline-primary px-3" [disabled]="roleForm.invalid" type="submit">
69-
<i [hidden]="accessRoleSandbox.createRoleLoading$ | async" class='fa fa-save'></i>
70-
<i [hidden]="!(accessRoleSandbox.createRoleLoading$ | async)" class='fa fa-circle-o-notch fa-spin'></i>
68+
<button class="btn btn-outline-primary px-3" [disabled]="form.invalid" type="submit">
69+
<i [hidden]="loadingObservable$ | async" class='fa fa-save'></i>
70+
<i [hidden]="!(loadingObservable$ | async)" class='fa fa-circle-o-notch fa-spin'></i>
7171
{{'btn.lbl.submit' | translate}}
7272
</button>
73-
<button type="submit" class="btn btn-outline-danger" routerLink="/admin/access/role/list"><i class="fa fa-arrow-left"></i> {{'btn.lbl.goBack' | translate}}</button>
73+
<button type="button" class="btn btn-outline-danger" routerLink="/admin/access/role/list"><i class="fa fa-arrow-left"></i> {{'btn.lbl.goBack' | translate}}</button>
7474
</div>
7575
</form>
7676
</div>
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import {
2-
Component,
3-
OnDestroy,
4-
OnInit,
2+
Component,
53
Injector,
64
ChangeDetectionStrategy
75
} from '@angular/core';
@@ -14,7 +12,7 @@ import RoleForm from '../../models/role-form.model';
1412
styleUrls: ['./create-role.container.scss'],
1513
changeDetection: ChangeDetectionStrategy.OnPush
1614
})
17-
export class CreateRoleContainer extends RoleFormContainer implements OnInit {
15+
export class CreateRoleContainer extends RoleFormContainer {
1816

1917
/**
2018
* Creates an instance of UpdateRoleContainer.
@@ -26,16 +24,8 @@ export class CreateRoleContainer extends RoleFormContainer implements OnInit {
2624
injector: Injector
2725
) {
2826
super(injector);
29-
}
30-
31-
/**
32-
* On Init container
33-
*
34-
* @memberof CreateRoleContainer
35-
*/
36-
ngOnInit() {
37-
this.registerSubscriptions();
38-
this.accessPermissionSandbox.getPermissions();
27+
this.formTitle = this.translateService.instant('accessRole.heading.create');
28+
this.loadingObservable$ = this.accessRoleSandbox.createRoleLoading$;
3929
}
4030

4131
/**
@@ -56,15 +46,4 @@ export class CreateRoleContainer extends RoleFormContainer implements OnInit {
5646

5747
this.accessRoleSandbox.createRole(new RoleForm(formData));
5848
}
59-
60-
/**
61-
* Unsubscribe from all Observables
62-
*
63-
* @memberof CreateRoleContainer
64-
*/
65-
public onNgDestroy() {
66-
this.routerSubscription.unsubscribe();
67-
this.accessRoleSandbox.unregisterEvents();
68-
this.accessPermissionSandbox.unregisterEvents();
69-
}
7049
}

0 commit comments

Comments
 (0)