Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.frontend into SI-413-Sonstiges-Bugs
Signed-off-by: Dennis Schmitt <dennis.schmitt@pta.de>
diff --git a/i18n/grid-failure.de.json b/i18n/grid-failure.de.json
index 2fe6283..0256303 100644
--- a/i18n/grid-failure.de.json
+++ b/i18n/grid-failure.de.json
@@ -27,17 +27,15 @@
"InternExtern": "Meldung intern",
"InternalRemark": "Interne Bemerkungen",
"Postcode": "Postleitzahl",
- "PressureLevel": "Druckstufe",
+ "PressureLevel": "Druckstufe [ND, MD, HD]",
"ProbableReason": "Voraussichtlicher Grund",
"Radius": "Radius",
"Responsibility": "Zuständigkeit",
- "StationCoords": "Koordination",
- "StationDescription": "Beschreibung",
+ "StationDescription": "Bezeichnung",
"StatusExtern": "Status (extern)",
"StatusIntern": "Status (intern)",
"Street": "Straße (betroffene Straße)",
- "VoltageLevel": "Spannungsebene",
- "PublicationStatus": "Veröffentlichungsstatus"
+ "VoltageLevel": "Spannungsebene [NS, MS, HS]"
},
"GridFailureTemp": {
"FailureTypeId": "(TypId)",
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-api-client.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-api-client.ts
index 1b4d1a8..6b08d15 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-api-client.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-api-client.ts
@@ -14,15 +14,7 @@
import { HttpService, Query, GET, Path, Adapter, PUT, Body, DefaultHeaders } from '@grid-failure-information-app/shared/async-services/http';
import { Observable } from 'rxjs';
import { GridFailureService } from '@grid-failure-information-app/pages/grid-failure/grid-failure.service';
-import {
- GridFailure,
- FailureBranch,
- FailureClassification,
- FailureType,
- FailureState,
- FailurePublicationText,
- FailureRadius,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
import { POST } from '@grid-failure-information-app/shared/async-services/http';
@Injectable()
@@ -66,40 +58,4 @@
public getGridFailureVersion(@Path('id') id: string, @Path('versionNumber') versionNumber: number): Observable<GridFailure> {
return null;
}
-
- @GET('/branches')
- @Adapter(GridFailureService.branchListAdapter)
- public getGridFailureBranches(): Observable<FailureBranch[]> {
- return null;
- }
-
- @GET('/failure-classifications')
- @Adapter(GridFailureService.classificationListAdapter)
- public getGridFailureClassifications(): Observable<FailureClassification[]> {
- return null;
- }
-
- @GET('/failure-types')
- @Adapter(GridFailureService.typeListAdapter)
- public getGridFailureTypes(): Observable<FailureType[]> {
- return null;
- }
-
- @GET('/status')
- @Adapter(GridFailureService.stateListAdapter)
- public getGridFailureStates(): Observable<FailureState[]> {
- return null;
- }
-
- @GET('/radii')
- @Adapter(GridFailureService.radiusListAdapter)
- public getGridFailureRadii(): Observable<FailureRadius[]> {
- return null;
- }
-
- @GET('/publication-texts')
- @Adapter(GridFailureService.publicationTextListAdapter)
- public getGridFailurePublicationTexts(): Observable<FailurePublicationText[]> {
- return null;
- }
}
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html
index 762e0a5..770eb73 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.html
@@ -36,20 +36,50 @@
<app-expandable [showBodyInitially]="true">
<label header>{{ 'GridFailure.SubTitle1' | translate }}</label>
<div class="expandable-content" body>
+ <!-- failureClassificationId (temporär) -->
+ <div class="form-group row">
+ <label for="failureClassificationId" class="col-sm-2 col-form-label">{{ 'GridFailureTemp.FailureClassificationId' | translate }}</label>
+ <div class="col-sm-4">
+ <input
+ required
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="failureClassificationId"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureClassificationId']"
+ autocomplete="off"
+ />
+ </div>
+ </div>
+
<!-- failureClassification -->
<div class="form-group row">
<label for="failureClassification" class="col-sm-2 col-form-label">{{ 'GridFailure.FailureClassification' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
type="text"
+ maxlength="255"
class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureClassificationId']"
- >
- <option [value]="null" selected>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let classification of gridFailureDetailsSandbox.gridFailureClassifications$ | async" [value]="classification.id">{{
- classification.classification
- }}</option>
- </select>
+ id="failureClassification"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureClassification']"
+ autocomplete="off"
+ />
+ </div>
+ </div>
+
+ <!-- failureTypeId temporär -->
+ <div class="form-group row">
+ <label for="failureTypeId" class="col-sm-2 col-form-label">{{ 'GridFailureTemp.FailureTypeId' | translate }}</label>
+ <div class="col-sm-4">
+ <input
+ required
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="failureTypeId"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureTypeId']"
+ autocomplete="off"
+ />
</div>
</div>
@@ -57,14 +87,14 @@
<div class="form-group row">
<label for="failureType" class="col-sm-2 col-form-label">{{ 'GridFailure.FailureType' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
type="text"
+ maxlength="255"
class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureTypeId']"
- >
- <option [value]="null" selected>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let type of gridFailureDetailsSandbox.gridFailureTypes$ | async" [value]="type.id">{{ type.type }}</option>
- </select>
+ id="failureType"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureType']"
+ autocomplete="off"
+ />
</div>
</div>
@@ -87,15 +117,30 @@
<div class="form-group row">
<label for="internExtern" class="col-sm-2 col-form-label">{{ 'GridFailure.InternExtern' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
type="text"
+ maxlength="255"
class="form-control"
- id="publicationStatus"
+ id="internExtern"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['internExtern']"
- >
- <option [value]="null" selected>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let enum of gridFailureDetailsSandbox.internExternEnum | keyvalue" [value]="enum.key">{{ enum.value }}</option>
- </select>
+ autocomplete="off"
+ />
+ </div>
+ </div>
+
+ <!-- statusInternId (temporär) -->
+ <div class="form-group row">
+ <label for="statusInternId" class="col-sm-2 col-form-label">{{ 'GridFailureTemp.StatusInternId' | translate }}</label>
+ <div class="col-sm-4">
+ <input
+ required
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="statusInternId"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusInternId']"
+ autocomplete="off"
+ />
</div>
</div>
@@ -103,15 +148,30 @@
<div class="form-group row">
<label for="statusIntern" class="col-sm-2 col-form-label">{{ 'GridFailure.StatusIntern' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="statusIntern"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusIntern']"
+ autocomplete="off"
+ />
+ </div>
+ </div>
+
+ <!-- statusExternId (temporär) -->
+ <div class="form-group row">
+ <label for="statusExternId" class="col-sm-2 col-form-label">{{ 'GridFailureTemp.StatusExternId' | translate }}</label>
+ <div class="col-sm-4">
+ <input
required
type="text"
+ maxlength="255"
class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusInternId']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let state of gridFailureDetailsSandbox.gridFailureInternalStates$ | async" [value]="state.id">{{ state.status }}</option>
- </select>
+ id="statusExternId"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusExternId']"
+ autocomplete="off"
+ />
</div>
</div>
@@ -119,31 +179,14 @@
<div class="form-group row">
<label for="statusExtern" class="col-sm-2 col-form-label">{{ 'GridFailure.StatusExtern' | translate }}</label>
<div class="col-sm-4">
- <select
- required
+ <input
type="text"
+ maxlength="255"
class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusExternId']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let state of gridFailureDetailsSandbox.gridFailureExternalStates$ | async" [value]="state.id">{{ state.status }}</option>
- </select>
- </div>
- </div>
-
- <!-- publicationStatus -->
- <div class="form-group row">
- <label for="publicationStatus" class="col-sm-2 col-form-label">{{ 'GridFailure.PublicationStatus' | translate }}</label>
- <div class="col-sm-4">
- <select
- type="text"
- class="form-control"
- id="publicationStatus"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['publicationStatus']"
- >
- <option [value]="null" selected>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let enum of gridFailureDetailsSandbox.publicationStatusEnum | keyvalue" [value]="enum.key">{{ enum.value }}</option>
- </select>
+ id="statusExtern"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['statusExtern']"
+ autocomplete="off"
+ />
</div>
</div>
</div>
@@ -152,19 +195,35 @@
<app-expandable [showBodyInitially]="true">
<label header>{{ 'GridFailure.SubTitle2' | translate }}</label>
<div class="expandable-content" body>
+ <!-- branchId temporär -->
+ <div class="form-group row">
+ <label for="branchId" class="col-sm-2 col-form-label">{{ 'GridFailureTemp.BranchId' | translate }}</label>
+ <div class="col-sm-4">
+ <input
+ required
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="branchId"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['branchId']"
+ autocomplete="off"
+ />
+ </div>
+ </div>
+
<!-- branch -->
<div class="form-group row">
<label for="branch" class="col-sm-2 col-form-label">{{ 'GridFailure.Branch' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
required
type="text"
+ maxlength="255"
class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['branchId']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let branch of gridFailureDetailsSandbox.gridFailureBranches$ | async" [value]="branch.id">{{ branch.name }}</option>
- </select>
+ id="branch"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['branch']"
+ autocomplete="off"
+ />
</div>
</div>
@@ -172,16 +231,15 @@
<div class="form-group row">
<label for="voltageLevel" class="col-sm-2 col-form-label">{{ 'GridFailure.VoltageLevel' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
required
type="text"
+ maxlength="255"
class="form-control"
id="voltageLevel"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['voltageLevel']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let enum of gridFailureDetailsSandbox.voltageLevelEnum | keyvalue" [value]="enum.key">{{ enum.value }}</option>
- </select>
+ autocomplete="off"
+ />
</div>
</div>
@@ -189,18 +247,16 @@
<div class="form-group row">
<label for="pressureLevel" class="col-sm-2 col-form-label">{{ 'GridFailure.PressureLevel' | translate }}</label>
<div class="col-sm-4">
- <select
+ <input
type="text"
+ maxlength="255"
class="form-control"
id="pressureLevel"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['pressureLevel']"
- >
- <option [value]="null" selected>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let enum of gridFailureDetailsSandbox.pressureLevelEnum | keyvalue" [value]="enum.key">{{ enum.value }}</option>
- </select>
+ autocomplete="off"
+ />
</div>
</div>
-
<!-- failureBegin -->
<div class="form-group row">
<label for="failureBegin" class="col-sm-2 col-form-label">{{ 'GridFailure.FailureBegin' | translate }}</label>
@@ -209,8 +265,6 @@
<app-date-time-picker
(dateTimeChange)="setGridFailureDateTime($event, 'failureBegin')"
[dateString]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureBegin']?.value"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
></app-date-time-picker>
</div>
@@ -222,7 +276,6 @@
id="failureBegin"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureBegin']"
[ngrxValueConverter]="gridFailureDetailsSandbox.dateTimeValueConverter"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
readonly
/>
<div class="input-group-append">
@@ -230,8 +283,6 @@
class="btn btn-outline-primary calendar"
(click)="resetGridFailureDateTime(gridFailureDetailsSandbox.datePickerResetEnum.FailureBegin)"
type="button"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
>
<em class="fa fa-times-circle" aria-hidden="true"></em>
</button>
@@ -247,8 +298,6 @@
<app-date-time-picker
(dateTimeChange)="setGridFailureDateTime($event, 'failureEndPlanned')"
[dateString]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureEndPlanned']?.value"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
></app-date-time-picker>
</div>
@@ -259,7 +308,6 @@
id="failureEndPlanned"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureEndPlanned']"
[ngrxValueConverter]="gridFailureDetailsSandbox.dateTimeValueConverter"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
readonly
/>
<div class="input-group-append">
@@ -267,8 +315,6 @@
class="btn btn-outline-primary calendar"
(click)="resetGridFailureDateTime(gridFailureDetailsSandbox.datePickerResetEnum.FailureEndPlanned)"
type="button"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
>
<em class="fa fa-times-circle" aria-hidden="true"></em>
</button>
@@ -283,8 +329,6 @@
<app-date-time-picker
(dateTimeChange)="setGridFailureDateTime($event, 'failureEndResupplied')"
[dateString]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureEndResupplied']?.value"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
></app-date-time-picker>
<input
class="form-control editable"
@@ -293,7 +337,6 @@
id="failureEndResupplied"
[ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['failureEndResupplied']"
[ngrxValueConverter]="gridFailureDetailsSandbox.dateTimeValueConverter"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
readonly
/>
<div class="input-group-append">
@@ -301,8 +344,6 @@
class="btn btn-outline-primary calendar"
(click)="resetGridFailureDateTime(gridFailureDetailsSandbox.datePickerResetEnum.FailureEndResupplied)"
type="button"
- [disabled]="!gridFailureDetailsSandbox.saveEnabled"
- [class.isDisabled]="!gridFailureDetailsSandbox.saveEnabled"
>
<em class="fa fa-times-circle" aria-hidden="true"></em>
</button>
@@ -314,24 +355,13 @@
<div class="form-group row">
<label for="probableReason" class="col-sm-2 col-form-label">{{ 'GridFailure.ProbableReason' | translate }}</label>
<div class="col-sm-4">
- <select
- required
- type="text"
- class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['publicationTextId']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.gridFailurePublicationTexts$ | async" [value]="item.id">{{ item.text }}</option>
- </select>
- </div>
- <!-- freetext feld (planned) -->
- <div class="col-sm-4" *ngIf="false">
<input
+ required
type="text"
maxlength="255"
class="form-control"
- id="publicationFreetext"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['publicationFreetext']"
+ id="probableReason"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['probableReason']"
autocomplete="off"
/>
</div>
@@ -455,37 +485,21 @@
</div>
</div>
- <!-- stationCoords -->
+ <!-- radius -->
<div class="form-group row">
- <label for="stationCoords" class="col-sm-2 col-form-label">{{ 'GridFailure.StationCoords' | translate }}</label>
+ <label for="radius" class="col-sm-2 col-form-label">{{ 'GridFailure.Radius' | translate }}</label>
<div class="col-sm-4">
<input
required
type="text"
maxlength="255"
class="form-control"
- id="stationCoords"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['stationCoords']"
+ id="radius"
+ [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['radius']"
autocomplete="off"
/>
</div>
</div>
-
- <!-- radius -->
- <div class="form-group row">
- <label for="radius" class="col-sm-2 col-form-label">{{ 'GridFailure.Radius' | translate }}</label>
- <div class="col-sm-4">
- <select
- required
- type="text"
- class="form-control"
- [ngrxFormControlState]="((gridFailureDetailsSandbox.gridFailureDetailsFormState$ | async)?.controls)['radiusId']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.gridFailureRadii$ | async" [value]="item.id">{{ item.radius }}</option>
- </select>
- </div>
- </div>
</div>
</app-expandable>
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss
index 79a3544..bea6bf8 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.scss
@@ -14,6 +14,7 @@
margin: 8px 0px 16px 0px;
font-weight: bold;
}
+
.grid-failure-grid-wrapper {
margin: 10px;
}
@@ -48,15 +49,15 @@
.editable {
background-color: white;
}
+
.version-select {
margin: 8px;
}
+
.isDisabled {
background-color: rgb(233, 236, 239);
}
-#internExtern {
- margin-left: 0px;
-}
+
.expandable-content {
padding: 20px 0px 20px 35px;
}
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
index a57bbe3..8833305 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.spec.ts
@@ -31,7 +31,7 @@
beforeEach(() => {
appState = { dispatch: () => {}, pipe: () => of(true), select: () => of(true) } as any;
- actionSubject = { pipe: () => of(true), map: () => ({}) } as any;
+ actionSubject = { pipe: () => of(true) } as any;
utilService = { displayNotification() {} } as any;
router = { navigateByUrl() {} } as any;
modalService = { open() {} } as any;
@@ -49,36 +49,6 @@
expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureDetail({ payload: 'id' }));
});
- it('should dispatch loadGridFailureBranches Action via loadGridFailureBranches()', () => {
- service.loadGridFailureBranches();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureBranches());
- });
-
- it('should dispatch loadGridFailureClassifications Action via loadGridFailureClassifications()', () => {
- service.loadGridFailureClassifications();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureClassifications());
- });
-
- it('should dispatch loadGridFailureTypes Action via loadGridFailureTypes()', () => {
- service.loadGridFailureTypes();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureTypes());
- });
-
- it('should dispatch loadGridFailureStates Action via loadGridFailureStates()', () => {
- service.loadGridFailureStates();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureStates());
- });
-
- it('should dispatch loadGridFailureRadii Action via loadGridFailureRadii()', () => {
- service.loadGridFailureRadii();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureRadii());
- });
-
- it('should dispatch loadGridFailurePublicationTexts Action via loadGridFailurePublicationTexts()', () => {
- service.loadGridFailurePublicationTexts();
- expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailurePublicationTexts());
- });
-
it('should dispatch loadGridFailureVersions Action via loadGridFailureVersions(id)', () => {
service.loadGridFailureVersions('id');
expect(appState.dispatch).toHaveBeenCalledWith(gridFailureActions.loadGridFailureVersions({ payload: 'id' }));
@@ -180,18 +150,4 @@
service.saveGridFailure();
expect(spy1).toHaveBeenCalled();
});
-
- it('should register events', () => {
- let gridFailureDetailsFormResponse: any = {
- value: {
- failureBegin: 'test1',
- failureEndPlanned: 'test2',
- failureEndResupplied: 'test3',
- },
- };
- service.gridFailureDetailsFormState$ = of(gridFailureDetailsFormResponse);
- spyOn(actionSubject, 'pipe').and.returnValue(of({}));
- service.registerEvents();
- expect(service.currentFormState).toBeDefined;
- });
});
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
index 1a22b17..1881e58 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.sandbox.ts
@@ -10,63 +10,34 @@
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
-import { Injectable } from '@angular/core';
-import { Router } from '@angular/router';
-import { SafetyQueryDialogComponent } from '@grid-failure-information-app/shared/components/dialogs/safety-query-dialog/safety-query-dialog.component';
-import {
- DatePickerResetEnum,
- PressureLevelEnum,
- PublicationStatusEnum,
- VoltageLevelEnum,
- InternExternEnum,
-} from '@grid-failure-information-app/shared/constants/enums';
-import {
- FailureClassification,
- GridFailure,
- FailureType,
- FailureBranch,
- FailureState,
- FailureRadius,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
import { BaseFormSandbox } from '@grid-failure-information-app/shared/sandbox/base-form.sandbox';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
+import { Injectable } from '@angular/core';
+import { Store, ActionsSubject } from '@ngrx/store';
+import { FormGroupState, NgrxValueConverter, SetValueAction, ResetAction, MarkAsTouchedAction, DisableAction, EnableAction } from 'ngrx-forms';
import * as store from '@grid-failure-information-app/shared/store';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import * as fromGridFailuresDetailFormReducer from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer';
import * as gridFailuresDetailFormReducer from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer';
-import { dateTimeValueConverter, navigateHome } from '@grid-failure-information-app/shared/utility';
-import { UtilService } from '@grid-failure-information-app/shared/utility/utility.service';
-import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
-import { ofType } from '@ngrx/effects';
-import { ActionsSubject, Store } from '@ngrx/store';
-import { Moment } from 'moment';
-import { DisableAction, EnableAction, FormGroupState, NgrxValueConverter, ResetAction, SetValueAction } from 'ngrx-forms';
import { Observable } from 'rxjs';
-import { take, takeUntil, map } from 'rxjs/operators';
+import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
+import { takeUntil, take } from 'rxjs/operators';
+import { ofType } from '@ngrx/effects';
+import { Router } from '@angular/router';
+import { dateTimeValueConverter } from '@grid-failure-information-app/shared/utility';
+import { Moment } from 'moment';
+import { UtilService } from '@grid-failure-information-app/shared/utility/utility.service';
+import * as fromGridFailuresDetailFormReducer from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { SafetyQueryDialogComponent } from '@grid-failure-information-app/shared/components/dialogs/safety-query-dialog/safety-query-dialog.component';
+import { navigateHome } from '@grid-failure-information-app/shared/utility';
+import { DatePickerResetEnum } from '@grid-failure-information-app/shared/constants/enums';
@Injectable()
export class GridFailureDetailsSandbox extends BaseFormSandbox<GridFailure> {
public gridFailureDetailsFormState$: Observable<FormGroupState<GridFailure>> = this.appState$.select(store.getGridFailuresDetails);
public currentFormState: FormGroupState<GridFailure>;
- public gridFailureClassifications$: Observable<FailureClassification[]> = this.appState$.select(store.getGridFailureClassificationsData);
- public gridFailureTypes$: Observable<FailureType[]> = this.appState$.select(store.getGridFailureTypesData);
- public gridFailureBranches$: Observable<FailureBranch[]> = this.appState$.select(store.getGridFailureBranchesData);
- public gridFailureInternalStates$: Observable<FailureState[]> = this.appState$
- .select(store.getGridFailureStatesData)
- .pipe(map(states => states.filter(item => item.internal)));
- public gridFailureExternalStates$: Observable<FailureState[]> = this.appState$
- .select(store.getGridFailureStatesData)
- .pipe(map(states => states.filter(item => item.external)));
- public gridFailureRadii$: Observable<FailureRadius[]> = this.appState$.select(store.getGridFailureRadiiData);
- public gridFailurePublicationTexts$: Observable<FailurePublicationText[]> = this.appState$.select(store.getGridFailurePublicationTextsData);
public datePickerResetEnum = DatePickerResetEnum;
- public voltageLevelEnum = VoltageLevelEnum;
- public pressureLevelEnum = PressureLevelEnum;
- public publicationStatusEnum = PublicationStatusEnum;
- public internExternEnum = InternExternEnum;
public saveEnabled: boolean = true;
public maxVersionNumber: number;
-
private _gridFailureId: string;
constructor(
@@ -85,30 +56,6 @@
this.appState$.dispatch(gridFailureActions.loadGridFailureDetail({ payload: gridFailureId }));
}
- public loadGridFailureBranches(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailureBranches());
- }
-
- public loadGridFailureClassifications(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailureClassifications());
- }
-
- public loadGridFailureTypes(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailureTypes());
- }
-
- public loadGridFailureStates(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailureStates());
- }
-
- public loadGridFailureRadii(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailureRadii());
- }
-
- public loadGridFailurePublicationTexts(): void {
- this.appState$.dispatch(gridFailureActions.loadGridFailurePublicationTexts());
- }
-
public loadGridFailureVersions(gridFailureId: string): void {
this._gridFailureId = gridFailureId;
this.appState$.dispatch(gridFailureActions.loadGridFailureVersions({ payload: gridFailureId }));
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list-column-definition.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list-column-definition.ts
index 49c6654..a0c7c26 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list-column-definition.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list-column-definition.ts
@@ -140,7 +140,7 @@
},
},
{
- field: 'publicationText',
+ field: 'probableReason',
headerName: 'GridFailure.ProbableReason',
sortable: true,
filter: 'setFilterComponent',
@@ -188,12 +188,6 @@
filter: 'setFilterComponent',
},
{
- field: 'stationCoords',
- headerName: 'GridFailure.StationCoords',
- sortable: true,
- filter: 'setFilterComponent',
- },
- {
field: 'radius',
headerName: 'GridFailure.Radius',
sortable: true,
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.spec.ts
index 44520d9..7d8e08d 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.spec.ts
@@ -25,12 +25,6 @@
detailSandbox = {
loadGridFailure() {},
loadGridFailureVersions() {},
- loadGridFailureBranches() {},
- loadGridFailureClassifications() {},
- loadGridFailureTypes() {},
- loadGridFailureStates() {},
- loadGridFailureRadii() {},
- loadGridFailurePublicationTexts() {},
} as any;
});
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.ts
index cb9acee..785d723 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.resolver.ts
@@ -29,11 +29,5 @@
// laden der history
this._detailSandbox.loadGridFailureVersions(gridFailureId);
}
- this._detailSandbox.loadGridFailureBranches();
- this._detailSandbox.loadGridFailureClassifications();
- this._detailSandbox.loadGridFailureTypes();
- this._detailSandbox.loadGridFailureStates();
- this._detailSandbox.loadGridFailureRadii();
- this._detailSandbox.loadGridFailurePublicationTexts();
}
}
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.spec.ts
index 282ddb1..69fe92e 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.spec.ts
@@ -10,15 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
-import {
- GridFailure,
- FailureBranch,
- FailureClassification,
- FailureType,
- FailureState,
- FailureRadius,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
import { GridFailureService } from '@grid-failure-information-app/pages/grid-failure/grid-failure.service';
describe(' GridFailureService', () => {
@@ -37,46 +29,4 @@
expect(item.id).toBe(response.id);
});
-
- it('should transform branches api response', () => {
- const response = [new FailureBranch()];
- response[0].id = 'X';
-
- expect(GridFailureService.branchListAdapter(response)[0].id).toBe('X');
- });
-
- it('should transform classifications api response', () => {
- const response = [new FailureClassification()];
- response[0].id = 'X';
-
- expect(GridFailureService.classificationListAdapter(response)[0].id).toBe('X');
- });
-
- it('should transform types api response', () => {
- const response = [new FailureType()];
- response[0].id = 'X';
-
- expect(GridFailureService.typeListAdapter(response)[0].id).toBe('X');
- });
-
- it('should transform states api response', () => {
- const response = [new FailureState()];
- response[0].id = 'X';
-
- expect(GridFailureService.stateListAdapter(response)[0].id).toBe('X');
- });
-
- it('should transform radii api response', () => {
- const response = [new FailureRadius()];
- response[0].id = 'X';
-
- expect(GridFailureService.radiusListAdapter(response)[0].id).toBe('X');
- });
-
- it('should transform publication texts api response', () => {
- const response = [new FailurePublicationText()];
- response[0].id = 'X';
-
- expect(GridFailureService.publicationTextListAdapter(response)[0].id).toBe('X');
- });
});
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.ts
index 3224ead..bf52b1d 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure.service.ts
@@ -11,15 +11,7 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { Injectable } from '@angular/core';
-import {
- GridFailure,
- FailureBranch,
- FailureClassification,
- FailureType,
- FailureState,
- FailureRadius,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
@Injectable()
export class GridFailureService {
@@ -30,28 +22,4 @@
static itemAdapter(responseItem: any): GridFailure {
return new GridFailure(responseItem);
}
-
- static branchListAdapter(response: any): Array<FailureBranch> {
- return response.map(responseItem => new FailureBranch(responseItem));
- }
-
- static classificationListAdapter(response: any): Array<FailureClassification> {
- return response.map(responseItem => new FailureClassification(responseItem));
- }
-
- static typeListAdapter(response: any): Array<FailureType> {
- return response.map(responseItem => new FailureType(responseItem));
- }
-
- static stateListAdapter(response: any): Array<FailureState> {
- return response.map(responseItem => new FailureState(responseItem));
- }
-
- static radiusListAdapter(response: any): Array<FailureRadius> {
- return response.map(responseItem => new FailureRadius(responseItem));
- }
-
- static publicationTextListAdapter(response: any): Array<FailurePublicationText> {
- return response.map(responseItem => new FailurePublicationText(responseItem));
- }
}
diff --git a/projects/grid-failure-information-app/src/app/shared/constants/enums.ts b/projects/grid-failure-information-app/src/app/shared/constants/enums.ts
index f2cdfda..00fd65b 100644
--- a/projects/grid-failure-information-app/src/app/shared/constants/enums.ts
+++ b/projects/grid-failure-information-app/src/app/shared/constants/enums.ts
@@ -15,21 +15,3 @@
FailureEndPlanned = 'failureEndPlanned',
FailureEndResupplied = 'failureEndResupplied',
}
-export enum VoltageLevelEnum {
- NS = 'Niederspannung',
- MS = 'Mittelspannung',
- HS = 'Hochspannung',
-}
-export enum PressureLevelEnum {
- ND = 'Niederdruck',
- MD = 'Mitteldruck',
- HD = 'Hochdruck',
-}
-export enum PublicationStatusEnum {
- NV = 'nicht veröffentlicht',
- VE = 'veröffentlicht',
-}
-export enum InternExternEnum {
- I = 'Intern',
- E = 'Extern',
-}
diff --git a/projects/grid-failure-information-app/src/app/shared/containers/layout/layout.container.spec.ts b/projects/grid-failure-information-app/src/app/shared/containers/layout/layout.container.spec.ts
new file mode 100644
index 0000000..a70ff84
--- /dev/null
+++ b/projects/grid-failure-information-app/src/app/shared/containers/layout/layout.container.spec.ts
@@ -0,0 +1,47 @@
+/********************************************************************************
+ * 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 { LayoutSandbox } from '@grid-failure-information-app/shared/containers/layout/layout.sandbox';
+import * as store from '@grid-failure-information-app/shared/store';
+import { Store } from '@ngrx/store';
+import { of, Subscription } from 'rxjs';
+import { LayoutContainerComponent } from './layout.container';
+
+describe('LayoutContainer', () => {
+ let component: LayoutContainerComponent = {} as any;
+ let sandbox: LayoutSandbox;
+ let _configService: any;
+ let appState$: Store<store.State>;
+
+ beforeEach(() => {
+ appState$ = { dispatch: () => {}, pipe: () => of(true), select: () => of(true) } as any;
+ _configService = { get: () => ({ userImageFolder: 'path' }) } as any;
+
+ component = new LayoutContainerComponent(_configService, appState$, sandbox);
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should call ngOnInit', () => {
+ const spy1 = spyOn(component as any, 'registerEvents');
+ component.ngOnInit();
+ expect(spy1).toHaveBeenCalled();
+ });
+ it('should call ngOnDestroy', () => {
+ (component as any).subscriptions = [new Subscription()];
+ const spy1 = spyOn((component as any).subscriptions[0], 'unsubscribe');
+ component.ngOnDestroy();
+ expect(spy1).toHaveBeenCalled();
+ });
+});
diff --git a/projects/grid-failure-information-app/src/app/shared/directives/agGrid/auto-resize-columns.directive.spec.ts b/projects/grid-failure-information-app/src/app/shared/directives/agGrid/auto-resize-columns.directive.spec.ts
index 86052e6..e6c20cb 100644
--- a/projects/grid-failure-information-app/src/app/shared/directives/agGrid/auto-resize-columns.directive.spec.ts
+++ b/projects/grid-failure-information-app/src/app/shared/directives/agGrid/auto-resize-columns.directive.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
@@ -10,95 +10,11 @@
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
-import { AutoResizeColumnsDirective } from '@grid-failure-information-app/app/shared/directives/agGrid/auto-resize-columns.directive';
-import { Column } from 'ag-grid-community';
+import { AutoResizeColumnsDirective } from './auto-resize-columns.directive';
describe('AutoResizeColumnsDirective', () => {
- let component: AutoResizeColumnsDirective;
- let agGrid: any;
- let event: any;
-
- beforeEach(() => {
- event = {
- columnApi: {
- getAllColumns() {},
- sizeColumnsToFit() {},
- autoSizeColumns() {},
- setColumnWidth() {},
- },
- };
-
- agGrid = {
- gridOptions: {
- event: event,
- suppressColumnVirtualisation: false,
- onPaginationChanged() {},
- },
- } as any;
-
- component = new AutoResizeColumnsDirective(agGrid);
- });
-
it('should create an instance', () => {
- expect(component).toBeDefined();
- });
-
- it('should call _autoResizeColumns on init', () => {
- const spy = spyOn(component as any, '_autoResizeColumns');
- component.ngOnInit();
- expect(spy).toHaveBeenCalled();
- });
-
- it('should change gridOptions when calling _autoResizeColumns', () => {
- (component as any)._autoResizeColumns();
- expect(agGrid.gridOptions.suppressColumnVirtualisation).toBeTruthy();
- });
-
- it('should not call getAllColumns if _gridWidth not defined and when calling _onGridViewRendered', () => {
- const spy = spyOn(event.columnApi, 'getAllColumns');
- (component as any)._gridWidth = undefined;
-
- (component as any)._onGridViewRendered(event);
- expect(spy).not.toHaveBeenCalled();
- });
-
- it('should call many columnApi functions if _gridWidth defined and call setColumnWidth if _gridWidth is greater than the columns sum width', () => {
- const columns: Column[] = [new Column({}, {}, 'col', true), new Column({}, {}, 'col2', false)];
- const spy = spyOn(event.columnApi, 'getAllColumns').and.returnValue(columns);
- const spyGetActualWidth0 = spyOn(columns[0], 'getActualWidth').and.returnValue(100);
- const spyGetActualWidth1 = spyOn(columns[1], 'getActualWidth').and.returnValue(200);
- const spy2 = spyOn(event.columnApi, 'sizeColumnsToFit');
- const spy3 = spyOn(event.columnApi, 'autoSizeColumns');
- const spySetColumnWidth = spyOn(event.columnApi, 'setColumnWidth');
-
- (component as any)._gridWidth = 301;
-
- (component as any)._onGridViewRendered(event);
- expect(spy).toHaveBeenCalled();
- expect(spy2).toHaveBeenCalled();
- expect(spy3).toHaveBeenCalled();
- expect(spyGetActualWidth0).toHaveBeenCalled();
- expect(spyGetActualWidth1).toHaveBeenCalled();
- expect(spySetColumnWidth).toHaveBeenCalledTimes(2);
- });
-
- it('should call many columnApi functions if _gridWidth defined but not call setColumnWidth if _gridWidth is less or equal than the columns sum width', () => {
- const columns: Column[] = [new Column({}, {}, 'col', true), new Column({}, {}, 'col2', false)];
- const spy = spyOn(event.columnApi, 'getAllColumns').and.returnValue(columns);
- const spyGetActualWidth0 = spyOn(columns[0], 'getActualWidth').and.returnValue(100);
- const spyGetActualWidth1 = spyOn(columns[1], 'getActualWidth').and.returnValue(200);
- const spy2 = spyOn(event.columnApi, 'sizeColumnsToFit');
- const spy3 = spyOn(event.columnApi, 'autoSizeColumns');
- const spySetColumnWidth = spyOn(event.columnApi, 'setColumnWidth');
-
- (component as any)._gridWidth = 299;
-
- (component as any)._onGridViewRendered(event);
- expect(spy).toHaveBeenCalled();
- expect(spy2).toHaveBeenCalled();
- expect(spy3).toHaveBeenCalled();
- expect(spyGetActualWidth0).toHaveBeenCalled();
- expect(spyGetActualWidth1).toHaveBeenCalled();
- expect(spySetColumnWidth).not.toHaveBeenCalled();
+ const directive = new AutoResizeColumnsDirective(null);
+ expect(directive).toBeTruthy();
});
});
diff --git a/projects/grid-failure-information-app/src/app/shared/directives/agGrid/server-side.directive.spec.ts b/projects/grid-failure-information-app/src/app/shared/directives/agGrid/server-side.directive.spec.ts
index 2fb018f..279af24 100644
--- a/projects/grid-failure-information-app/src/app/shared/directives/agGrid/server-side.directive.spec.ts
+++ b/projects/grid-failure-information-app/src/app/shared/directives/agGrid/server-side.directive.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
@@ -10,206 +10,11 @@
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
-import { ServerSideDirective } from '@grid-failure-information-app/app/shared/directives/agGrid/server-side.directive';
-import { PaginationComponent } from '@grid-failure-information-app/shared/components/pagination/pagination.component';
-import { PageEvent } from '@grid-failure-information-app/shared/models/page-event';
-import { PageModel } from '@grid-failure-information-app/shared/models/page/page.model';
-import { of } from 'rxjs/observable/of';
+import { ServerSideDirective } from './server-side.directive'
-describe('ServerSideDirective Test1', () => {
- let component: ServerSideDirective;
- let appState: any;
- let resolver: any;
- let viewContainerRef: any;
- let actionsSubject: any;
- let agGrid: any;
-
- beforeEach(() => {
- appState = {
- dispatch: () => {},
- };
- actionsSubject = {
- pipe: () => {},
- };
- resolver = {
- resolveComponentFactory: () => {},
- };
- viewContainerRef = {
- createComponent: () => {},
- };
- agGrid = {
- gridOptions: {
- suppressColumnVirtualisation: false,
- },
- api: {
- setRowData: () => {},
- } as any,
- };
-
- component = new ServerSideDirective(appState, resolver, viewContainerRef, actionsSubject, agGrid);
-
- component.serverSide = {
- loadAction() {},
- successAction() {},
- pageSize: 200,
- };
- });
-
- afterEach(() => {
- (component as any)._matPagination = null;
- });
-
- it('should create an instance', () => {
- expect(component).toBeDefined();
- });
-
- it('should call resolveComponentFactory if _matPagination not defined', () => {
- (component as any)._matPagination = undefined;
-
- const pagedItem: PageModel<any> = new PageModel();
- pagedItem.totalElements = 10;
- pagedItem.totalPages = 50;
- pagedItem.content = [];
- pagedItem.pageSize = 50;
- pagedItem.pageable = { pageSize: 50 };
-
- const spyPipe = spyOn(actionsSubject, 'pipe').and.returnValue(of(pagedItem));
- const spyResolveComponentFactory = spyOn(resolver, 'resolveComponentFactory');
-
- const thisMatPagination = {
- totalPages: 0,
- length: 0,
- pageSize: 0,
- hidePageSize: undefined,
- page: { subscribe() {} },
- };
- const spyCreateComponent = spyOn(viewContainerRef, 'createComponent').and.returnValue({ instance: thisMatPagination });
- const spyRetrievePage = spyOn(component as any, '_retrievePage');
-
- component.ngOnInit();
-
- expect(spyPipe).toHaveBeenCalled();
- expect(spyResolveComponentFactory).toHaveBeenCalled();
- expect(spyCreateComponent).toHaveBeenCalled();
- expect(spyRetrievePage).toHaveBeenCalled();
- });
-
- it('should not call resolveComponentFactory, set paged properties and call _retrievePage if _matPagination is defined and call setRowData if api is defined', () => {
- spyOn(appState, 'dispatch').and.callThrough();
-
- (component as any)._matPagination = {
- totalPages: 0,
- length: 0,
- pageSize: 0,
- hidePageSize: undefined,
- page: { subscribe() {} },
- };
-
- const pagedItem: PageModel<any> = new PageModel();
- pagedItem.totalElements = 10;
- pagedItem.totalPages = 50;
- pagedItem.content = [];
- pagedItem.pageSize = 50;
- pagedItem.pageable = { pageSize: 50 };
-
- const spyPipe = spyOn(actionsSubject, 'pipe').and.returnValue(of(pagedItem));
- const spyPage = spyOn((component as any)._matPagination.page, 'subscribe').and.returnValue(new PageEvent());
- const spyResolveComponentFactory = spyOn((component as any)._resolver, 'resolveComponentFactory');
- const spyRetrievePage = spyOn(component as any, '_retrievePage');
- const instance: PaginationComponent = new PaginationComponent();
-
- const spyCreateComponent = spyOn(viewContainerRef, 'createComponent').and.returnValue({ instance: instance });
- const spySetRowData = spyOn(agGrid.api, 'setRowData');
-
- component.ngOnInit();
-
- expect(spyPipe).toHaveBeenCalled();
- expect(spyResolveComponentFactory).not.toHaveBeenCalled();
- expect(spyRetrievePage).toHaveBeenCalled();
- expect(spyCreateComponent).not.toHaveBeenCalled();
- expect(spyPage).toHaveBeenCalled();
- expect(spySetRowData).toHaveBeenCalled();
- expect((component as any)._matPagination.hidePageSize).toBeFalsy();
- expect((component as any)._matPagination.length).toBe(pagedItem.totalElements);
- expect((component as any)._matPagination.pageSize).toBe(pagedItem.pageSize);
- expect((component as any)._matPagination.totalPages).toBe(pagedItem.totalPages);
- });
-});
-
-describe('ServerSideDirective Test2', () => {
- let component: ServerSideDirective;
- let appState: any;
- let resolver: any;
- let viewContainerRef: any;
- let actionsSubject: any;
- let agGrid: any;
-
- beforeEach(() => {
- appState = {
- dispatch: () => {},
- };
- actionsSubject = {
- pipe: () => {},
- };
- resolver = {
- resolveComponentFactory: () => {},
- };
- viewContainerRef = {
- createComponent: () => {},
- };
- agGrid = {
- gridOptions: {
- suppressColumnVirtualisation: false,
- },
- api: undefined,
- rowData: [],
- } as any;
-
- component = new ServerSideDirective(appState, resolver, viewContainerRef, actionsSubject, agGrid);
- });
-
- it('should not call resolveComponentFactory, set paged properties and call _retrievePage if _matPagination is defined and NOT call setRowData if api is undefined and rowdata should equal to content', () => {
- spyOn(appState, 'dispatch');
- component.serverSide = {
- loadAction() {},
- successAction() {},
- pageSize: 200,
- };
-
- (component as any)._matPagination = {
- totalPages: 0,
- length: 0,
- pageSize: 0,
- hidePageSize: undefined,
- page: { subscribe() {} },
- };
-
- const pagedItem: PageModel<any> = new PageModel();
- pagedItem.totalElements = 10;
- pagedItem.totalPages = 50;
- pagedItem.content = [{ test: '' }];
- pagedItem.pageSize = 50;
- pagedItem.pageable = { pageSize: 50 };
-
- const spyPipe = spyOn(actionsSubject, 'pipe').and.returnValue(of(pagedItem));
- const spyPage = spyOn((component as any)._matPagination.page, 'subscribe').and.returnValue(new PageEvent());
- const spyResolveComponentFactory = spyOn((component as any)._resolver, 'resolveComponentFactory');
- const spyRetrievePage = spyOn(component as any, '_retrievePage');
- const instance: PaginationComponent = new PaginationComponent();
- const spyCreateComponent = spyOn(viewContainerRef, 'createComponent').and.returnValue(instance);
-
- component.ngOnInit();
-
- expect(spyPipe).toHaveBeenCalled();
- expect(spyResolveComponentFactory).not.toHaveBeenCalled();
- expect((component as any)._matPagination.hidePageSize).toBeFalsy();
- expect((component as any)._matPagination.length).toBe(pagedItem.totalElements);
- expect((component as any)._matPagination.pageSize).toBe(pagedItem.pageSize);
- expect((component as any)._matPagination.totalPages).toBe(pagedItem.totalPages);
- expect(spyRetrievePage).toHaveBeenCalled();
- expect(spyCreateComponent).not.toHaveBeenCalled();
-
- expect(spyPage).toHaveBeenCalled();
- expect(agGrid.rowData).toBe(pagedItem.content);
- });
-});
+describe('ServerSideDirective', () => {
+ it('should create an instance', () => {
+ const directive = new ServerSideDirective(null,null,null,null,null);
+ expect(directive).toBeTruthy()
+ })
+})
diff --git a/projects/grid-failure-information-app/src/app/shared/models/failure-branch.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-branch.model.ts
deleted file mode 100644
index b7ad734..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-branch.model.ts
+++ /dev/null
@@ -1,23 +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
- ********************************************************************************/
-export class FailureBranch {
- public id: string = null;
- public name: string = null;
- public colorCode: 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/failure-classification.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-classification.model.ts
deleted file mode 100644
index 9bd863e..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-classification.model.ts
+++ /dev/null
@@ -1,23 +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
- ********************************************************************************/
-export class FailureClassification {
- public id: string = null;
- public description: string = null;
- public classification: 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/failure-publication-text.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-publication-text.model.ts
deleted file mode 100644
index 226ae03..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-publication-text.model.ts
+++ /dev/null
@@ -1,23 +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
- ********************************************************************************/
-export class FailurePublicationText {
- public id: string = null;
- public text: string = null;
- public description: 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/failure-radius.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-radius.model.ts
deleted file mode 100644
index 66c4aeb..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-radius.model.ts
+++ /dev/null
@@ -1,22 +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
- ********************************************************************************/
-export class FailureRadius {
- public id: string = null;
- public radius: 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/failure-state.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-state.model.ts
deleted file mode 100644
index 45dd955..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-state.model.ts
+++ /dev/null
@@ -1,24 +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
- ********************************************************************************/
-export class FailureState {
- public id: string = null;
- public status: string = null;
- public internal: boolean = false;
- public external: boolean = true;
-
- 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/failure-type.model.ts b/projects/grid-failure-information-app/src/app/shared/models/failure-type.model.ts
deleted file mode 100644
index 4fc3c87..0000000
--- a/projects/grid-failure-information-app/src/app/shared/models/failure-type.model.ts
+++ /dev/null
@@ -1,23 +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
- ********************************************************************************/
-export class FailureType {
- public id: string = null;
- public description: string = null;
- public type: 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/grid-failure.model.ts b/projects/grid-failure-information-app/src/app/shared/models/grid-failure.model.ts
index ee23ba7..c5af552 100644
--- a/projects/grid-failure-information-app/src/app/shared/models/grid-failure.model.ts
+++ b/projects/grid-failure-information-app/src/app/shared/models/grid-failure.model.ts
@@ -31,9 +31,7 @@
public pressureLevel: string = null;
public probableReason: string = null;
public radius: string = null;
- public radiusId: string = null;
public responsibility: string = null;
- public stationCoords: string = null;
public stationDescription: string = null;
public statusExtern: string = null;
public statusExternId: string = null;
@@ -45,11 +43,6 @@
public createUser: string = null;
public modDate: string = null;
public modUser: string = null;
- public objectReferenceExternalSystem: string = null;
- public publicationStatus: string = null;
- public publicationFreetext: string = null;
- public publicationText: string = null;
- public publicationTextId: string = null;
public longitude: number = null;
public latitude: number = null;
public versionNumber: number = 0;
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 2630c9a..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
@@ -12,9 +12,3 @@
********************************************************************************/
export * from './grid-failure.model';
export * from './import-data.model';
-export * from './failure-branch.model';
-export * from './failure-classification.model';
-export * from './failure-type.model';
-export * from './failure-state.model';
-export * from './failure-radius.model';
-export * from './failure-publication-text.model';
diff --git a/projects/grid-failure-information-app/src/app/shared/pipes/sanitizeHtml.pipe.spec.ts b/projects/grid-failure-information-app/src/app/shared/pipes/sanitizeHtml.pipe.spec.ts
new file mode 100644
index 0000000..3b29851
--- /dev/null
+++ b/projects/grid-failure-information-app/src/app/shared/pipes/sanitizeHtml.pipe.spec.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 { DomSanitizer } from '@angular/platform-browser';
+import { SanitizeHtmlPipe } from './sanitizeHtml.pipe';
+
+describe('SanitizeHtmlPipe', () => {
+ let pipe: SanitizeHtmlPipe = {} as any;
+ let _sanitizer: DomSanitizer;
+
+ beforeEach(() => {
+ _sanitizer = {
+ bypassSecurityTrustHtml: v => {
+ return v;
+ },
+ } as any;
+
+ pipe = new SanitizeHtmlPipe(_sanitizer);
+ });
+
+ it('should create', () => {
+ expect(pipe).toBeTruthy();
+ });
+
+ it('should call method transform(v: string)', () => {
+ const safeHtml = pipe.transform('test');
+ expect(safeHtml).toBe('test');
+ });
+});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/actions/grid-failures.action.ts b/projects/grid-failure-information-app/src/app/shared/store/actions/grid-failures.action.ts
index 0d3875a..f4cd4b8 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/actions/grid-failures.action.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/actions/grid-failures.action.ts
@@ -11,15 +11,7 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { createAction, props } from '@ngrx/store';
-import {
- GridFailure,
- FailureBranch,
- FailureClassification,
- FailureType,
- FailureState,
- FailureRadius,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
export interface ILoadGridFailuresSuccess {
payload: Array<GridFailure>;
@@ -51,33 +43,3 @@
export const loadGridFailureVersion = createAction('[GridFailureVersion] Load', props<{ gridFailureId: string; versionNumber: number }>());
export const loadGridFailureVersionSuccess = createAction('[GridFailureVersion] Load Success', props<{ payload: GridFailure }>());
export const loadGridFailureVersionFail = createAction('[GridFailureVersion] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailureBranches = createAction('[GridFailureBranches] Load');
-export const loadGridFailureBranchesSuccess = createAction('[GridFailureBranches] Load Success', props<{ payload: Array<FailureBranch> }>());
-export const loadGridFailureBranchesFail = createAction('[GridFailureBranches] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailureClassifications = createAction('[GridFailureClassifications] Load');
-export const loadGridFailureClassificationsSuccess = createAction(
- '[GridFailureClassifications] Load Success',
- props<{ payload: Array<FailureClassification> }>()
-);
-export const loadGridFailureClassificationsFail = createAction('[GridFailureClassifications] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailureTypes = createAction('[GridFailureTypes] Load');
-export const loadGridFailureTypesSuccess = createAction('[GridFailureTypes] Load Success', props<{ payload: Array<FailureType> }>());
-export const loadGridFailureTypesFail = createAction('[GridFailureTypes] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailureStates = createAction('[GridFailureStates] Load');
-export const loadGridFailureStatesSuccess = createAction('[GridFailureStates] Load Success', props<{ payload: Array<FailureState> }>());
-export const loadGridFailureStatesFail = createAction('[GridFailureStates] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailureRadii = createAction('[GridFailureRadii] Load');
-export const loadGridFailureRadiiSuccess = createAction('[GridFailureRadii] Load Success', props<{ payload: Array<FailureRadius> }>());
-export const loadGridFailureRadiiFail = createAction('[GridFailureRadii] Load Fail', props<{ payload: string }>());
-
-export const loadGridFailurePublicationTexts = createAction('[GridFailurePublicationTexts] Load');
-export const loadGridFailurePublicationTextsSuccess = createAction(
- '[GridFailurePublicationTexts] Load Success',
- props<{ payload: Array<FailurePublicationText> }>()
-);
-export const loadGridFailurePublicationTextsFail = createAction('[GridFailurePublicationTexts] Load Fail', props<{ payload: string }>());
diff --git a/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.spec.ts
index 93faddc..18de492 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.spec.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.spec.ts
@@ -13,15 +13,7 @@
import { take } from 'rxjs/operators';
import { GridFailuresEffects } from '@grid-failure-information-app/shared/store/effects/grid-failures.effect';
import { Subject, of, throwError } from 'rxjs';
-import {
- GridFailure,
- FailureBranch,
- FailureClassification,
- FailureType,
- FailureState,
- FailureRadius,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
import { GridFailureApiClient } from '@grid-failure-information-app/pages/grid-failure/grid-failure-api-client';
import { Store } from '@ngrx/store';
@@ -41,12 +33,6 @@
postGridFailure() {},
getGridFailureVersions() {},
getGridFailureVersion() {},
- getGridFailureBranches() {},
- getGridFailureClassifications() {},
- getGridFailureTypes() {},
- getGridFailureStates() {},
- getGridFailureRadii() {},
- getGridFailurePublicationTexts() {},
} as any;
store = {
dispatch() {},
@@ -153,64 +139,4 @@
done();
actions$.next(gridFailureActions.loadGridFailureVersion({ gridFailureId: '1', versionNumber: 1 }));
});
-
- it('should equal loadGridFailureBranchesSuccess after getGridFailureBranches', done => {
- apiResponse = [new FailureBranch({ id: '1' })];
- spyOn(apiClient, 'getGridFailureBranches').and.returnValue(of(apiResponse));
- effects.getGridFailureBranches$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailureBranchesSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailureBranches());
- });
-
- it('should equal loadGridFailureClassifications after getGridFailureClassifications', done => {
- apiResponse = [new FailureClassification({ id: '1' })];
- spyOn(apiClient, 'getGridFailureClassifications').and.returnValue(of(apiResponse));
- effects.getGridFailureClassifications$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailureClassificationsSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailureClassifications());
- });
-
- it('should equal loadGridFailureTypes after getGridFailureTypes', done => {
- apiResponse = [new FailureType({ id: '1' })];
- spyOn(apiClient, 'getGridFailureTypes').and.returnValue(of(apiResponse));
- effects.getGridFailureTypes$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailureTypesSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailureTypes());
- });
-
- it('should equal loadGridFailureStates after getGridFailureStates', done => {
- apiResponse = [new FailureState({ id: '1' })];
- spyOn(apiClient, 'getGridFailureStates').and.returnValue(of(apiResponse));
- effects.getGridFailureStates$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailureStatesSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailureStates());
- });
-
- it('should equal loadGridFailureRadii after getGridFailureRadii', done => {
- apiResponse = [new FailureRadius({ id: '1' })];
- spyOn(apiClient, 'getGridFailureRadii').and.returnValue(of(apiResponse));
- effects.getGridFailureRadii$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailureRadiiSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailureRadii());
- });
-
- it('should equal loadGridFailurePublicationTexts after getGridFailurePublicationTexts', done => {
- apiResponse = [new FailurePublicationText({ id: '1' })];
- spyOn(apiClient, 'getGridFailurePublicationTexts').and.returnValue(of(apiResponse));
- effects.getGridFailurePublicationTexts$.pipe(take(1)).subscribe(result => {
- expect(result).toEqual(gridFailureActions.loadGridFailurePublicationTextsSuccess({ payload: apiResponse }));
- });
- done();
- actions$.next(gridFailureActions.loadGridFailurePublicationTexts());
- });
});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.ts b/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.ts
index 9756138..2ec1e00 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/effects/grid-failures.effect.ts
@@ -19,15 +19,7 @@
import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
import { GridFailureApiClient } from '@grid-failure-information-app/pages/grid-failure/grid-failure-api-client';
import { catchError, map, switchMap } from 'rxjs/operators';
-import {
- GridFailure,
- FailureClassification,
- FailureType,
- FailureState,
- FailureRadius,
- FailureBranch,
- FailurePublicationText,
-} from '@grid-failure-information-app/shared/models';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
import { Store } from '@ngrx/store';
@Injectable()
@@ -96,77 +88,5 @@
)
);
- getGridFailureBranches$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailureBranches),
- switchMap(action => {
- return this._apiClient
- .getGridFailureBranches()
- .map((branches: FailureBranch[]) => gridFailureActions.loadGridFailureBranchesSuccess({ payload: branches }))
- .catch(error => of(gridFailureActions.loadGridFailureBranchesFail({ payload: error })));
- })
- )
- );
-
- getGridFailureClassifications$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailureClassifications),
- switchMap(action => {
- return this._apiClient
- .getGridFailureClassifications()
- .map((classifications: FailureClassification[]) => gridFailureActions.loadGridFailureClassificationsSuccess({ payload: classifications }))
- .catch(error => of(gridFailureActions.loadGridFailureClassificationsFail({ payload: error })));
- })
- )
- );
-
- getGridFailureTypes$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailureTypes),
- switchMap(action => {
- return this._apiClient
- .getGridFailureTypes()
- .map((types: FailureType[]) => gridFailureActions.loadGridFailureTypesSuccess({ payload: types }))
- .catch(error => of(gridFailureActions.loadGridFailureTypesFail({ payload: error })));
- })
- )
- );
-
- getGridFailureStates$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailureStates),
- switchMap(action => {
- return this._apiClient
- .getGridFailureStates()
- .map((states: FailureState[]) => gridFailureActions.loadGridFailureStatesSuccess({ payload: states }))
- .catch(error => of(gridFailureActions.loadGridFailureStatesFail({ payload: error })));
- })
- )
- );
-
- getGridFailureRadii$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailureRadii),
- switchMap(action => {
- return this._apiClient
- .getGridFailureRadii()
- .map((response: FailureRadius[]) => gridFailureActions.loadGridFailureRadiiSuccess({ payload: response }))
- .catch(error => of(gridFailureActions.loadGridFailureRadiiFail({ payload: error })));
- })
- )
- );
-
- getGridFailurePublicationTexts$: any = createEffect(() =>
- this._actions$.pipe(
- ofType(gridFailureActions.loadGridFailurePublicationTexts),
- switchMap(action => {
- return this._apiClient
- .getGridFailurePublicationTexts()
- .map((response: FailurePublicationText[]) => gridFailureActions.loadGridFailurePublicationTextsSuccess({ payload: response }))
- .catch(error => of(gridFailureActions.loadGridFailurePublicationTextsFail({ payload: error })));
- })
- )
- );
-
constructor(private _actions$: Actions, private _apiClient: GridFailureApiClient, private _store: Store<any>) {}
}
diff --git a/projects/grid-failure-information-app/src/app/shared/store/index.ts b/projects/grid-failure-information-app/src/app/shared/store/index.ts
index 3db1be5..276f00c 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/index.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/index.ts
@@ -20,12 +20,6 @@
import * as fromSettings from '@grid-failure-information-app/shared/store/reducers/settings.reducer';
import * as fromGridFailures from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failures.reducer';
import * as fromGridFailureVersions from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-versions.reducer';
-import * as fromGridFailureBranches from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-branches.reducer';
-import * as fromGridFailureClassifications from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer';
-import * as fromGridFailureTypes from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-types.reducer';
-import * as fromGridFailureStates from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-states.reducer';
-import * as fromGridFailureRadii from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-radii.reducer';
-import * as fromGridFailurePublicationTexts from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer';
import * as fromGridFailuresDetailForm from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer';
import { createFeatureSelector } from '@ngrx/store';
import { createSelector } from 'reselect';
@@ -44,12 +38,6 @@
gridFailures: fromGridFailures.State;
gridFailuresDetailForm: FormGroupState<GridFailure>;
gridFailureVersions: fromGridFailureVersions.State;
- gridFailureBranches: fromGridFailureBranches.State;
- gridFailureClassifications: fromGridFailureClassifications.State;
- gridFailureTypes: fromGridFailureTypes.State;
- gridFailureStates: fromGridFailureStates.State;
- gridFailureRadii: fromGridFailureRadii.State;
- gridFailurePublicationTexts: fromGridFailurePublicationTexts.State;
}
/**
* Because metareducers take a reducer function and return a new reducer,
@@ -66,12 +54,6 @@
gridFailures: fromGridFailures.reducer,
gridFailuresDetailForm: fromGridFailuresDetailForm.reducer,
gridFailureVersions: fromGridFailureVersions.reducer,
- gridFailureBranches: fromGridFailureBranches.reducer,
- gridFailureClassifications: fromGridFailureClassifications.reducer,
- gridFailureTypes: fromGridFailureTypes.reducer,
- gridFailureStates: fromGridFailureStates.reducer,
- gridFailureRadii: fromGridFailureRadii.reducer,
- gridFailurePublicationTexts: fromGridFailurePublicationTexts.reducer,
};
/**
@@ -115,45 +97,3 @@
export const getGridFailureVersionsLoading = createSelector(selectGridFailureVersions, fromGridFailureVersions.getLoading);
export const getGridFailureVersionsFailed = createSelector(selectGridFailureVersions, fromGridFailureVersions.getFailed);
export const getGridFailureVersionsData = createSelector(selectGridFailureVersions, fromGridFailureVersions.getData);
-
-// GridFailure branches
-export const selectGridFailureBranches = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailureBranches);
-export const getGridFailureBranchesLoaded = createSelector(selectGridFailureBranches, fromGridFailureBranches.getLoaded);
-export const getGridFailureBranchesLoading = createSelector(selectGridFailureBranches, fromGridFailureBranches.getLoading);
-export const getGridFailureBranchesFailed = createSelector(selectGridFailureBranches, fromGridFailureBranches.getFailed);
-export const getGridFailureBranchesData = createSelector(selectGridFailureBranches, fromGridFailureBranches.getData);
-
-// GridFailure classifications
-export const selectGridFailureClassifications = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailureClassifications);
-export const getGridFailureClassificationsLoaded = createSelector(selectGridFailureClassifications, fromGridFailureClassifications.getLoaded);
-export const getGridFailureClassificationsLoading = createSelector(selectGridFailureClassifications, fromGridFailureClassifications.getLoading);
-export const getGridFailureClassificationsFailed = createSelector(selectGridFailureClassifications, fromGridFailureClassifications.getFailed);
-export const getGridFailureClassificationsData = createSelector(selectGridFailureClassifications, fromGridFailureClassifications.getData);
-
-// GridFailure types
-export const selectGridFailureTypes = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailureTypes);
-export const getGridFailureTypesLoaded = createSelector(selectGridFailureTypes, fromGridFailureTypes.getLoaded);
-export const getGridFailureTypesLoading = createSelector(selectGridFailureTypes, fromGridFailureTypes.getLoading);
-export const getGridFailureTypesFailed = createSelector(selectGridFailureTypes, fromGridFailureTypes.getFailed);
-export const getGridFailureTypesData = createSelector(selectGridFailureTypes, fromGridFailureTypes.getData);
-
-// GridFailure states
-export const selectGridFailureStates = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailureStates);
-export const getGridFailureStatesLoaded = createSelector(selectGridFailureStates, fromGridFailureStates.getLoaded);
-export const getGridFailureStatesLoading = createSelector(selectGridFailureStates, fromGridFailureStates.getLoading);
-export const getGridFailureStatesFailed = createSelector(selectGridFailureStates, fromGridFailureStates.getFailed);
-export const getGridFailureStatesData = createSelector(selectGridFailureStates, fromGridFailureStates.getData);
-
-// GridFailure radii
-export const selectGridFailureRadii = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailureRadii);
-export const getGridFailureRadiiLoaded = createSelector(selectGridFailureRadii, fromGridFailureRadii.getLoaded);
-export const getGridFailureRadiiLoading = createSelector(selectGridFailureRadii, fromGridFailureRadii.getLoading);
-export const getGridFailureRadiiFailed = createSelector(selectGridFailureRadii, fromGridFailureRadii.getFailed);
-export const getGridFailureRadiiData = createSelector(selectGridFailureRadii, fromGridFailureRadii.getData);
-
-// GridFailure publication texts
-export const selectGridFailurePublicationTexts = createSelector(selectGridFailuresState, (state: GridFailureState) => state.gridFailurePublicationTexts);
-export const getGridFailurePublicationTextsLoaded = createSelector(selectGridFailurePublicationTexts, fromGridFailurePublicationTexts.getLoaded);
-export const getGridFailurePublicationTextsLoading = createSelector(selectGridFailurePublicationTexts, fromGridFailurePublicationTexts.getLoading);
-export const getGridFailurePublicationTextsFailed = createSelector(selectGridFailurePublicationTexts, fromGridFailurePublicationTexts.getFailed);
-export const getGridFailurePublicationTextsData = createSelector(selectGridFailurePublicationTexts, fromGridFailurePublicationTexts.getData);
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.spec.ts
deleted file mode 100644
index c1caebe..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.spec.ts
+++ /dev/null
@@ -1,85 +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 {
- GridFailureBranchesReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-branches.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureBranch } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailureBranchesReducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailureBranches();
- const result = GridFailureBranchesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailureBranch()] };
- const action = gridFailureActions.loadGridFailureBranchesSuccess(items);
- const result = GridFailureBranchesReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailureBranchesFail(error);
- const result = GridFailureBranchesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.ts
deleted file mode 100644
index 119ce07..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-branches.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureBranch } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailureBranch>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailureBranchesReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailureBranches, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailureBranchesSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailureBranchesFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailureBranchesReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.spec.ts
deleted file mode 100644
index 5648372..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.spec.ts
+++ /dev/null
@@ -1,86 +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 {
- GridFailureClassificationsReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureClassification } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailureClassificationsReducer reducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailureClassifications();
- const result = GridFailureClassificationsReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailureClassification()] };
- // items.payload[0].id = 'testme';
- const action = gridFailureActions.loadGridFailureClassificationsSuccess(items);
- const result = GridFailureClassificationsReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailureClassificationsFail(error);
- const result = GridFailureClassificationsReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.ts
deleted file mode 100644
index 3b672a5..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-classifications.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureClassification } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailureClassification>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailureClassificationsReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailureClassifications, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailureClassificationsSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailureClassificationsFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailureClassificationsReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer.ts
index af1b424..3380221 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer.ts
@@ -22,14 +22,17 @@
export const validateForm: ActionReducer<FormState<GridFailure>> = createFormStateReducerWithUpdate<GridFailure>(
updateGroup<GridFailure>({
- branchId: validate(required),
+ branch: validate(required),
voltageLevel: validate(required),
failureBegin: validate(required),
- publicationTextId: validate(required),
+ probableReason: validate(required),
city: validate(required),
street: validate(required),
- stationCoords: validate(required),
- radiusId: validate(required),
+ radius: validate(required),
+ // temporarily only
+ branchId: validate(required),
+ failureTypeId: validate(required),
+ failureClassificationId: validate(required),
statusInternId: validate(required),
statusExternId: validate(required),
})
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.spec.ts
deleted file mode 100644
index 7d2c241..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.spec.ts
+++ /dev/null
@@ -1,85 +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 {
- GridFailurePublicationTextsReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailurePublicationText } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailurePublicationTextsReducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailurePublicationTexts();
- const result = GridFailurePublicationTextsReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailurePublicationText()] };
- const action = gridFailureActions.loadGridFailurePublicationTextsSuccess(items);
- const result = GridFailurePublicationTextsReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailurePublicationTextsFail(error);
- const result = GridFailurePublicationTextsReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.ts
deleted file mode 100644
index 64da952..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-publication-texts.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailurePublicationText } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailurePublicationText>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailurePublicationTextsReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailurePublicationTexts, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailurePublicationTextsSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailurePublicationTextsFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailurePublicationTextsReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.spec.ts
deleted file mode 100644
index b11e828..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.spec.ts
+++ /dev/null
@@ -1,85 +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 {
- GridFailureRadiiReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-radii.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureRadius } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailureRadiiReducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailureRadii();
- const result = GridFailureRadiiReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailureRadius()] };
- const action = gridFailureActions.loadGridFailureRadiiSuccess(items);
- const result = GridFailureRadiiReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailureRadiiFail(error);
- const result = GridFailureRadiiReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.ts
deleted file mode 100644
index f2e80ca..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-radii.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureRadius } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailureRadius>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailureRadiiReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailureRadii, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailureRadiiSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailureRadiiFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailureRadiiReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.spec.ts
deleted file mode 100644
index b942ec7..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.spec.ts
+++ /dev/null
@@ -1,85 +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 {
- GridFailureStatesReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-states.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureState } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailureStatesReducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailureStates();
- const result = GridFailureStatesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailureState()] };
- const action = gridFailureActions.loadGridFailureStatesSuccess(items);
- const result = GridFailureStatesReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailureStatesFail(error);
- const result = GridFailureStatesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.ts
deleted file mode 100644
index c227c08..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-states.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureState } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailureState>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailureStatesReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailureStates, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailureStatesSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailureStatesFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailureStatesReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.spec.ts
deleted file mode 100644
index bd6af85..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.spec.ts
+++ /dev/null
@@ -1,85 +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 {
- GridFailureTypesReducer,
- INITIAL_STATE,
- getData,
- getLoading,
- getLoaded,
- getFailed,
- reducer,
-} from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-types.reducer';
-import * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureType } from '@grid-failure-information-app/shared/models';
-
-describe('GridFailureTypesReducer', () => {
- it('should return the initial state', () => {
- const action = { type: 'NOOP' } as any;
- const result = reducer(undefined, action);
-
- expect(result).toBe(INITIAL_STATE);
- });
-
- it('should trigger loading state', () => {
- const action = gridFailureActions.loadGridFailureTypes();
- const result = GridFailureTypesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- loading: true,
- });
- });
-
- it('should trigger loaded state', () => {
- const items = { payload: [new FailureType()] };
- const action = gridFailureActions.loadGridFailureTypesSuccess(items);
- const result = GridFailureTypesReducer(INITIAL_STATE, action);
-
- expect(result.loaded).toBe(true);
- });
-
- it('should trigger failed state', () => {
- const error = { payload: 'err_msg' };
- const action = gridFailureActions.loadGridFailureTypesFail(error);
- const result = GridFailureTypesReducer(INITIAL_STATE, action);
-
- expect(result).toEqual({
- ...INITIAL_STATE,
- failed: true,
- });
- });
-
- it('getData return state.data', () => {
- const state = { ...INITIAL_STATE };
- const result = getData(state);
- expect(result).toBe(state.data);
- });
-
- it('getLoading return state.loading', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoading(state);
- expect(result).toBe(state.loading);
- });
-
- it('getLoaded return state.loaded', () => {
- const state = { ...INITIAL_STATE };
- const result = getLoaded(state);
- expect(result).toBe(state.loaded);
- });
-
- it('getFailed return state.failed', () => {
- const state = { ...INITIAL_STATE };
- const result = getFailed(state);
- expect(result).toBe(state.failed);
- });
-});
diff --git a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.ts b/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.ts
deleted file mode 100644
index 716f36c..0000000
--- a/projects/grid-failure-information-app/src/app/shared/store/reducers/grid-failures/grid-failure-types.reducer.ts
+++ /dev/null
@@ -1,69 +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 * as gridFailureActions from '@grid-failure-information-app/shared/store/actions/grid-failures.action';
-import { FailureType } from '@grid-failure-information-app/shared/models';
-import { createReducer, on } from '@ngrx/store';
-
-export interface State {
- loading: boolean;
- loaded: boolean;
- failed: boolean;
- data: Array<FailureType>;
-}
-
-export const INITIAL_STATE: State = {
- loading: false,
- loaded: false,
- failed: false,
- data: [],
-};
-
-export const GridFailureTypesReducer = createReducer(
- INITIAL_STATE,
- on(gridFailureActions.loadGridFailureTypes, (state: any, action: any) => {
- return {
- ...state,
- loading: true,
- loaded: false,
- failed: false,
- data: [],
- };
- }),
- on(gridFailureActions.loadGridFailureTypesSuccess, (state: any, action: any) => {
- return {
- ...state,
- loading: false,
- loaded: true,
- failed: false,
- data: action['payload'],
- };
- }),
- on(gridFailureActions.loadGridFailureTypesFail, (state: any, action: any) => {
- return {
- ...state,
- loaded: false,
- loading: false,
- failed: true,
- data: [],
- };
- })
-);
-
-export function reducer(state = INITIAL_STATE, action: any): State {
- return GridFailureTypesReducer(state, action);
-}
-
-export const getData = (state: State) => state.data;
-export const getLoading = (state: State) => state.loading;
-export const getLoaded = (state: State) => state.loaded;
-export const getFailed = (state: State) => state.failed;