SI-274 FE Link auf neue Seite erstellen SI-275 FE Neue Seite für Tabelle mit importierten Meldungen erstellen SI-276 FE Tabelle mit im portierten Meldungen in neuer Seite anzeigen Logout navigation andjusted Signed-off-by: Dimitrios Chalepakis <dimitrios.chalepakis@pta.de>
diff --git a/hooks/pre-build.js b/hooks/pre-build.js index 5ead1e1..52b813e 100644 --- a/hooks/pre-build.js +++ b/hooks/pre-build.js
@@ -13,7 +13,13 @@ var fs = require('fs-extra'); var jsonConcat = require('json-concat'); -var localizationSourceFilesDE = ['./i18n/general.de.json', './i18n/components.de.json', './i18n/logout.de.json', './i18n/grid-failure.de.json']; +var localizationSourceFilesDE = [ + './i18n/general.de.json', + './i18n/components.de.json', + './i18n/logout.de.json', + './i18n/grid-failure.de.json', + './i18n/imported-grid-failure.de.json', +]; function mergeAndSaveJsonFiles(src, dest) { jsonConcat({ src: src, dest: dest }, function(res) {
diff --git a/hooks/pre-start.js b/hooks/pre-start.js index b3d280a..bcb589c 100644 --- a/hooks/pre-start.js +++ b/hooks/pre-start.js
@@ -13,7 +13,13 @@ var fs = require('fs-extra'); var jsonConcat = require('json-concat'); -var localizationSourceFilesDE = ['./i18n/general.de.json', './i18n/components.de.json', './i18n/logout.de.json', './i18n/grid-failure.de.json']; +var localizationSourceFilesDE = [ + './i18n/general.de.json', + './i18n/components.de.json', + './i18n/logout.de.json', + './i18n/grid-failure.de.json', + './i18n/imported-grid-failure.de.json', +]; function mergeAndSaveJsonFiles(src, dest) { jsonConcat({ src: src, dest: dest }, function(res) {
diff --git a/i18n/imported-grid-failure.de.json b/i18n/imported-grid-failure.de.json new file mode 100644 index 0000000..b36b5a7 --- /dev/null +++ b/i18n/imported-grid-failure.de.json
@@ -0,0 +1,11 @@ +{ + "ImportedGridFailures": { + "Title": "Übersicht importierten Meldungen" + }, + "ImportedGridFailure": { + "Name": "Name", + "Description": "Beschreibung", + "Source": "Quelle", + "MessageContent": "Meldungsinhalt" + } +}
diff --git a/projects/grid-failure-information-app/src/app/app-routing.module.ts b/projects/grid-failure-information-app/src/app/app-routing.module.ts index b8d1ce6..2271841 100644 --- a/projects/grid-failure-information-app/src/app/app-routing.module.ts +++ b/projects/grid-failure-information-app/src/app/app-routing.module.ts
@@ -15,10 +15,15 @@ import { PageNotFoundComponent } from '@grid-failure-information-app/shared/components/page-not-found/pageNotFound.component'; import { LogoutPageComponent } from '@grid-failure-information-app/pages/logout/logout/logout.component'; import { LoggedOutPageComponent } from '@grid-failure-information-app/pages/logout/logged-out/logged-out.component'; +import { ImportedGridFailureListComponent } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component'; const appRoutes: Routes = [ { path: '', redirectTo: '/grid-failures', pathMatch: 'full' }, { + path: 'imported-grid-failures', + component: ImportedGridFailureListComponent, + }, + { path: 'logout', component: LogoutPageComponent, },
diff --git a/projects/grid-failure-information-app/src/app/app.module.ts b/projects/grid-failure-information-app/src/app/app.module.ts index 4eb7b68..25c1ec0 100644 --- a/projects/grid-failure-information-app/src/app/app.module.ts +++ b/projects/grid-failure-information-app/src/app/app.module.ts
@@ -28,6 +28,7 @@ //Feature Modules import { GridFailureModule } from '@grid-failure-information-app/pages/grid-failure/grid-failure.module'; import { LogoutModule } from '@grid-failure-information-app/pages/logout/logout.module'; +import { ImportedGridFailureModule } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure.module'; // Store import { reducers } from '@grid-failure-information-app/shared/store'; @@ -106,6 +107,7 @@ AppRoutingModule, NgbModalModule, LogoutModule, + ImportedGridFailureModule, ], providers: [ AdminGuard,
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-api-client.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-api-client.ts new file mode 100644 index 0000000..dd6d777 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-api-client.ts
@@ -0,0 +1,30 @@ +/******************************************************************************** + * 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 { Injectable } from '@angular/core'; +import { HttpService, GET, Adapter, DefaultHeaders } from '@grid-failure-information-app/shared/async-services/http'; +import { Observable } from 'rxjs'; +import { ImportData } from '@grid-failure-information-app/shared/models'; +import { ImportedGridFailureService } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure.service'; + +@Injectable() +@DefaultHeaders({ + Accept: 'application/json', + 'Content-Type': 'application/json', +}) +export class ImportedGridFailureApiClient extends HttpService { + @GET('/import-data') + @Adapter(ImportedGridFailureService.gridAdapter) + public getImportedGridFailures(): Observable<ImportData[]> { + return null; + } +}
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list-column-definition.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list-column-definition.ts new file mode 100644 index 0000000..5f224eb --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list-column-definition.ts
@@ -0,0 +1,38 @@ +/******************************************************************************** + * 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 + ********************************************************************************/ +export const IMPORTED_GRID_FAILURE_COLDEF = [ + { + field: 'name', + headerName: 'ImportedGridFailure.Name', + sortable: true, + filter: 'setFilterComponent', + }, + { + field: 'description', + headerName: 'ImportedGridFailure.Description', + sortable: true, + filter: 'setFilterComponent', + }, + { + field: 'source', + headerName: 'ImportedGridFailure.Source', + sortable: true, + filter: 'setFilterComponent', + }, + { + field: 'messageContent', + headerName: 'ImportedGridFailure.MessageContent', + sortable: true, + filter: 'setFilterComponent', + }, +];
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.html b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.html new file mode 100644 index 0000000..5d242ad --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.html
@@ -0,0 +1,39 @@ +<!-- /******************************************************************************** +* 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> + <div class="d-flex flex-row header"> + <span>{{ 'ImportedGridFailures.Title' | translate }}</span> + </div> + </div> + <div class="grid-failures-grid-wrapper" body> + <ag-grid-angular + autoResizeColumns + class="ag-theme-balham" + [gridOptions]="gridOptions" + [columnDefs]="columnDefinition" + [rowSelection]="'single'" + [frameworkComponents]="frameworkComponents" + [rowData]="sandbox.importedGridFailureList$ | async" + [overlayNoRowsTemplate]="noRowsTemplate" + > + </ag-grid-angular> + <div class="row justify-content-between"> + <div> + <button type="button" class="btn btn-primary cancel-button" id="cancel-btn" (click)="sandbox.cancel()"> + {{ 'CancelBtn' | translate }} + </button> + </div> + </div> + </div> +</app-card-layout>
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.scss b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.scss new file mode 100644 index 0000000..1363479 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.scss
@@ -0,0 +1,24 @@ +/******************************************************************************** + * 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 + ********************************************************************************/ +.grid-failures-grid-wrapper { + position: relative; + height: 100%; +} + +.header { + justify-content: space-between; +} + +#cancel-btn { + margin: 10px 0 0 16px; +}
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.spec.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.spec.ts new file mode 100644 index 0000000..a37d4f2 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.spec.ts
@@ -0,0 +1,34 @@ +/******************************************************************************** + * 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 { ImportedGridFailureListComponent } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component'; +import { ImportedGridFailureListSandbox } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox'; + +describe('ImportedGridFailureListComponent ', () => { + let component: ImportedGridFailureListComponent; + let sandbox: ImportedGridFailureListSandbox; + + beforeEach(() => { + sandbox = { loadImportedGridFailures() {} } as any; + component = new ImportedGridFailureListComponent(sandbox); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should call appropriate functions for edit event', () => { + const spy: any = spyOn(sandbox, 'loadImportedGridFailures'); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + }); +});
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.ts new file mode 100644 index 0000000..6083df7 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component.ts
@@ -0,0 +1,36 @@ +/******************************************************************************** + * 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 } from '@angular/core'; +import { IMPORTED_GRID_FAILURE_COLDEF } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list-column-definition'; +import { ImportedGridFailureListSandbox } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox'; +import { BaseList } from '@grid-failure-information-app/shared/components/base-components/base.list'; +import { SetFilterComponent } from '@grid-failure-information-app/shared/filters/ag-grid/set-filter/set-filter.component'; + +@Component({ + selector: 'app-imported-grid-failure-list', + templateUrl: './imported-grid-failure-list.component.html', + styleUrls: ['./imported-grid-failure-list.component.scss'], +}) +export class ImportedGridFailureListComponent extends BaseList implements OnInit { + public columnDefinition: any = IMPORTED_GRID_FAILURE_COLDEF; + public frameworkComponents: { setFilterComponent: any }; + + constructor(public sandbox: ImportedGridFailureListSandbox) { + super(); + this.frameworkComponents = { setFilterComponent: SetFilterComponent }; + } + + ngOnInit() { + this.sandbox.loadImportedGridFailures(); + } +}
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.spec.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.spec.ts new file mode 100644 index 0000000..30ef446 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.spec.ts
@@ -0,0 +1,50 @@ +/******************************************************************************** + * 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 { Router } from '@angular/router'; +import { ImportedGridFailureListSandbox } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox'; +import { State } from '@grid-failure-information-app/shared/store'; +import { Store } from '@ngrx/store'; +import { of } from 'rxjs'; +import { ImportData } from '@grid-failure-information-app/shared/models'; + +describe('ImportedGridFailureListSandbox', () => { + let service: ImportedGridFailureListSandbox; + let appState: Store<State>; + let router: Router; + let apiClient: any; + + beforeEach(() => { + appState = { dispatch: () => {}, pipe: () => of(true), select: () => of(true) } as any; + router = { navigateByUrl() {} } as any; + apiClient = { getImportedGridFailures() {} } as any; + + service = new ImportedGridFailureListSandbox(appState, router, apiClient); + }); + + it('should create ImportedMessagesListSandbox service', () => { + expect(service).toBeTruthy(); + }); + + it('should load imported grid failures after calling loadImportedGridFailures()', () => { + let spy = spyOn(apiClient, 'getImportedGridFailures').and.returnValue(of(new ImportData())); + service.loadImportedGridFailures(); + expect(service.importedGridFailureList$).toBeDefined(); + expect(spy).toHaveBeenCalled(); + }); + + it('should navigate to home after click cancel', () => { + let spy = spyOn(router, 'navigateByUrl'); + service.cancel(); + expect(spy).toHaveBeenCalledWith('/grid-failures'); + }); +});
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.ts new file mode 100644 index 0000000..4a22c2b --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox.ts
@@ -0,0 +1,38 @@ +/******************************************************************************** + * 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 { Injectable } from '@angular/core'; +import { Router } from '@angular/router'; +import { BaseSandbox } from '@grid-failure-information-app/shared/sandbox/base.sandbox'; +import * as store from '@grid-failure-information-app/shared/store'; +import { Store } from '@ngrx/store'; +import { Observable } from 'rxjs'; +import { ImportedGridFailureApiClient } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-api-client'; +import { navigateHome } from '@grid-failure-information-app/shared/utility'; +import { ImportData } from '@grid-failure-information-app/shared/models'; + +@Injectable() +export class ImportedGridFailureListSandbox extends BaseSandbox { + public importedGridFailureList$: Observable<ImportData[]> = new Observable<ImportData[]>(); + + constructor(protected appState$: Store<store.State>, private _router: Router, private _importedGridFailureApiClient: ImportedGridFailureApiClient) { + super(appState$); + } + + public loadImportedGridFailures(): void { + this.importedGridFailureList$ = this._importedGridFailureApiClient.getImportedGridFailures(); + } + + public cancel(): void { + navigateHome(this._router); + } +}
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.module.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.module.ts new file mode 100644 index 0000000..c270d25 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.module.ts
@@ -0,0 +1,42 @@ +/******************************************************************************** + * 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 { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterModule } from '@angular/router'; +import { ComponentsModule } from '@grid-failure-information-app/shared/components'; +import { TranslateModule } from '@ngx-translate/core'; +import { FormsModule } from '@angular/forms'; +import { DirectivesModule } from '@grid-failure-information-app/shared/directives'; +import { ContainersModule } from '@grid-failure-information-app/shared/containers'; +import { ImportedGridFailureListComponent } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.component'; +import { ImportedGridFailureListSandbox } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-list/imported-grid-failure-list.sandbox'; +import { ImportedGridFailureApiClient } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure-api-client'; +import { ImportedGridFailureService } from '@grid-failure-information-app/app/pages/imported-grid-failure/imported-grid-failure.service'; +import { AgGridModule } from 'ag-grid-angular'; +import { SetFilterComponent } from '@grid-failure-information-app/shared/filters/ag-grid/set-filter/set-filter.component'; + +@NgModule({ + imports: [ + CommonModule, + ComponentsModule, + TranslateModule, + DirectivesModule, + RouterModule, + FormsModule, + ContainersModule, + AgGridModule.withComponents([SetFilterComponent]), + ], + declarations: [ImportedGridFailureListComponent], + providers: [ImportedGridFailureListSandbox, ImportedGridFailureApiClient, ImportedGridFailureService], +}) +export class ImportedGridFailureModule {}
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.spec.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.spec.ts new file mode 100644 index 0000000..18ca728 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.spec.ts
@@ -0,0 +1,33 @@ +/******************************************************************************** + * 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 { ImportedGridFailureService } from './imported-grid-failure.service'; +import { ImportData } from '@grid-failure-information-app/shared/models'; + +describe(' ImportedGridFailureService', () => { + beforeEach(() => {}); + + it('should transform list', () => { + const response = [new ImportData()]; + response[0].id = 'X'; + + expect(ImportedGridFailureService.gridAdapter(response)[0].id).toBe('X'); + }); + + it('should transform details', () => { + const response: any = { id: 'X' }; + const item = ImportedGridFailureService.itemAdapter(response); + + expect(item.id).toBe(response.id); + }); +});
diff --git a/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.ts b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.ts new file mode 100644 index 0000000..976c67a --- /dev/null +++ b/projects/grid-failure-information-app/src/app/pages/imported-grid-failure/imported-grid-failure.service.ts
@@ -0,0 +1,25 @@ +/******************************************************************************** + * 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 { Injectable } from '@angular/core'; +import { ImportData } from '@grid-failure-information-app/shared/models'; + +@Injectable() +export class ImportedGridFailureService { + static gridAdapter(response: any): Array<ImportData> { + return response.map(responseItem => new ImportData(responseItem)); + } + + static itemAdapter(responseItem: any): ImportData { + return new ImportData(responseItem); + } +}
diff --git a/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.spec.ts b/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.spec.ts index dd956e2..5016ce8 100644 --- a/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.spec.ts +++ b/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.spec.ts
@@ -45,10 +45,10 @@ expect(spyNavigate).toHaveBeenCalledWith('/loggedout'); }); - it('should call naviagetByUrl with /overview', () => { + it('should call naviagetByUrl with /grid-failures', () => { const spy = spyOn(router, 'navigateByUrl'); component.goToOverview(); - expect(spy).toHaveBeenCalledWith('/overview'); + expect(spy).toHaveBeenCalledWith('/grid-failures'); }); });
diff --git a/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.ts index f9f2925..b792114 100644 --- a/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.ts +++ b/projects/grid-failure-information-app/src/app/pages/logout/logout/logout.sandbox.ts
@@ -18,10 +18,11 @@ import { ofType } from '@ngrx/effects'; import { takeUntil } from 'rxjs/operators'; import { Router } from '@angular/router'; +import { navigateHome } from '@grid-failure-information-app/shared/utility'; @Injectable() export class LogoutPageSandbox extends BaseSandbox { - constructor(protected appState$: Store<store.State>, protected actionsSubject: ActionsSubject, private router: Router) { + constructor(protected appState$: Store<store.State>, protected actionsSubject: ActionsSubject, private _router: Router) { super(appState$); } @@ -30,11 +31,11 @@ this.actionsSubject.pipe(ofType(logoutActions.logoutSuccess), takeUntil(this._endSubscriptions$)).subscribe(() => { this.clearStorage(); this.removeUser(); - this.router.navigateByUrl('/loggedout'); + this._router.navigateByUrl('/loggedout'); }); } public goToOverview(): void { - this.router.navigateByUrl('/overview'); + navigateHome(this._router); } }
diff --git a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.html b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.html index d54471e..b3c4687 100644 --- a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.html +++ b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.html
@@ -26,13 +26,16 @@ <fa name="question-circle"></fa> </a> <span class="divider"></span> + <a class="btn btn-link navbar-btn" (click)="navigateToImportedGridFailures()"> + <fa name="inbox"></fa> + </a> <div class="dropdown-open nav-user nav-overview-user"> <a class="btn btn-logout dropdown-toggle" style="min-width: 160px;" data-toggle="dropdown" href="#" aria-expanded="true"> {{ userName }} <span class="caret"></span> </a> <ul class="dropdown-menu"> - <li class="dropdown-item"><a routerLink="/logout" (click)="logout.emit()">Abmelden</a></li> + <li class="dropdown-item"><a (click)="navigateToLogout(); logout.emit()">Abmelden</a></li> </ul> </div> </div>
diff --git a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.spec.ts b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.spec.ts index baeb993..671e6c8 100644 --- a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.spec.ts +++ b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.spec.ts
@@ -31,4 +31,16 @@ component.navigateHome(); expect(spy).toHaveBeenCalledWith('/grid-failures'); }); + + it('should navigate to imported-grid-failures after call navigateToImportedGridFailures', () => { + const spy = spyOn(router, 'navigateByUrl').and.returnValue({ then: () => of(true) }); + component.navigateToImportedGridFailures(); + expect(spy).toHaveBeenCalledWith('/imported-grid-failures'); + }); + + it('should navigate to logout after call navigateToLogout', () => { + const spy = spyOn(router, 'navigateByUrl').and.returnValue({ then: () => of(true) }); + component.navigateToLogout(); + expect(spy).toHaveBeenCalledWith('/logout'); + }); });
diff --git a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.ts b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.ts index 9e5c6d1..652b897 100644 --- a/projects/grid-failure-information-app/src/app/shared/components/header/header.component.ts +++ b/projects/grid-failure-information-app/src/app/shared/components/header/header.component.ts
@@ -34,6 +34,14 @@ navigateHome(this.router).then(this._winLocReload); } + public navigateToImportedGridFailures(): void { + this.router.navigateByUrl(`/imported-grid-failures`); + } + + public navigateToLogout(): void { + this.router.navigateByUrl(`/logout`); + } + private _winLocReload(): void { window.location.reload(); }
diff --git a/projects/grid-failure-information-app/src/app/shared/containers/card-layout/card-layout.component.scss b/projects/grid-failure-information-app/src/app/shared/containers/card-layout/card-layout.component.scss index 2bebdd9..08aa06f 100644 --- a/projects/grid-failure-information-app/src/app/shared/containers/card-layout/card-layout.component.scss +++ b/projects/grid-failure-information-app/src/app/shared/containers/card-layout/card-layout.component.scss
@@ -1,4 +1,4 @@ - /******************************************************************************** +/******************************************************************************** * Copyright (c) 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional @@ -10,8 +10,8 @@ * * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ - .card { - height: calc(100vh - 144px); +.card { + height: calc(100vh - 142px); overflow: auto; border: none; }
diff --git a/projects/grid-failure-information-app/src/app/shared/models/import-data.model.ts b/projects/grid-failure-information-app/src/app/shared/models/import-data.model.ts new file mode 100644 index 0000000..4f37a76 --- /dev/null +++ b/projects/grid-failure-information-app/src/app/shared/models/import-data.model.ts
@@ -0,0 +1,26 @@ +/******************************************************************************** + * 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 + ********************************************************************************/ +export class ImportData { + public id: string = null; + public name: string = null; + public metaId: string = null; + public description: string = null; + public source: string = null; + public messageContent: string = null; + + public constructor(data: any = null) { + Object.keys(data || {}) + .filter(property => this.hasOwnProperty(property)) + .forEach(property => (this[property] = data[property])); + } +}
diff --git a/projects/grid-failure-information-app/src/app/shared/models/index.ts b/projects/grid-failure-information-app/src/app/shared/models/index.ts index 4a205e6..6a39e5c 100644 --- a/projects/grid-failure-information-app/src/app/shared/models/index.ts +++ b/projects/grid-failure-information-app/src/app/shared/models/index.ts
@@ -11,3 +11,4 @@ * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ export * from './grid-failure.model'; +export * from './import-data.model';