- implement admin-page
- delete unnecessary pages (salutations,....)
- refactoring
- adapt routing
- adapt modules
diff --git a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.html b/src/app/pages/admin/address-types/address-types-list/address-types-list.component.html
deleted file mode 100644
index f04ce79..0000000
--- a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!-- /********************************************************************************
-* Copyright (c) 2020 Contributors to the Eclipse Foundation
-*
-* See the NOTICE file(s) distributed with this work for additional
-* information regarding copyright ownership.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v. 2.0 which is available at
-* http://www.eclipse.org/legal/epl-2.0.
-*
-* SPDX-License-Identifier: EPL-2.0
-********************************************************************************/ -->
-<app-card-layout>
- <div header>
- <span>{{ 'AddressTypes.Title' | translate }}</span>
- <div class="pull-right" *visibleByRight>
- <button class="btn btn-primary new-button" (click)="sandbox.setDisplayForm()">
- {{ 'AddressTypes.New' | translate }}
- </button>
- </div>
- </div>
- <div class="address-types-grid-wrapper" body>
- <ag-grid-angular
- autoResizeColumns
- class="ag-theme-balham"
- [ngClass]="sandbox.displayForm ? 'ag-grid-height-edit' : 'ag-grid-height-list'"
- [class.ag-grid-height-list]="!sandbox.displayForm"
- [gridOptions]="gridOptions"
- [columnDefs]="columnDefinition"
- [rowSelection]="'single'"
- [frameworkComponents]="frameworkComponents"
- [rowData]="sandbox.addressTypes$ | async"
- [overlayNoRowsTemplate]="noRowsTemplate"
- >
- </ag-grid-angular>
-
- <app-spinner [isRunning]="sandbox.addressTypesloading$ | async"></app-spinner>
-
- <div *ngIf="sandbox.displayForm" class="address-types-details">
- <app-address-types-details></app-address-types-details>
- </div>
- </div>
-</app-card-layout>
diff --git a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.scss b/src/app/pages/admin/address-types/address-types-list/address-types-list.component.scss
deleted file mode 100644
index 57d69f3..0000000
--- a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.scss
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-.address-types-grid-wrapper {
- position: relative;
-}
-
-.address-types-details {
- margin-top: 20px;
-}
-
-.ag-grid-height-edit {
- height: calc(100vh - 450px);
-}
-
-.ag-grid-height-list {
- height: calc(100vh - 200px);
-}
-
-.new-button {
- margin-right: 20px;
-}
diff --git a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.spec.ts b/src/app/pages/admin/address-types/address-types-list/address-types-list.component.spec.ts
deleted file mode 100644
index d11af58..0000000
--- a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.spec.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { AddressTypesListComponent } from '@pages/admin/address-types/address-types-list/address-types-list.component';
-import { AddressType } from '@shared/models';
-
-describe('AddressTypesListComponent', () => {
- let component: AddressTypesListComponent;
- const sandbox: any = {
- setDisplayForm: () => {},
- loadAddressType: () => {},
- deleteAddressType: () => {},
- };
-
- beforeEach(() => {
- component = new AddressTypesListComponent(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should initialize gridOptions context', () => {
- component.ngOnInit();
- expect(component.gridOptions.context.icons.edit).toBeTruthy();
- expect(component.gridOptions.context.icons.delete).toBeTruthy();
- });
-
- it('should call appropriate functions for edit event', () => {
- const spy1: any = spyOn(sandbox, 'setDisplayForm');
- const spy2: any = spyOn(sandbox, 'loadAddressType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "edit", data: new AddressType()});
- expect(spy1).toHaveBeenCalled();
- expect(spy2).toHaveBeenCalled();
- });
-
- it('should call appropriate functions for delete event', () => {
- const spy3: any = spyOn(sandbox, 'deleteAddressType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "delete", data: new AddressType()});
- expect(spy3).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.ts b/src/app/pages/admin/address-types/address-types-list/address-types-list.component.ts
deleted file mode 100644
index 0afe895..0000000
--- a/src/app/pages/admin/address-types/address-types-list/address-types-list.component.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { Component, OnInit, OnDestroy } from '@angular/core';
-import { BaseList } from '@shared/components/base-components/base.list';
-import { ADDRESS_TYPES_COLDEF } from '@pages/admin/address-types/address-types-list/address-types-list-column-definition';
-import { SetFilterComponent } from '@shared/filters/ag-grid/set-filter/set-filter.component';
-import { AddressTypesSandbox } from '@pages/admin/address-types//address-types.sandbox';
-import { Subscription } from 'rxjs';
-
-@Component({
- selector: 'app-address-types-list',
- templateUrl: './address-types-list.component.html',
- styleUrls: ['./address-types-list.component.scss'],
-})
-export class AddressTypesListComponent extends BaseList implements OnInit, OnDestroy {
- public columnDefinition: any = ADDRESS_TYPES_COLDEF;
- public frameworkComponents: { setFilterComponent: any };
- private _subscription: Subscription;
-
- constructor(public sandbox: AddressTypesSandbox) {
- super();
- this.frameworkComponents = { setFilterComponent: SetFilterComponent };
- }
-
- ngOnInit() {
- this.gridOptions.context = {
- ...this.gridOptions.context,
- icons: { edit: true, delete: true },
- };
- this._subscription = this.gridOptions.context.eventSubject.subscribe(event => {
- if (event.type === 'edit' || event.type === 'readonly') {
- this.sandbox.setDisplayForm();
- this.sandbox.loadAddressType(event.data.id);
- }
- if (event.type === 'delete') {
- this.sandbox.deleteAddressType(event.data.id);
- }
- });
- }
-
- ngOnDestroy() {
- this._subscription.unsubscribe();
- }
-}
diff --git a/src/app/pages/admin/address-types/address-types.resolver.spec.ts b/src/app/pages/admin/address-types/address-types.resolver.spec.ts
deleted file mode 100644
index 59a4545..0000000
--- a/src/app/pages/admin/address-types/address-types.resolver.spec.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { async } from '@angular/core/testing';
-import { AddressTypesResolver } from '@pages/admin/address-types/address-types.resolver';
-
-describe('AddressTypesResolver', () => {
- let component: AddressTypesResolver;
- let sandbox: any;
-
- beforeEach(async(() => {
- sandbox = {
- clear() {},
- loadAddressTypes() {},
- } as any;
- }));
-
- beforeEach(() => {
- component = new AddressTypesResolver(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should call loadAddressTypes', () => {
- const spy = spyOn(sandbox, 'loadAddressTypes');
- component.resolve();
- expect(spy).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/address-types/address-types.resolver.ts b/src/app/pages/admin/address-types/address-types.resolver.ts
deleted file mode 100644
index 6d2fcfb..0000000
--- a/src/app/pages/admin/address-types/address-types.resolver.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { AddressTypesSandbox } from '@pages/admin/address-types/address-types.sandbox';
-import { Observable } from 'rxjs';
-import { Injectable } from '@angular/core';
-import { Resolve } from '@angular/router';
-import { ILoadAddressTypesSuccess } from '@shared/store/actions/admin/address-types.action';
-
-@Injectable()
-export class AddressTypesResolver implements Resolve<any> {
-
- constructor(private sandbox: AddressTypesSandbox) {}
-
- public resolve(): Observable<ILoadAddressTypesSuccess> {
- return this.sandbox.loadAddressTypes();
- }
-}
diff --git a/src/app/pages/admin/address-types/address-types.sandbox.ts b/src/app/pages/admin/address-types/address-types.sandbox.ts
index 076820c..0cbd766 100644
--- a/src/app/pages/admin/address-types/address-types.sandbox.ts
+++ b/src/app/pages/admin/address-types/address-types.sandbox.ts
@@ -30,7 +30,7 @@
@Injectable()
export class AddressTypesSandbox extends BaseSandbox {
public addressTypes$ = this.appState$.select(store.getAddressTypesData);
- public addressTypesloading$ = this.appState$.select(store.getAddressTypesLoading);
+ public addressTypesLoading$ = this.appState$.select(store.getAddressTypesLoading);
public formState$ = this.appState$.select(store.getAddressTypesDetails);
public currentFormState: FormGroupState<AddressType>;
public displayForm: boolean = false;
diff --git a/src/app/pages/admin/admin-routing.module.ts b/src/app/pages/admin/admin-routing.module.ts
index 7e4255b..dbbcef9 100644
--- a/src/app/pages/admin/admin-routing.module.ts
+++ b/src/app/pages/admin/admin-routing.module.ts
@@ -10,49 +10,19 @@
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
-import { PersonTypesResolver } from '@pages/admin/person-types/person-types.resolver';
-import { PersonTypesListComponent } from '@pages/admin/person-types/person-types-list/person-types-list.component';
-import { SalutationsResolver } from '@pages/admin/salutations/salutations.resolver';
-import { SalutationsListComponent } from '@pages/admin/salutations/salutations-list/salutations-list.component';
-import { CommunicationTypesListComponent } from '@pages/admin/communication-types/communication-types-list/communication-types-list.component';
-import { CommunicationTypesResolver } from '@pages/admin/communication-types/communication-types.resolver';
-import { AddressTypesListComponent } from '@pages/admin/address-types/address-types-list/address-types-list.component';
-import { AddressTypesResolver } from '@pages/admin/address-types/address-types.resolver';
+import { AdminResolver } from '@pages/admin/admin.resolver';
import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { AdminGuard } from '@app/shared/guards/admin.guard';
+import { AdminComponent } from './admin.component';
const adminRoutes: Routes = [
{
- path: 'salutations',
- component: SalutationsListComponent,
+ path: '',
+ component: AdminComponent,
canActivate: [AdminGuard],
resolve: {
- salutationsTable: SalutationsResolver,
- },
- },
- {
- path: 'communication-types',
- component: CommunicationTypesListComponent,
- canActivate: [AdminGuard],
- resolve: {
- communicationTypesTable: CommunicationTypesResolver,
- },
- },
- {
- path: 'person-types',
- component: PersonTypesListComponent,
- canActivate: [AdminGuard],
- resolve: {
- personTypesTable: PersonTypesResolver,
- },
- },
- {
- path: 'address-types',
- component: AddressTypesListComponent,
- canActivate: [AdminGuard],
- resolve: {
- personTypesTable: AddressTypesResolver,
+ admin: AdminResolver,
},
},
];
diff --git a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.html b/src/app/pages/admin/admin.component.html
similarity index 75%
rename from src/app/pages/admin/salutations/salutations-list/salutations-list.component.html
rename to src/app/pages/admin/admin.component.html
index d2678c8..a8a9bd1 100644
--- a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.html
+++ b/src/app/pages/admin/admin.component.html
@@ -16,13 +16,11 @@
</div>
<div body>
-
<!-- ******************************** Salutations ******************************** -->
<app-expandable class="expandable-salutations">
<span header>{{ 'Salutations.Title' | translate }}</span>
<div class="salutations-grid-wrapper" body>
-
- <div class="details-wrapper" *ngIf="salutationsSandbox.displayForm" >
+ <div class="details-wrapper" *ngIf="salutationsSandbox.displayForm">
<app-salutations-details></app-salutations-details>
</div>
@@ -49,53 +47,48 @@
<app-spinner [isRunning]="salutationsSandbox.salutationsLoading$ | async"></app-spinner>
</div>
-
</div>
</app-expandable>
<!-- ******************************** Communications-Types ******************************** -->
- <app-expandable class="expandable-salutations">
- <span header>{{ 'CommunicationTypes.Title' | translate }}</span>
- <div class="salutations-grid-wrapper" body>
-
- <div *ngIf="communicationTypesSandbox.displayForm" class="details-wrapper">
- <app-communication-types-details></app-communication-types-details>
- </div>
-
- <div class="table-view">
- <div class="diverse-options">
- <div class="pull-right" *visibleByRight>
- <button class="btn btn-sm btn-primary" (click)="communicationTypesSandbox.setDisplayForm()">
- {{ 'Salutations.New' | translate }}
- </button>
- </div>
- </div>
-
- <ag-grid-angular
- class="ag-theme-balham"
- [domLayout]="'autoHeight'"
- [gridOptions]="communicationTypesGridOptions"
- [columnDefs]="communicationsTypeColDef"
- [rowSelection]="'single'"
- [frameworkComponents]="frameworkComponents"
- [rowData]="communicationTypesSandbox.communicationTypes$ | async"
- [overlayNoRowsTemplate]="noRowsTemplate"
- >
- </ag-grid-angular>
-
- <app-spinner [isRunning]="communicationTypesSandbox.communicationTypesLoading$ | async"></app-spinner>
- </div>
-
+ <app-expandable class="expandable-salutations">
+ <span header>{{ 'CommunicationTypes.Title' | translate }}</span>
+ <div class="salutations-grid-wrapper" body>
+ <div *ngIf="communicationTypesSandbox.displayForm" class="details-wrapper">
+ <app-communication-types-details></app-communication-types-details>
</div>
- </app-expandable>
+ <div class="table-view">
+ <div class="diverse-options">
+ <div class="pull-right" *visibleByRight>
+ <button class="btn btn-sm btn-primary" (click)="communicationTypesSandbox.setDisplayForm()">
+ {{ 'Salutations.New' | translate }}
+ </button>
+ </div>
+ </div>
+
+ <ag-grid-angular
+ class="ag-theme-balham"
+ [domLayout]="'autoHeight'"
+ [gridOptions]="communicationTypesGridOptions"
+ [columnDefs]="communicationsTypeColDef"
+ [rowSelection]="'single'"
+ [frameworkComponents]="frameworkComponents"
+ [rowData]="communicationTypesSandbox.communicationTypes$ | async"
+ [overlayNoRowsTemplate]="noRowsTemplate"
+ >
+ </ag-grid-angular>
+
+ <app-spinner [isRunning]="communicationTypesSandbox.communicationTypesLoading$ | async"></app-spinner>
+ </div>
+ </div>
+ </app-expandable>
<!-- ******************************** Person-Types ******************************** -->
<app-expandable class="expandable-salutations">
<span header>{{ 'PersonTypes.Title' | translate }}</span>
<div class="salutations-grid-wrapper" body>
-
- <div class="details-wrapper" *ngIf="personTypesSandbox.displayForm" >
+ <div class="details-wrapper" *ngIf="personTypesSandbox.displayForm">
<app-person-types-details></app-person-types-details>
</div>
@@ -122,7 +115,6 @@
<app-spinner [isRunning]="personTypesSandbox.personTypesLoading$ | async"></app-spinner>
</div>
-
</div>
</app-expandable>
@@ -130,8 +122,7 @@
<app-expandable class="expandable-salutations">
<span header>{{ 'AddressTypes.Title' | translate }}</span>
<div class="salutations-grid-wrapper" body>
-
- <div class="details-wrapper" *ngIf="addressTypesSandbox.displayForm" >
+ <div class="details-wrapper" *ngIf="addressTypesSandbox.displayForm">
<app-address-types-details></app-address-types-details>
</div>
@@ -156,19 +147,9 @@
>
</ag-grid-angular>
- <!-- <app-spinner [isRunning]="addressTypesSandbox.addressTypesLoading$ | async"></app-spinner> -->
+ <app-spinner [isRunning]="addressTypesSandbox.addressTypesLoading$ | async"></app-spinner>
</div>
-
</div>
</app-expandable>
-
-
-
-
-
-
-
</div>
-
-
</app-card-layout>
diff --git a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.scss b/src/app/pages/admin/admin.component.scss
similarity index 100%
rename from src/app/pages/admin/salutations/salutations-list/salutations-list.component.scss
rename to src/app/pages/admin/admin.component.scss
diff --git a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.spec.ts b/src/app/pages/admin/admin.component.spec.ts
similarity index 78%
rename from src/app/pages/admin/salutations/salutations-list/salutations-list.component.spec.ts
rename to src/app/pages/admin/admin.component.spec.ts
index 387ee6a..3af5162 100644
--- a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.spec.ts
+++ b/src/app/pages/admin/admin.component.spec.ts
@@ -1,4 +1,4 @@
- /********************************************************************************
+/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
@@ -11,22 +11,25 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { Salutation } from '@shared/models';
-import { SalutationsListComponent } from '@pages/admin/salutations/salutations-list//salutations-list.component';
+import { AdminComponent } from '@pages/admin/admin.component';
-describe('SalutationsListComponent', () => {
- let component: SalutationsListComponent;
+describe('AdminComponent', () => {
+ let component: AdminComponent;
let communicationTypesSandbox: any = {
setDisplayForm: () => {},
loadCommunicationType: () => {},
- deleteCommunicationType: () => {},};
+ deleteCommunicationType: () => {},
+ };
let personTypesSandbox: any = {
setDisplayForm: () => {},
loadPersonType: () => {},
- deletePersonType: () => {},};
+ deletePersonType: () => {},
+ };
let addressTypesSandbox: any = {
setDisplayForm: () => {},
loadAddressType: () => {},
- deleteAddressType: () => {},};
+ deleteAddressType: () => {},
+ };
const salutationsSandbox: any = {
setDisplayForm: () => {},
loadSalutation: () => {},
@@ -34,7 +37,7 @@
};
beforeEach(() => {
- component = new SalutationsListComponent(salutationsSandbox, communicationTypesSandbox, personTypesSandbox, addressTypesSandbox);
+ component = new AdminComponent(salutationsSandbox, communicationTypesSandbox, personTypesSandbox, addressTypesSandbox);
});
it('should create', () => {
@@ -51,7 +54,7 @@
const spy1: any = spyOn(salutationsSandbox, 'setDisplayForm');
const spy2: any = spyOn(salutationsSandbox, 'loadSalutation');
component.ngOnInit();
- component.salutationGridOptions.context.eventSubject.next({type: "edit", data: new Salutation()});
+ component.salutationGridOptions.context.eventSubject.next({ type: 'edit', data: new Salutation() });
expect(spy1).toHaveBeenCalled();
expect(spy2).toHaveBeenCalled();
});
@@ -59,7 +62,7 @@
it('should call appropriate functions for delete event', () => {
const spy3: any = spyOn(salutationsSandbox, 'deleteSalutation');
component.ngOnInit();
- component.salutationGridOptions.context.eventSubject.next({type: "delete", data: new Salutation()});
+ component.salutationGridOptions.context.eventSubject.next({ type: 'delete', data: new Salutation() });
expect(spy3).toHaveBeenCalled();
});
@@ -67,7 +70,7 @@
const spy1: any = spyOn(communicationTypesSandbox, 'setDisplayForm');
const spy2: any = spyOn(communicationTypesSandbox, 'loadCommunicationType');
component.ngOnInit();
- component.communicationTypesGridOptions.context.eventSubject.next({type: "edit", data: new Salutation()});
+ component.communicationTypesGridOptions.context.eventSubject.next({ type: 'edit', data: new Salutation() });
expect(spy1).toHaveBeenCalled();
expect(spy2).toHaveBeenCalled();
});
@@ -75,7 +78,7 @@
it('should call appropriate functions for delete event', () => {
const spy3: any = spyOn(communicationTypesSandbox, 'deleteCommunicationType');
component.ngOnInit();
- component.communicationTypesGridOptions.context.eventSubject.next({type: "delete", data: new Salutation()});
+ component.communicationTypesGridOptions.context.eventSubject.next({ type: 'delete', data: new Salutation() });
expect(spy3).toHaveBeenCalled();
});
@@ -83,7 +86,7 @@
const spy1: any = spyOn(personTypesSandbox, 'setDisplayForm');
const spy2: any = spyOn(personTypesSandbox, 'loadPersonType');
component.ngOnInit();
- component.personTypesGridOptions.context.eventSubject.next({type: "edit", data: new Salutation()});
+ component.personTypesGridOptions.context.eventSubject.next({ type: 'edit', data: new Salutation() });
expect(spy1).toHaveBeenCalled();
expect(spy2).toHaveBeenCalled();
});
@@ -91,7 +94,7 @@
it('should call appropriate functions for delete event', () => {
const spy3: any = spyOn(personTypesSandbox, 'deletePersonType');
component.ngOnInit();
- component.personTypesGridOptions.context.eventSubject.next({type: "delete", data: new Salutation()});
+ component.personTypesGridOptions.context.eventSubject.next({ type: 'delete', data: new Salutation() });
expect(spy3).toHaveBeenCalled();
});
@@ -99,7 +102,7 @@
const spy1: any = spyOn(addressTypesSandbox, 'setDisplayForm');
const spy2: any = spyOn(addressTypesSandbox, 'loadAddressType');
component.ngOnInit();
- component.addressTypesGridOptions.context.eventSubject.next({type: "edit", data: new Salutation()});
+ component.addressTypesGridOptions.context.eventSubject.next({ type: 'edit', data: new Salutation() });
expect(spy1).toHaveBeenCalled();
expect(spy2).toHaveBeenCalled();
});
@@ -107,8 +110,7 @@
it('should call appropriate functions for delete event', () => {
const spy3: any = spyOn(addressTypesSandbox, 'deleteAddressType');
component.ngOnInit();
- component.addressTypesGridOptions.context.eventSubject.next({type: "delete", data: new Salutation()});
+ component.addressTypesGridOptions.context.eventSubject.next({ type: 'delete', data: new Salutation() });
expect(spy3).toHaveBeenCalled();
});
-
});
diff --git a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.ts b/src/app/pages/admin/admin.component.ts
similarity index 84%
rename from src/app/pages/admin/salutations/salutations-list/salutations-list.component.ts
rename to src/app/pages/admin/admin.component.ts
index b54925d..04e6cfe 100644
--- a/src/app/pages/admin/salutations/salutations-list/salutations-list.component.ts
+++ b/src/app/pages/admin/admin.component.ts
@@ -11,23 +11,28 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { SalutationsSandbox } from '@pages/admin/salutations/salutations.sandbox';
-import { SALUTATIONS_COLDEF, COMMUNICATION_TYPES_COLDEF, PERSON_TYPES_COLDEF, ADDRESS_TYPES_COLDEF} from '@pages/admin/salutations/salutations-list/salutations-list-column-definition';
+import {
+ SALUTATIONS_COLDEF,
+ COMMUNICATION_TYPES_COLDEF,
+ PERSON_TYPES_COLDEF,
+ ADDRESS_TYPES_COLDEF,
+} from '@pages/admin/salutations/salutations-list/salutations-list-column-definition';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { BaseList } from '@shared/components/base-components/base.list';
import { SetFilterComponent } from '@shared/filters/ag-grid/set-filter/set-filter.component';
import { Subscription } from 'rxjs';
-import { CommunicationTypesSandbox } from '../../communication-types/communication-types.sandbox';
+import { CommunicationTypesSandbox } from './communication-types/communication-types.sandbox';
import { GridOptions } from 'ag-grid-community';
import { Subject } from 'rxjs';
-import { PersonTypesSandbox } from '../../person-types/person-types.sandbox';
-import { AddressTypesSandbox } from '../../address-types/address-types.sandbox';
+import { PersonTypesSandbox } from './person-types/person-types.sandbox';
+import { AddressTypesSandbox } from './address-types/address-types.sandbox';
@Component({
- selector: 'app-salutations-list',
- templateUrl: './salutations-list.component.html',
- styleUrls: ['./salutations-list.component.scss'],
+ selector: 'app-admin',
+ templateUrl: './admin.component.html',
+ styleUrls: ['./admin.component.scss'],
})
-export class SalutationsListComponent extends BaseList implements OnInit, OnDestroy {
+export class AdminComponent extends BaseList implements OnInit, OnDestroy {
public salutationsColDef: any = SALUTATIONS_COLDEF;
public communicationsTypeColDef: any = COMMUNICATION_TYPES_COLDEF;
public personTypeColDef: any = PERSON_TYPES_COLDEF;
@@ -36,7 +41,6 @@
private _subscription: Subscription;
public isExpandableVisible = false;
-
public salutationEvents$: Subject<any> = new Subject();
public salutationGridOptions: GridOptions = {
context: {
@@ -81,18 +85,17 @@
suppressLoadingOverlay: true,
};
-
-
- constructor(public salutationsSandbox: SalutationsSandbox,
- public communicationTypesSandbox: CommunicationTypesSandbox,
- public personTypesSandbox: PersonTypesSandbox,
- public addressTypesSandbox: AddressTypesSandbox) {
+ constructor(
+ public salutationsSandbox: SalutationsSandbox,
+ public communicationTypesSandbox: CommunicationTypesSandbox,
+ public personTypesSandbox: PersonTypesSandbox,
+ public addressTypesSandbox: AddressTypesSandbox
+ ) {
super();
this.frameworkComponents = { setFilterComponent: SetFilterComponent };
}
ngOnInit() {
-
/********************************* Salutations *********************************/
this.salutationGridOptions.context = {
...this.salutationGridOptions.context,
@@ -108,7 +111,6 @@
}
});
-
/********************************* Communication-Types *********************************/
this.communicationTypesGridOptions.context = {
...this.communicationTypesGridOptions.context,
@@ -153,20 +155,13 @@
this.addressTypesSandbox.deleteAddressType(event.data.id);
}
});
-
}
-
-
-
-
ngOnDestroy() {
this._subscription.unsubscribe();
}
-
private _initExpandableState() {
//this.isExpandableVisible = !!this.salutationsSandbox.companyContactId;
}
-
}
diff --git a/src/app/pages/admin/admin.module.ts b/src/app/pages/admin/admin.module.ts
index 5969079..492401e 100644
--- a/src/app/pages/admin/admin.module.ts
+++ b/src/app/pages/admin/admin.module.ts
@@ -13,11 +13,9 @@
import { CommunicationTypesApiClient } from '@pages/admin/communication-types/communication-types-api-client';
import { CommunicationTypesService } from '@pages/admin/communication-types/communication-types.service';
import { CommunicationTypesSandbox } from '@pages/admin/communication-types/communication-types.sandbox';
-import { CommunicationTypesResolver } from '@pages/admin/communication-types/communication-types.resolver';
import { CommunicationTypesEffects } from '@shared/store/effects/admin/communication-types.effect';
import { CommunicationTypesDetailsComponent } from '@pages/admin/communication-types/communication-types-details/communication-types-details.component';
import { SalutationsDetailsComponent } from '@pages/admin/salutations/salutations-details/salutations-details.component';
-import { SalutationsResolver } from '@pages/admin/salutations/salutations.resolver';
import { SalutationsSandbox } from '@pages/admin/salutations/salutations.sandbox';
import { SalutationsApiClient } from '@pages/admin/salutations/salutations-api-client';
import { SalutationsService } from '@pages/admin/salutations/salutations.service';
@@ -35,22 +33,18 @@
import { EffectsModule } from '@ngrx/effects';
import { AdminRoutingModule } from '@pages/admin/admin-routing.module';
-import { SalutationsListComponent } from '@pages/admin/salutations/salutations-list/salutations-list.component';
-import { CommunicationTypesListComponent } from '@pages/admin/communication-types/communication-types-list/communication-types-list.component';
-import { PersonTypesListComponent } from '@pages/admin/person-types/person-types-list/person-types-list.component';
import { PersonTypesSandbox } from '@pages/admin/person-types/person-types.sandbox';
import { PersonTypesApiClient } from '@pages/admin/person-types/person-types-api-client';
import { PersonTypesService } from '@pages/admin/person-types/person-types.service';
import { PersonTypesEffects } from '@shared/store/effects/admin/person-types.effect';
-import { PersonTypesResolver } from '@pages/admin/person-types/person-types.resolver';
import { PersonTypesDetailsComponent } from '@pages/admin/person-types/person-types-details/person-types-details.component';
-import { AddressTypesListComponent } from '@pages/admin/address-types/address-types-list/address-types-list.component';
import { AddressTypesDetailsComponent } from '@pages/admin/address-types/address-types-details/address-types-details.component';
import { AddressTypesSandbox } from '@pages/admin/address-types//address-types.sandbox';
import { AddressTypesEffects } from '@shared/store/effects/admin/address-types.effect';
import { AddressTypesApiClient } from '@pages/admin/address-types/address-types-api-client';
import { AddressTypesService } from '@pages/admin/address-types/address-types.service';
-import { AddressTypesResolver } from '@pages/admin/address-types/address-types.resolver';
+import { AdminResolver } from './admin.resolver';
+import { AdminComponent } from './admin.component';
@NgModule({
imports: [
@@ -67,33 +61,21 @@
AgGridModule.withComponents([]),
AdminRoutingModule,
],
- declarations: [
- SalutationsListComponent,
- SalutationsDetailsComponent,
- CommunicationTypesListComponent,
- CommunicationTypesDetailsComponent,
- PersonTypesListComponent,
- PersonTypesDetailsComponent,
- AddressTypesListComponent,
- AddressTypesDetailsComponent,
- ],
+ declarations: [SalutationsDetailsComponent, CommunicationTypesDetailsComponent, PersonTypesDetailsComponent, AddressTypesDetailsComponent, AdminComponent],
providers: [
SalutationsService,
SalutationsApiClient,
SalutationsSandbox,
- SalutationsResolver,
CommunicationTypesSandbox,
CommunicationTypesService,
CommunicationTypesApiClient,
- CommunicationTypesResolver,
PersonTypesSandbox,
PersonTypesService,
PersonTypesApiClient,
- PersonTypesResolver,
AddressTypesSandbox,
AddressTypesService,
AddressTypesApiClient,
- AddressTypesResolver,
+ AdminResolver,
],
})
export class AdminModule {}
diff --git a/src/app/pages/admin/salutations/salutations.resolver.spec.ts b/src/app/pages/admin/admin.resolver.spec.ts
similarity index 65%
rename from src/app/pages/admin/salutations/salutations.resolver.spec.ts
rename to src/app/pages/admin/admin.resolver.spec.ts
index 29e6a0e..a2323a9 100644
--- a/src/app/pages/admin/salutations/salutations.resolver.spec.ts
+++ b/src/app/pages/admin/admin.resolver.spec.ts
@@ -1,20 +1,23 @@
import { async } from '@angular/core/testing';
-import { SalutationsResolver } from '@pages/admin/salutations/salutations.resolver';
+import { AdminResolver } from '@pages/admin/admin.resolver';
-describe('SalutationsResolver', () => {
- let component: SalutationsResolver;
+describe('AdminResolver', () => {
+ let component: AdminResolver;
let communicationTypesSandbox: any = {
setDisplayForm: () => {},
loadCommunicationTypes: () => {},
- deleteCommunicationType: () => {},};
+ deleteCommunicationType: () => {},
+ };
let personTypesSandbox: any = {
setDisplayForm: () => {},
loadPersonTypes: () => {},
- deletePersonType: () => {},};
+ deletePersonType: () => {},
+ };
let addressTypesSandbox: any = {
setDisplayForm: () => {},
loadAddressTypes: () => {},
- deleteAddressType: () => {},};
+ deleteAddressType: () => {},
+ };
const salutationsSandbox: any = {
setDisplayForm: () => {},
loadSalutations: () => {},
@@ -22,7 +25,7 @@
};
beforeEach(() => {
- component = new SalutationsResolver(salutationsSandbox, communicationTypesSandbox, personTypesSandbox, addressTypesSandbox);
+ component = new AdminResolver(salutationsSandbox, communicationTypesSandbox, personTypesSandbox, addressTypesSandbox);
});
it('should create', () => {
@@ -34,5 +37,4 @@
component.resolve();
expect(spy).toHaveBeenCalled();
});
-
});
diff --git a/src/app/pages/admin/salutations/salutations.resolver.ts b/src/app/pages/admin/admin.resolver.ts
similarity index 68%
rename from src/app/pages/admin/salutations/salutations.resolver.ts
rename to src/app/pages/admin/admin.resolver.ts
index f2b1fc3..f9c62f1 100644
--- a/src/app/pages/admin/salutations/salutations.resolver.ts
+++ b/src/app/pages/admin/admin.resolver.ts
@@ -1,4 +1,4 @@
- /********************************************************************************
+/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
@@ -15,17 +15,18 @@
import { Injectable } from '@angular/core';
import { Resolve } from '@angular/router';
import { ILoadSalutationsSuccess } from '@shared/store/actions/admin/salutations.action';
-import { CommunicationTypesSandbox } from '../communication-types/communication-types.sandbox';
-import { PersonTypesSandbox } from '../person-types/person-types.sandbox';
-import { AddressTypesSandbox } from '../address-types/address-types.sandbox';
+import { CommunicationTypesSandbox } from './communication-types/communication-types.sandbox';
+import { PersonTypesSandbox } from './person-types/person-types.sandbox';
+import { AddressTypesSandbox } from './address-types/address-types.sandbox';
@Injectable()
-export class SalutationsResolver implements Resolve<ILoadSalutationsSuccess> {
-
- constructor(private salutationsSandbox: SalutationsSandbox,
+export class AdminResolver implements Resolve<ILoadSalutationsSuccess> {
+ constructor(
+ private salutationsSandbox: SalutationsSandbox,
private communicationTypesSandbox: CommunicationTypesSandbox,
private personTypesSandbox: PersonTypesSandbox,
- private addressTypesSandbox: AddressTypesSandbox) {}
+ private addressTypesSandbox: AddressTypesSandbox
+ ) {}
public resolve(): Observable<any> {
this.addressTypesSandbox.loadAddressTypes();
@@ -33,5 +34,4 @@
this.communicationTypesSandbox.loadCommunicationTypes();
return this.salutationsSandbox.loadSalutations();
}
-
}
diff --git a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.html b/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.html
deleted file mode 100644
index a2d20ec..0000000
--- a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!-- /********************************************************************************
-* Copyright (c) 2020 Contributors to the Eclipse Foundation
-*
-* See the NOTICE file(s) distributed with this work for additional
-* information regarding copyright ownership.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v. 2.0 which is available at
-* http://www.eclipse.org/legal/epl-2.0.
-*
-* SPDX-License-Identifier: EPL-2.0
-********************************************************************************/ -->
-<app-card-layout>
- <div header>
- <span>{{ 'CommunicationTypes.Title' | translate }}</span>
- <div class="pull-right" *visibleByRight>
- <button class="btn btn-primary new-button" (click)="communicationTypesSandbox.setDisplayForm()">
- {{ 'CommunicationTypes.New' | translate }}
- </button>
- </div>
- </div>
- <div class="communication-types-grid-wrapper" body>
- <ag-grid-angular
- autoResizeColumns
- class="ag-theme-balham ag-grid-height"
- [ngClass]="communicationTypesSandbox.displayForm ? 'ag-grid-height-edit' : 'ag-grid-height-list'"
- [gridOptions]="gridOptions"
- [columnDefs]="columnDefinition"
- [rowSelection]="'single'"
- [frameworkComponents]="frameworkComponents"
- [rowData]="communicationTypesSandbox.communicationTypes$ | async"
- [overlayNoRowsTemplate]="noRowsTemplate"
- >
- </ag-grid-angular>
-
- <app-spinner [isRunning]="communicationTypesSandbox.communicationTypesLoading$ | async"></app-spinner>
-
- <div *ngIf="communicationTypesSandbox.displayForm" class="communication-types-details">
- <app-communication-types-details></app-communication-types-details>
- </div>
- </div>
-</app-card-layout>
diff --git a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.scss b/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.scss
deleted file mode 100644
index ed1ca97..0000000
--- a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.scss
+++ /dev/null
@@ -1,31 +0,0 @@
- /********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
- .communication-types-grid-wrapper {
- position: relative;
-}
-
-.communication-types-details {
- margin-top: 20px;
-}
-
-.ag-grid-height-edit {
- height: calc(100vh - 450px);
-}
-
-.ag-grid-height-list {
- height: calc(100vh - 200px);
-}
-
-.new-button {
- margin-right: 20px;
-}
diff --git a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.spec.ts b/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.spec.ts
deleted file mode 100644
index 73402a1..0000000
--- a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.spec.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommunicationType } from '@shared/models';
-import { CommunicationTypesListComponent } from '@pages/admin/communication-types/communication-types-list/communication-types-list.component';
-
-describe('CommunicationTypesListComponent', () => {
- let component: CommunicationTypesListComponent;
- const sandbox: any = {
- setDisplayForm: () => {},
- loadCommunicationType: () => {},
- deleteCommunicationType: () => {},
- };
-
- beforeEach(() => {
- component = new CommunicationTypesListComponent(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should initialize gridOptions context', () => {
- component.ngOnInit();
- expect(component.gridOptions.context.icons.edit).toBeTruthy();
- expect(component.gridOptions.context.icons.delete).toBeTruthy();
- expect(component.gridOptions.context.icons.readonly).toBeTruthy();
- });
-
- it('should call appropriate functions for edit event', () => {
- const spy1: any = spyOn(sandbox, 'setDisplayForm');
- const spy2: any = spyOn(sandbox, 'loadCommunicationType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "edit", data: new CommunicationType()});
- expect(spy1).toHaveBeenCalled();
- expect(spy2).toHaveBeenCalled();
- });
-
- it('should call appropriate functions for delete event', () => {
- const spy3: any = spyOn(sandbox, 'deleteCommunicationType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "delete", data: new CommunicationType()});
- expect(spy3).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.ts b/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.ts
deleted file mode 100644
index 5610e4e..0000000
--- a/src/app/pages/admin/communication-types/communication-types-list/communication-types-list.component.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { CommunicationTypesSandbox } from '@pages/admin/communication-types/communication-types.sandbox';
-import { COMMUNICATION_TYPES_COLDEF } from '@pages/admin/communication-types/communication-types-list/communication-types-list-column-definition';
-import { Component, OnInit, OnDestroy } from '@angular/core';
-import { BaseList } from '@shared/components/base-components/base.list';
-import { SetFilterComponent } from '@shared/filters/ag-grid/set-filter/set-filter.component';
-import { Subscription } from 'rxjs';
-
-@Component({
- selector: 'app-communication-types-list',
- templateUrl: './communication-types-list.component.html',
- styleUrls: ['./communication-types-list.component.scss'],
-})
-export class CommunicationTypesListComponent extends BaseList implements OnInit, OnDestroy {
- public columnDefinition: any = COMMUNICATION_TYPES_COLDEF;
- public frameworkComponents: { setFilterComponent: any };
- private _subscription: Subscription;
-
- constructor(public communicationTypesSandbox: CommunicationTypesSandbox) {
- super();
- this.frameworkComponents = { setFilterComponent: SetFilterComponent };
- }
-
- ngOnInit() {
- this.gridOptions.context = {
- ...this.gridOptions.context,
- icons: { edit: true, readonly: true, delete: true },
- };
- this._subscription = this.gridOptions.context.eventSubject.subscribe(event => {
- if (event.type === 'edit' || event.type === 'readonly') {
- this.communicationTypesSandbox.setDisplayForm(event.type);
- this.communicationTypesSandbox.loadCommunicationType(event.data.id);
- }
- if (event.type === 'delete') {
- this.communicationTypesSandbox.deleteCommunicationType(event.data.id);
- }
- });
- }
-
- ngOnDestroy() {
- this._subscription.unsubscribe();
- }
-}
diff --git a/src/app/pages/admin/communication-types/communication-types.resolver.spec.ts b/src/app/pages/admin/communication-types/communication-types.resolver.spec.ts
deleted file mode 100644
index e7fef93..0000000
--- a/src/app/pages/admin/communication-types/communication-types.resolver.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { async } from '@angular/core/testing';
-import { CommunicationTypesResolver } from '@pages/admin/communication-types/communication-types.resolver';
-
-describe('CommunicationTypesResolver', () => {
- let component: CommunicationTypesResolver;
- let sandbox: any;
-
- beforeEach(async(() => {
- sandbox = {
- clear() {},
- loadCommunicationTypes() {},
- } as any;
- }));
-
- beforeEach(() => {
- component = new CommunicationTypesResolver(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should call loadCommunicationTypes', () => {
- const spy = spyOn(sandbox, 'loadCommunicationTypes');
- component.resolve();
- expect(spy).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/communication-types/communication-types.resolver.ts b/src/app/pages/admin/communication-types/communication-types.resolver.ts
deleted file mode 100644
index 1a5581a..0000000
--- a/src/app/pages/admin/communication-types/communication-types.resolver.ts
+++ /dev/null
@@ -1,27 +0,0 @@
- /********************************************************************************
- * Copyright (c) 2020 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- ********************************************************************************/
-import { CommunicationTypesSandbox } from '@pages/admin/communication-types/communication-types.sandbox';
-import { Observable } from 'rxjs';
-import { Injectable } from '@angular/core';
-import { Resolve } from '@angular/router';
-import { ILoadCommunicationTypesSuccess } from '@shared/store/actions/admin/communication-types.action';
-
-@Injectable()
-export class CommunicationTypesResolver implements Resolve<any> {
-
- constructor(private communicationTypesSandbox: CommunicationTypesSandbox) {}
-
- public resolve(): Observable<ILoadCommunicationTypesSuccess> {
- return this.communicationTypesSandbox.loadCommunicationTypes();
- }
-}
diff --git a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.html b/src/app/pages/admin/person-types/person-types-list/person-types-list.component.html
deleted file mode 100644
index b5991a2..0000000
--- a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!-- /********************************************************************************
-* Copyright (c) 2020 Contributors to the Eclipse Foundation
-*
-* See the NOTICE file(s) distributed with this work for additional
-* information regarding copyright ownership.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v. 2.0 which is available at
-* http://www.eclipse.org/legal/epl-2.0.
-*
-* SPDX-License-Identifier: EPL-2.0
-********************************************************************************/ -->
-<app-card-layout>
- <div header>
- <span>{{ 'PersonTypes.Title' | translate }}</span>
- <div class="pull-right" *visibleByRight>
- <button class="btn btn-primary new-button" (click)="sandbox.setDisplayForm()">
- {{ 'PersonTypes.New' | translate }}
- </button>
- </div>
- </div>
- <div class="person-types-grid-wrapper" body>
- <ag-grid-angular
- autoResizeColumns
- class="ag-theme-balham"
- [ngClass]="sandbox.displayForm ? 'ag-grid-height-edit' : 'ag-grid-height-list'"
- [gridOptions]="gridOptions"
- [columnDefs]="columnDefinition"
- [rowSelection]="'single'"
- [frameworkComponents]="frameworkComponents"
- [rowData]="sandbox.personTypes$ | async"
- [overlayNoRowsTemplate]="noRowsTemplate"
- >
- </ag-grid-angular>
-
- <app-spinner [isRunning]="sandbox.personTypesLoading$ | async"></app-spinner>
-
- <div *ngIf="sandbox.displayForm" class="person-types-details">
- <app-person-types-details></app-person-types-details>
- </div>
- </div>
-</app-card-layout>
diff --git a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.scss b/src/app/pages/admin/person-types/person-types-list/person-types-list.component.scss
deleted file mode 100644
index d08bd75..0000000
--- a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.scss
+++ /dev/null
@@ -1,19 +0,0 @@
-.person-types-grid-wrapper {
- position: relative;
-}
-
-.person-types-details {
- margin-top: 20px;
-}
-
-.ag-grid-height-edit {
- height: calc(100vh - 450px);
-}
-
-.ag-grid-height-list {
- height: calc(100vh - 200px);
-}
-
-.new-button {
- margin-right: 20px;
-}
diff --git a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.spec.ts b/src/app/pages/admin/person-types/person-types-list/person-types-list.component.spec.ts
deleted file mode 100644
index ae6cc76..0000000
--- a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.spec.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { PersonType } from '@shared/models';
-import { PersonTypesListComponent } from '@pages/admin/person-types/person-types-list/person-types-list.component';
-
-describe('PersonTypesListComponent', () => {
- let component: PersonTypesListComponent;
- const sandbox: any = {
- setDisplayForm: () => {},
- loadPersonType: () => {},
- deletePersonType: () => {},
- };
-
- beforeEach(() => {
- component = new PersonTypesListComponent(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should initialize gridOptions context', () => {
- component.ngOnInit();
- expect(component.gridOptions.context.icons.edit).toBeTruthy();
- expect(component.gridOptions.context.icons.delete).toBeTruthy();
- });
-
- it('should call appropriate functions for edit event', () => {
- const spy1: any = spyOn(sandbox, 'setDisplayForm');
- const spy2: any = spyOn(sandbox, 'loadPersonType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "edit", data: new PersonType()});
- expect(spy1).toHaveBeenCalled();
- expect(spy2).toHaveBeenCalled();
- });
-
- it('should call appropriate functions for delete event', () => {
- const spy3: any = spyOn(sandbox, 'deletePersonType');
- component.ngOnInit();
- component.gridOptions.context.eventSubject.next({type: "delete", data: new PersonType()});
- expect(spy3).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.ts b/src/app/pages/admin/person-types/person-types-list/person-types-list.component.ts
deleted file mode 100644
index 2c97f32..0000000
--- a/src/app/pages/admin/person-types/person-types-list/person-types-list.component.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { PERSON_TYPES_COLDEF } from '@pages/admin/person-types/person-types-list/person-types-list-column-definition';
-import { Component, OnInit, OnDestroy } from '@angular/core';
-import { BaseList } from '@shared/components/base-components/base.list';
-import { SetFilterComponent } from '@shared/filters/ag-grid/set-filter/set-filter.component';
-import { PersonTypesSandbox } from '@pages/admin/person-types/person-types.sandbox';
-import { Subscription } from 'rxjs';
-
-@Component({
- selector: 'app-person-types-list',
- templateUrl: './person-types-list.component.html',
- styleUrls: ['./person-types-list.component.scss'],
-})
-export class PersonTypesListComponent extends BaseList implements OnInit, OnDestroy {
- public columnDefinition: any = PERSON_TYPES_COLDEF;
- public frameworkComponents: { setFilterComponent: any };
- private _subscription: Subscription;
-
- constructor(public sandbox: PersonTypesSandbox) {
- super();
- this.frameworkComponents = { setFilterComponent: SetFilterComponent };
- }
-
- ngOnInit() {
- this.gridOptions.context = {
- ...this.gridOptions.context,
- icons: { edit: true, delete: true },
- };
- this._subscription = this.gridOptions.context.eventSubject.subscribe(event => {
- if (event.type === 'edit' || event.type === 'readonly') {
- this.sandbox.setDisplayForm();
- this.sandbox.loadPersonType(event.data.id);
- }
- if (event.type === 'delete') {
- this.sandbox.deletePersonType(event.data.id);
- }
- });
- }
-
- ngOnDestroy() {
- this._subscription.unsubscribe();
- }
-}
diff --git a/src/app/pages/admin/person-types/person-types.resolver.spec.ts b/src/app/pages/admin/person-types/person-types.resolver.spec.ts
deleted file mode 100644
index 4138387..0000000
--- a/src/app/pages/admin/person-types/person-types.resolver.spec.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { async } from '@angular/core/testing';
-import { PersonTypesResolver } from '@pages/admin/person-types/person-types.resolver';
-
-describe('PersonTypesResolver', () => {
- let component: PersonTypesResolver;
- let sandbox: any;
-
- beforeEach(async(() => {
- sandbox = {
- clear() {},
- loadPersonTypes() {},
- } as any;
- }));
-
- beforeEach(() => {
- component = new PersonTypesResolver(sandbox);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-
- it('should call loadPersonTypes', () => {
- const spy = spyOn(sandbox, 'loadPersonTypes');
- component.resolve();
- expect(spy).toHaveBeenCalled();
- });
-
-});
diff --git a/src/app/pages/admin/person-types/person-types.resolver.ts b/src/app/pages/admin/person-types/person-types.resolver.ts
deleted file mode 100644
index e68f6c9..0000000
--- a/src/app/pages/admin/person-types/person-types.resolver.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { PersonTypesSandbox } from '@pages/admin/person-types/person-types.sandbox';
-import { Observable } from 'rxjs';
-import { Injectable } from '@angular/core';
-import { Resolve } from '@angular/router';
-import { ILoadPersonTypesSuccess } from '@shared/store/actions/admin/person-types.action';
-
-@Injectable()
-export class PersonTypesResolver implements Resolve<any> {
-
- constructor(private sandbox: PersonTypesSandbox) {}
-
- public resolve(): Observable<ILoadPersonTypesSuccess> {
- return this.sandbox.loadPersonTypes();
- }
-}
diff --git a/src/app/pages/company/company-details/address-list/address-list.component.html b/src/app/pages/company/company-details/address-list/address-list.component.html
index 94b10ad..0d1e366 100644
--- a/src/app/pages/company/company-details/address-list/address-list.component.html
+++ b/src/app/pages/company/company-details/address-list/address-list.component.html
@@ -20,7 +20,7 @@
<ag-grid-angular
class="ag-theme-balham"
- style="width: 100%; height: 100%;"
+ style="width: 100%; height: 100%"
[domLayout]="'autoHeight'"
[gridOptions]="gridOptions"
[rowData]="companyDetailsSandBox.addressList$ | async"
diff --git a/src/app/shared/components/header/header.component.ts b/src/app/shared/components/header/header.component.ts
index 48dea88..726850e 100644
--- a/src/app/shared/components/header/header.component.ts
+++ b/src/app/shared/components/header/header.component.ts
@@ -37,7 +37,7 @@
}
public navigateToAdminPage(): void {
- this.router.navigate(['/admin/salutations']);
+ this.router.navigate(['/admin']);
}
private _winLocReload(): void {