Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.frontend into SI-1947-BUG-Schnellfilter-qualifiziert-filtert-nicht-veroeffentlich
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.html b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.html
index df52e22..7472b7b 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.html
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.html
@@ -34,8 +34,8 @@
</ag-grid-angular>
<app-spinner [isRunning]="sandbox.distributionGroupLoading$ | async"></app-spinner>
<div class="distribution-group-member-container">
- <app-distribution-group-members class="distribution-group-member"></app-distribution-group-members>
- <app-distribution-group-member-postcodes class="distribution-group-member-postcodes"></app-distribution-group-member-postcodes>
+ <app-distribution-group-members (rowSelectionChanged)="plzValueId = $event" class="distribution-group-member"></app-distribution-group-members>
+ <app-distribution-group-member-postcodes [plzValueId]="plzValueId" class="distribution-group-member-postcodes"></app-distribution-group-member-postcodes>
</div>
</div>
<app-distribution-group-details class="distribution-group-form"></app-distribution-group-details>
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.scss b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.scss
index 1675d2b..8251ea4 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.scss
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.scss
@@ -38,5 +38,6 @@
}
.distribution-group-member-container {
+ position: relative;
display: flex;
}
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.ts b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.ts
index a3703c2..7047eb0 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.ts
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-list/distribution-group-list.component.ts
@@ -28,6 +28,7 @@
public frameworkComponents: { setFilterComponent: any };
public api: GridApi | null | undefined;
public RolesEnum = RolesEnum;
+ public plzValueId: string;
constructor(public sandbox: DistributionGroupSandbox) {
super();
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-member-postcodes/distribution-group-member-postcodes.component.ts b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-member-postcodes/distribution-group-member-postcodes.component.ts
index 22c8666..c77ab40 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-member-postcodes/distribution-group-member-postcodes.component.ts
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-member-postcodes/distribution-group-member-postcodes.component.ts
@@ -11,7 +11,7 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { DistributionGroupSandbox, PostcodeInterface } from '@grid-failure-information-app/app/pages/distribution-group/distribution-group.sandbox';
-import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
+import { Component, OnInit, ViewChild, ElementRef, Input } from '@angular/core';
import { BaseList } from '@grid-failure-information-app/shared/components/base-components/base.list';
import { Subscription } from 'rxjs';
import { DISTRIBUTION_GROUP_MEMBER_POSTCODES_COLDEF } from '@grid-failure-information-app/app/pages/distribution-group/distribution-group-member-postcodes/distribution-group-member-postcodes-col-def';
@@ -31,6 +31,14 @@
public columnDefinition: any = DISTRIBUTION_GROUP_MEMBER_POSTCODES_COLDEF;
public frameworkComponents: { setFilterComponent: any };
+ @Input() set plzValueId(value: string) {
+ if (!this._currentPlzValueId || this._currentPlzValueId !== value) {
+ this._currentPlzValueId = value;
+ this.postcodeInput.nativeElement.value = '';
+ }
+ }
+ private _currentPlzValueId: string;
+
constructor(public sandbox: DistributionGroupSandbox, private _utilService: UtilService) {
super();
this.frameworkComponents = { setFilterComponent: SetFilterComponent };
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-members/distribution-group-members.component.ts b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-members/distribution-group-members.component.ts
index 6526266..eace185 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-members/distribution-group-members.component.ts
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group-members/distribution-group-members.component.ts
@@ -11,7 +11,7 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import { DistributionGroupSandbox } from '@grid-failure-information-app/app/pages/distribution-group/distribution-group.sandbox';
-import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
+import { Component, OnInit, ViewChild, ElementRef, Output, EventEmitter } from '@angular/core';
import { BaseList } from '@grid-failure-information-app/shared/components/base-components/base.list';
import { DISTRIBUTION_GROUP_MEMBER_COLDEF } from '@grid-failure-information-app/app/pages/distribution-group/distribution-group-members/distribution-group-members-col-def';
import { SetFilterComponent } from '@grid-failure-information-app/shared/filters/ag-grid/set-filter/set-filter.component';
@@ -27,6 +27,7 @@
})
export class DistributionGroupMembersComponent extends BaseList implements OnInit {
@ViewChild('searchInput', { static: true }) searchInput: ElementRef;
+ @Output() rowSelectionChanged: EventEmitter<any> = new EventEmitter();
public columnDefinition: any = DISTRIBUTION_GROUP_MEMBER_COLDEF;
public frameworkComponents: { setFilterComponent: any };
@@ -41,9 +42,11 @@
(this.gridOptions = {
...this.gridOptions,
onRowClicked: event => {
+ const rowChanged: boolean = this.sandbox.selectedMemberRowIndex !== event.rowIndex;
this.sandbox.selectedMemberRowIndex = event.rowIndex;
this.sandbox.setSelectedDistributionGroupMember(event.data);
this.sandbox.transformPostcodes();
+ if (rowChanged) this.rowSelectionChanged.emit(event.data.id);
},
onModelUpdated: event => {
if (event.api.getDisplayedRowAtIndex(this.sandbox.selectedMemberRowIndex)) {
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.ts
index 4c048c8..db8e28f 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.ts
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.ts
@@ -160,6 +160,7 @@
}
public deleteDistributionGroupMember(groupId: string, memberId: string): void {
+ this.actionsSubject.pipe(ofType(distributionGroupActions.deleteDistributionGroupMemberSuccess), take(1)).subscribe(() => this.selectedMemberRowIndex = 0);
this.appState$.dispatch(distributionGroupActions.deleteDistributionGroupMember({ groupId: groupId, memberId: memberId }));
}
@@ -294,16 +295,22 @@
this._utilService.displayNotification('SelectedContactAlreadyAssigned', 'alert');
this.setSelectedContact(undefined);
} else {
- let newGroupMember = {
+ let newGroupMemberData = {
contactId: this._selectedContact.uuid,
distributionGroupUuid: this.selectedDistributionGroup.id,
};
+ const newGroupMember = new DistributionGroupMember(newGroupMemberData);
+ this.actionsSubject.pipe(ofType(distributionGroupActions.createDistributionGroupMemberSuccess), take(1)).subscribe(payload => {
+ this.selectedMemberRowIndex = 0;
+ });
this.appState$.dispatch(
distributionGroupActions.createDistributionGroupMember({
groupId: this.selectedDistributionGroup.id,
- newMember: new DistributionGroupMember(newGroupMember),
+ newMember: newGroupMember,
})
);
+ this.postcodes = [];
+ this._selectedDistributionGroupMember = newGroupMember;
this.setSelectedContact(undefined);
}
}
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 848e815..0c25b2a 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
@@ -416,135 +416,139 @@
<div class="fault-location-container">
<div class="NS-fields" *ngIf="failureLocationView === Globals.FAILURE_LOCATION_NS">
- <!-- city -->
- <div class="form-group row">
- <label for="city" class="col-sm-5 col-form-label">{{ 'GridFailure.City' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- id="city"
- name="city"
- [ngrxFormControlState]="formState.controls['city']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.addressCommunities$ | async" [value]="item">{{ item }}</option>
- </select>
+ <div>
+ <!-- city -->
+ <div class="form-group row">
+ <label for="city" class="col-sm-5 col-form-label">{{ 'GridFailure.City' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ id="city"
+ name="city"
+ [ngrxFormControlState]="formState.controls['city']"
+ >
+ <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
+ <option *ngFor="let item of gridFailureDetailsSandbox.addressCommunities$ | async" [value]="item">{{ item }}</option>
+ </select>
+ </div>
</div>
- </div>
- <!-- district -->
- <div class="form-group row">
- <label for="district" class="col-sm-5 col-form-label">{{ 'GridFailure.District' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- id="district"
- name="district"
- [ngrxFormControlState]="formState.controls['district']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.addressDistricts$ | async" [value]="item">{{ item }}</option>
- </select>
+ <!-- district -->
+ <div class="form-group row">
+ <label for="district" class="col-sm-5 col-form-label">{{ 'GridFailure.District' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ id="district"
+ name="district"
+ [ngrxFormControlState]="formState.controls['district']"
+ >
+ <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
+ <option *ngFor="let item of gridFailureDetailsSandbox.addressDistricts$ | async" [value]="item">{{ item }}</option>
+ </select>
+ </div>
</div>
- </div>
- <!-- postcode -->
- <div class="form-group row">
- <label for="postcode" class="col-sm-5 col-form-label">{{ 'GridFailure.Postcode' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- maxlength="255"
- class="form-control"
- id="postcode"
- name="postcode"
- [ngrxFormControlState]="formState.controls['postcode']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.addressPostCodes$ | async" [value]="item">{{ item }}</option>
- </select>
+ <!-- postcode -->
+ <div class="form-group row">
+ <label for="postcode" class="col-sm-5 col-form-label">{{ 'GridFailure.Postcode' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="postcode"
+ name="postcode"
+ [ngrxFormControlState]="formState.controls['postcode']"
+ >
+ <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
+ <option *ngFor="let item of gridFailureDetailsSandbox.addressPostCodes$ | async" [value]="item">{{ item }}</option>
+ </select>
+ </div>
</div>
- </div>
- <!-- street -->
- <div class="form-group row">
- <label for="street" class="col-sm-5 col-form-label">{{ 'GridFailure.Street' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- id="street"
- [ngrxFormControlState]="formState.controls['street']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let item of gridFailureDetailsSandbox.addressStreets$ | async" [value]="item">{{ item }}</option>
- </select>
+ <!-- street -->
+ <div class="form-group row">
+ <label for="street" class="col-sm-5 col-form-label">{{ 'GridFailure.Street' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ id="street"
+ [ngrxFormControlState]="formState.controls['street']"
+ >
+ <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
+ <option *ngFor="let item of gridFailureDetailsSandbox.addressStreets$ | async" [value]="item">{{ item }}</option>
+ </select>
+ </div>
</div>
- </div>
- <!-- housenumber -->
- <div class="form-group row">
- <label for="housenumber" class="col-sm-5 col-form-label">{{ 'GridFailure.Housenumber' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- id="housenumber"
- [ngrxFormControlState]="formState.controls['housenumber']"
- >
- <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
- <option *ngFor="let housenumber of gridFailureDetailsSandbox.addressHouseNumbers$ | async" [value]="housenumber">
- {{ housenumber }}
- </option>
- </select>
+ <!-- housenumber -->
+ <div class="form-group row">
+ <label for="housenumber" class="col-sm-5 col-form-label">{{ 'GridFailure.Housenumber' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ id="housenumber"
+ [ngrxFormControlState]="formState.controls['housenumber']"
+ >
+ <option [value]="null" selected disabled>{{ 'SelectOption' | translate }}</option>
+ <option *ngFor="let housenumber of gridFailureDetailsSandbox.addressHouseNumbers$ | async" [value]="housenumber">
+ {{ housenumber }}
+ </option>
+ </select>
+ </div>
</div>
- </div>
- <!-- radius -->
- <div class="form-group row">
- <label for="radius" class="col-sm-5 col-form-label">{{ 'GridFailure.RadiusInMeter' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- [ngrxFormControlState]="formState.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>
+ <!-- radius -->
+ <div class="form-group row">
+ <label for="radius" class="col-sm-5 col-form-label">{{ 'GridFailure.RadiusInMeter' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ [ngrxFormControlState]="formState.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>
- <label
- class="readOnly"
- *ngIf="
- !!formState.value.id &&
- formState.value.statusIntern !== StateEnum.QUALIFIED &&
- formState.value.statusIntern !== StateEnum.CANCELED &&
- formState.value.statusIntern !== StateEnum.COMPLETED
- "
- >Aktuelle Adresse: <br />
- {{ currentAddress }}</label
- >
+ <div>
+ <label
+ class="readOnly"
+ *ngIf="
+ !!formState.value.id &&
+ formState.value.statusIntern !== StateEnum.QUALIFIED &&
+ formState.value.statusIntern !== StateEnum.CANCELED &&
+ formState.value.statusIntern !== StateEnum.COMPLETED
+ "
+ >Aktuelle Adresse: <br />
+ {{ currentAddress }}</label
+ >
+ </div>
</div>
<div class="MS-fields" *ngIf="failureLocationView === Globals.FAILURE_LOCATION_MS && !!gridFailureDetailsSandbox.gridFailureStations">
@@ -596,55 +600,57 @@
</div>
<div class="NS-fields" *ngIf="failureLocationView === Globals.FAILURE_LOCATION_MAP">
- <!-- freetext city -->
- <div class="form-group row">
- <label for="city" class="col-sm-5 col-form-label">{{ 'GridFailure.City' | translate }}</label>
- <div class="col-sm-6">
- <input type="text" maxlength="255" class="form-control" id="freetextCity" [ngrxFormControlState]="formState.controls['freetextCity']" />
+ <div>
+ <!-- freetext city -->
+ <div class="form-group row">
+ <label for="city" class="col-sm-5 col-form-label">{{ 'GridFailure.City' | translate }}</label>
+ <div class="col-sm-6">
+ <input type="text" maxlength="255" class="form-control" id="freetextCity" [ngrxFormControlState]="formState.controls['freetextCity']" />
+ </div>
</div>
- </div>
- <!-- freetext district -->
- <div class="form-group row">
- <label for="district" class="col-sm-5 col-form-label">{{ 'GridFailure.District' | translate }}</label>
- <div class="col-sm-6">
- <input
- type="text"
- maxlength="255"
- class="form-control"
- id="freetextDistrict"
- [ngrxFormControlState]="formState.controls['freetextDistrict']"
- />
+ <!-- freetext district -->
+ <div class="form-group row">
+ <label for="district" class="col-sm-5 col-form-label">{{ 'GridFailure.District' | translate }}</label>
+ <div class="col-sm-6">
+ <input
+ type="text"
+ maxlength="255"
+ class="form-control"
+ id="freetextDistrict"
+ [ngrxFormControlState]="formState.controls['freetextDistrict']"
+ />
+ </div>
</div>
- </div>
- <!-- freetext postcode -->
- <div class="form-group row">
- <label for="postcode" class="col-sm-5 col-form-label">{{ 'GridFailure.Postcode' | translate }}</label>
- <div class="col-sm-6">
- <input
- type="text"
- maxlength="5"
- class="form-control"
- id="freetextPostcode"
- [ngrxFormControlState]="formState.controls['freetextPostcode']"
- />
+ <!-- freetext postcode -->
+ <div class="form-group row">
+ <label for="postcode" class="col-sm-5 col-form-label">{{ 'GridFailure.Postcode' | translate }}</label>
+ <div class="col-sm-6">
+ <input
+ type="text"
+ maxlength="5"
+ class="form-control"
+ id="freetextPostcode"
+ [ngrxFormControlState]="formState.controls['freetextPostcode']"
+ />
+ </div>
</div>
- </div>
- <!-- radius -->
- <div class="form-group row">
- <label for="radius" class="col-sm-5 col-form-label">{{ 'GridFailure.RadiusInMeter' | translate }}</label>
- <div class="col-sm-6">
- <select
- [required]="
- gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
- "
- type="text"
- class="form-control"
- [ngrxFormControlState]="formState.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>
+ <!-- radius -->
+ <div class="form-group row">
+ <label for="radius" class="col-sm-5 col-form-label">{{ 'GridFailure.RadiusInMeter' | translate }}</label>
+ <div class="col-sm-6">
+ <select
+ [required]="
+ gridFailureDetailsSandbox.isFieldRequiredDependingOnBranchId && !gridFailureDetailsSandbox.oldVersion && !formState.isDisabled
+ "
+ type="text"
+ class="form-control"
+ [ngrxFormControlState]="formState.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>
</div>
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 04d6198..09e97e2 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
@@ -109,6 +109,9 @@
.NS-fields,
.MS-fields {
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
min-width: 480px;
}
@@ -139,6 +142,6 @@
border: 1px solid;
padding: 15px 30px;
width: -webkit-fill-available;
- margin-right: 42px;
+ margin: 0px 42px 0px 0px;
color: grey;
}
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts
index 164ac0a..bf6dcb0 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.ts
@@ -91,11 +91,25 @@
this.gridFailureDetailsSandbox.gridFailureDetailsFormState$
.pipe(
- skipWhile(item => !item.value.housenumber),
+ skipWhile(item => !item.value.postcode && !item.value.city && !item.value.district && !item.value.street && !item.value.housenumber),
take(1)
)
.subscribe(girdFailure => {
- this.currentAddress = `${girdFailure.value.postcode} ${girdFailure.value.city} (${girdFailure.value.district}), ${girdFailure.value.street} ${girdFailure.value.housenumber}`;
+ if (girdFailure.value.postcode) {
+ this.currentAddress += `${girdFailure.value.postcode} `;
+ }
+ if (girdFailure.value.city) {
+ this.currentAddress += `${girdFailure.value.city} `;
+ }
+ if (girdFailure.value.district) {
+ this.currentAddress += `(${girdFailure.value.district})`;
+ }
+ if (girdFailure.value.street) {
+ this.currentAddress += `, ${girdFailure.value.street} `;
+ }
+ if (girdFailure.value.housenumber) {
+ this.currentAddress += `${girdFailure.value.housenumber}`;
+ }
});
}
public setBranchValue(branchId: string) {
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 ab364a7..45e59ee 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
@@ -48,7 +48,7 @@
unbox,
MarkAsPristineAction,
} from 'ngrx-forms';
-import { combineLatest, Observable } from 'rxjs';
+import { combineLatest, Observable, of } from 'rxjs';
import { debounceTime, distinctUntilChanged, map, skipWhile, take, takeUntil, tap } from 'rxjs/operators';
import { StateEnum } from '@grid-failure-information-app/shared/constants/enums';
@@ -340,7 +340,7 @@
.subscribe((payload: any) => {
this.setFormStatePristine();
if (payload && payload.id) {
- this._router.navigateByUrl('/grid-failures/' + payload.id);
+ window.location.assign('/grid-failures/' + payload.id);
} else {
if (this._configService.getEnv('env') !== 'test') {
window.location.reload();
@@ -891,9 +891,7 @@
break;
case formState.controls.city.id:
- this.loadGridFailureDistricts(
- formState.value.city,
- formState.value.branch);
+ this.loadGridFailureDistricts(formState.value.city, formState.value.branch);
break;
case formState.controls.district.id:
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 336a2fa..d9ff356 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
@@ -12,7 +12,7 @@
********************************************************************************/
import { DateTimeCellRendererComponent } from '@grid-failure-information-app/shared/components/cell-renderer/date-time-cell-renderer/date-time-cell-renderer.component';
import { IconCellRendererComponent } from '@grid-failure-information-app/shared/components/cell-renderer/icon-cell-renderer/icon-cell-renderer.component';
-import { dateTimeComparator } from '@grid-failure-information-app/shared/utility';
+import { dateTimeComparator, sortAlphaNum } from '@grid-failure-information-app/shared/utility';
import { stringInsensitiveComparator } from '@grid-failure-information-table-app/app/utilityHelpers';
export const GRID_FAILURE_COLDEF = [
@@ -205,7 +205,7 @@
colId: 'housenumber',
headerName: 'GridFailure.Housenumber',
sortable: true,
- comparator: stringInsensitiveComparator,
+ comparator: sortAlphaNum,
suppressMovable: true,
filter: 'setFilterComponent',
},
@@ -214,7 +214,7 @@
colId: 'radius',
headerName: 'GridFailure.RadiusInM',
sortable: true,
- comparator: stringInsensitiveComparator,
+ comparator: sortAlphaNum,
suppressMovable: true,
filter: 'setFilterComponent',
},
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list.component.scss b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list.component.scss
index 99e3fa0..cdafa8c 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list.component.scss
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure-list.component.scss
@@ -13,6 +13,8 @@
.grid-failures-grid-wrapper {
position: relative;
height: 100%;
+ display: flex;
+ flex-direction: column;
}
.header {
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
index c4b4d65..7082a69 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-list/grid-failure.sandbox.ts
@@ -72,6 +72,7 @@
public clearGridFailureCondensation(): void {
this.condenseId = null;
this.condenseBranch = null;
+ this.loadGridFailures();
this.condensationList = [];
}
public cancelCondesation(): void {
diff --git a/projects/grid-failure-information-app/src/app/shared/models/settings.model.ts b/projects/grid-failure-information-app/src/app/shared/models/settings.model.ts
index 282dc18..27abdc0 100644
--- a/projects/grid-failure-information-app/src/app/shared/models/settings.model.ts
+++ b/projects/grid-failure-information-app/src/app/shared/models/settings.model.ts
@@ -19,6 +19,7 @@
public overviewMapInitialLatitude: string = null;
public overviewMapInitialLongitude: string = null;
public visibilityConfiguration: VisibilityConfigurationInterface = null;
+ public dataExternInitialVisibility: string = null;
public constructor(data: any = null) {
Object.keys(data || {})
diff --git a/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.spec.ts b/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.spec.ts
index ef6b322..ef7905d 100644
--- a/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.spec.ts
+++ b/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.spec.ts
@@ -12,6 +12,7 @@
********************************************************************************/
import * as utilityHelpers from '@grid-failure-information-app/shared/utility/utilityHelpers';
import { FailureHousenumber } from '@grid-failure-information-app/shared/models';
+import { VisibilityConfigurationInterface } from '@grid-failure-information-app/shared/interfaces/visibility-configuration.interface';
describe('utilityHelpers', () => {
it('should navigate to overview after call navigateHome', () => {
@@ -112,4 +113,15 @@
testValue = utilityHelpers.sortAlphaNum(inputFailureHousenumber, inputFailureHousenumber2);
expect(testValue).toBe(0);
});
+
+ it('should return true for detailFieldVisibility in case no config is provided', () => {
+ let config: VisibilityConfigurationInterface = null;
+ let testValue = utilityHelpers.determineDetailFieldVisibility(config, 'fieldVisibility', 'description');
+ expect(testValue).toBeTruthy();
+ });
+
+ it('should determine addressRelevan Branch', () => {
+ let testValue = utilityHelpers.getAddressRelevantBranch('S');
+ expect(testValue).toBe('S');
+ });
});
diff --git a/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.ts b/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.ts
index becb2c7..3c72fd9 100644
--- a/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.ts
+++ b/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.ts
@@ -127,6 +127,15 @@
firstInput = firstInput.housenumber;
secondInput = secondInput.housenumber;
}
+
+ if (firstInput === secondInput) return 0;
+ if (firstInput === null || (firstInput === '' && !!secondInput)) return -1; // handle ascending sorting with NULL values
+ if (secondInput === null || (secondInput === '' && !!firstInput)) return 1; // handle decending sorting with NULL values
+
+ // NULL or UNDEFINED handling
+ firstInput = !firstInput ? '0' : String(firstInput);
+ secondInput = !secondInput ? '0' : String(secondInput);
+
const removeA = /[^a-zA-Z]/g;
const removeNumber = /[^0-9]/g;
const firstInputNumber = parseInt(firstInput.replace(removeNumber, /^.+-/, /^.+ /, ''));
diff --git a/projects/grid-failure-information-app/src/styles.scss b/projects/grid-failure-information-app/src/styles.scss
index aabb47f..614deda 100644
--- a/projects/grid-failure-information-app/src/styles.scss
+++ b/projects/grid-failure-information-app/src/styles.scss
@@ -3834,6 +3834,7 @@
.card-body {
flex: 1 1 auto;
padding: 1.25rem;
+ height: calc(100% - 2.25rem);
}
.card-title {
diff --git a/projects/grid-failure-information-map-app/src/app/app-config.service.ts b/projects/grid-failure-information-map-app/src/app/app-config.service.ts
index 96aea46..4810aee 100644
--- a/projects/grid-failure-information-map-app/src/app/app-config.service.ts
+++ b/projects/grid-failure-information-map-app/src/app/app-config.service.ts
@@ -12,6 +12,7 @@
********************************************************************************/
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
+import { MapOptions } from '@openk-libs/grid-failure-information-map/shared/models/map-options.model';
@Injectable({
providedIn: 'root',
@@ -20,6 +21,6 @@
constructor(private http: HttpClient) {}
getConfig() {
- return this.http.get('public-settings');
+ return this.http.get<MapOptions>('public-settings');
}
}
diff --git a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.spec.ts b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.spec.ts
index 679f27e..2a39df8 100644
--- a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.spec.ts
+++ b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.spec.ts
@@ -14,9 +14,10 @@
import { GridFailureService } from '@grid-failure-information-map-app/app/grid-failure/grid-failure.service';
import { AppConfigService } from '@grid-failure-information-map-app/app/app-config.service';
import { of } from 'rxjs';
-import { GridFailure } from '@grid-failure-information-app/shared/models';
+import { GridFailure, Settings } from '@grid-failure-information-app/shared/models';
+import { VisibilityEnum } from '@grid-failure-information-app/shared/constants/enums';
-describe('GridFailureSandbox', () => {
+describe('GridFailureSandbox ', () => {
let sandbox: GridFailureSandbox;
let gridFailureService: GridFailureService;
let configService: AppConfigService;
@@ -24,17 +25,15 @@
let gridFailureMapList: GridFailure[] = [];
beforeEach(() => {
+ let config = new Settings();
+ config.dataExternInitialVisibility = VisibilityEnum.SHOW;
configService = {
- getConfig: () => of(new Object()),
+ getConfig: () => of(config),
} as any;
gridFailureService = {
- getGridFailureData: () => of(new Object()),
+ getGridFailureData: () => of([new GridFailure()]),
} as any;
- gridFailureMapListAll = [
- new GridFailure({postcode: '007'}),
- new GridFailure({postcode: '4711'}),
- new GridFailure({postcode: '0815'}),
- ];
+ gridFailureMapListAll = [new GridFailure({ postcode: '007' }), new GridFailure({ postcode: '4711' }), new GridFailure({ postcode: '0815' })];
gridFailureMapList = gridFailureMapListAll.map(i => Object.assign(i));
sandbox = new GridFailureSandbox(gridFailureService, configService);
(sandbox as any)._gridFailureMapListAll = gridFailureMapListAll;
@@ -45,12 +44,6 @@
expect(sandbox).toBeTruthy();
});
- it('should add two subscriptions', () => {
- const spy: any = spyOn(sandbox['_subscription'], 'add');
- sandbox.initSandbox();
- expect(spy).toHaveBeenCalledTimes(2);
- });
-
it('should unsubscribe subscriptions', () => {
const spy: any = spyOn(sandbox['_subscription'], 'unsubscribe');
sandbox.unsubscribe();
@@ -58,13 +51,15 @@
});
it('filterGridFailureMapList() should assign all gridfailure to map property ', () => {
+ sandbox.initSandbox();
sandbox.filterGridFailureMapList();
- expect(sandbox.gridFailureMapList.length).toEqual(gridFailureMapListAll.length);
+ expect(sandbox.gridFailureMapList.length).toEqual(1);
});
it('filterGridFailureMapList("") should assign all gridfailure to map property ', () => {
+ sandbox.initSandbox();
sandbox.filterGridFailureMapList('');
- expect(sandbox.gridFailureMapList.length).toEqual(gridFailureMapListAll.length);
+ expect(sandbox.gridFailureMapList.length).toEqual(1);
});
it('filterGridFailureMapList("007") should assign only one gridfailure to map property ', () => {
diff --git a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.ts b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.ts
index cb114d8..0dfac51 100644
--- a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.ts
+++ b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.sandbox.ts
@@ -12,48 +12,39 @@
********************************************************************************/
import { Injectable } from '@angular/core';
import { GridFailureService } from '@grid-failure-information-map-app/app/grid-failure/grid-failure.service';
-import { Subscription } from 'rxjs';
+import { Subscription, combineLatest } from 'rxjs';
import { MapOptions } from '@openk-libs/grid-failure-information-map/shared/models/map-options.model';
import { AppConfigService } from '@grid-failure-information-map-app/app/app-config.service';
import { take } from 'rxjs/operators';
import { GridFailure } from '@grid-failure-information-app/shared/models';
+import { VisibilityEnum } from '@grid-failure-information-app/shared/constants/enums';
@Injectable()
export class GridFailureSandbox {
public gridFailureMapList: GridFailure[] = [];
public mapOptions: MapOptions = new MapOptions();
- public postcode: string = '';
private _gridFailureMapListAll: GridFailure[] = [];
+ private _gridFailureMapListAllConfigured: GridFailure[] = [];
private _subscription: Subscription = new Subscription();
constructor(private _gridFailureService: GridFailureService, private _configService: AppConfigService) {}
public initSandbox() {
- this._subscription.add(
- this._configService
- .getConfig()
- .pipe(take(1))
- .subscribe((data: MapOptions) => {
- this.mapOptions = new MapOptions(data);
- this.mapOptions.extendMarkerInformation = true;
- })
- );
-
- this._subscription.add(
- this._gridFailureService
- .getGridFailureData()
- .pipe(take(1))
- .subscribe((data: GridFailure[]) => {
- this.gridFailureMapList = data;
- this._gridFailureMapListAll = data;
- })
- );
+ this._subscription = combineLatest([this._configService.getConfig(), this._gridFailureService.getGridFailureData()])
+ .pipe(take(1))
+ .subscribe(([config, data]) => {
+ this.mapOptions = new MapOptions(config);
+ this.mapOptions.extendMarkerInformation = true;
+ this.gridFailureMapList = config && config.dataExternInitialVisibility === VisibilityEnum.HIDE ? [] : data;
+ this._gridFailureMapListAll = data;
+ this._gridFailureMapListAllConfigured = config && config.dataExternInitialVisibility === VisibilityEnum.HIDE ? [] : data;
+ });
}
public filterGridFailureMapList(postcode: string = '') {
postcode = postcode.trim();
- this.gridFailureMapList = postcode.length > 0 ? this._gridFailureMapListAll.filter(y => y.postcode === postcode) : this._gridFailureMapListAll;
+ this.gridFailureMapList = postcode.length > 0 ? this._gridFailureMapListAll.filter(y => y.postcode === postcode) : this._gridFailureMapListAllConfigured;
}
public unsubscribe() {
diff --git a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.service.ts b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.service.ts
index ddefa01..ed4fba6 100644
--- a/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.service.ts
+++ b/projects/grid-failure-information-map-app/src/app/grid-failure/grid-failure.service.ts
@@ -1,26 +1,26 @@
/********************************************************************************
-* Copyright (c) 2020 Contributors to the Eclipse Foundation
-*
-* See the NOTICE file(s) distributed with this work for additional
-* information regarding copyright ownership.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v. 2.0 which is available at
-* http://www.eclipse.org/legal/epl-2.0.
-*
-* SPDX-License-Identifier: EPL-2.0
-********************************************************************************/
+ * Copyright (c) 2020 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ ********************************************************************************/
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
+import { GridFailure } from '@grid-failure-information-app/shared/models';
@Injectable({
- providedIn: 'root'
+ providedIn: 'root',
})
export class GridFailureService {
+ constructor(private _http: HttpClient) {}
- constructor(private _http: HttpClient) { }
-
- getGridFailureData(){
- return this._http.get('public-sit');
+ getGridFailureData() {
+ return this._http.get<GridFailure[]>('public-sit');
}
}
diff --git a/projects/grid-failure-information-table-app/src/app/app-config.service.ts b/projects/grid-failure-information-table-app/src/app/app-config.service.ts
index 96aea46..cef247c 100644
--- a/projects/grid-failure-information-table-app/src/app/app-config.service.ts
+++ b/projects/grid-failure-information-table-app/src/app/app-config.service.ts
@@ -12,6 +12,7 @@
********************************************************************************/
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
+import { Settings } from '@grid-failure-information-app/shared/models';
@Injectable({
providedIn: 'root',
@@ -20,6 +21,6 @@
constructor(private http: HttpClient) {}
getConfig() {
- return this.http.get('public-settings');
+ return this.http.get<Settings>('public-settings');
}
}
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.spec.ts b/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
index 79a3fb9..3821ac2 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
+++ b/projects/grid-failure-information-table-app/src/app/app.component.spec.ts
@@ -16,8 +16,9 @@
import { GridFailure, Settings } from '@grid-failure-information-app/shared/models';
import { of } from 'rxjs';
import { DatePipe } from '@angular/common';
+import { VisibilityEnum } from '@grid-failure-information-app/shared/constants/enums';
-describe('AppComponent', () => {
+describe('AppComponent ', () => {
let component: TableComponent;
let service: AppTableService;
let configService: AppConfigService;
@@ -26,7 +27,7 @@
beforeEach(() => {
service = {
- loadGridFailureData: () => of(true),
+ loadGridFailureData: () => of([new GridFailure()]),
} as any;
configService = {
getConfig: () => of(true),
@@ -63,9 +64,16 @@
});
it('should assign all gridfailures to table', () => {
+ let config = new Settings();
+ config.dataExternInitialVisibility = VisibilityEnum.SHOW;
+ configService = {
+ getConfig: () => of(config),
+ } as any;
+ component = new TableComponent(service, configService, null);
component.postcode = '';
component['_datePipe'] = { transform: () => '18.09.2020 / 10:17' } as any;
- expect(component.gridFailures.length).toEqual(gridFailureMapListAll.length);
+ component.ngOnInit();
+ expect(component.gridFailures.length).toEqual(1);
});
it('should assign only gridfailures with postcode 007 to table', () => {
diff --git a/projects/grid-failure-information-table-app/src/app/app.component.ts b/projects/grid-failure-information-table-app/src/app/app.component.ts
index 16db99c..bccf565 100644
--- a/projects/grid-failure-information-table-app/src/app/app.component.ts
+++ b/projects/grid-failure-information-table-app/src/app/app.component.ts
@@ -16,7 +16,7 @@
import { APP_TABLE_COLDEF } from '@grid-failure-information-table-app/app/app-table-column-definition';
import { GridOptions } from 'ag-grid-community';
import { Globals } from '@grid-failure-information-app/shared/constants/globals';
-import { Subscription } from 'rxjs';
+import { Subscription, combineLatest } from 'rxjs';
import { DatePipe } from '@angular/common';
import { AppConfigService } from '@grid-failure-information-table-app/app/app-config.service';
import { take } from 'rxjs/operators';
@@ -38,7 +38,8 @@
public lastModDate: string;
private _gridApi;
- private _gridFailuresAll: GridFailure[];
+ private _gridFailuresAll: GridFailure[] = [];
+ private _gridFailuresAllConfigured: GridFailure[];
private _subscription: Subscription = new Subscription();
constructor(private _appTableService: AppTableService, private _configService: AppConfigService, private _datePipe: DatePipe) {
@@ -51,35 +52,29 @@
@Input() set postcode(value: string) {
value = value.trim();
let filterFunc = (x: GridFailure) => x.postcode === value || x.freetextPostcode === value;
- this.gridFailures = value.length > 0 ? this._gridFailuresAll.filter(filterFunc) : this._gridFailuresAll;
+ if (!!this._gridFailuresAll && this._gridFailuresAll.length > 0) {
+ this.gridFailures = value.length > 0 ? this._gridFailuresAll.filter(filterFunc) : this._gridFailuresAllConfigured;
+ }
}
ngOnInit() {
- this._subscription.add(
- this._configService
- .getConfig()
- .pipe(take(1))
- .subscribe((config: Settings) => {
- if (config && config.visibilityConfiguration) {
- APP_TABLE_COLDEF.forEach((column: any) => {
- column['hide'] = config.visibilityConfiguration.tableExternColumnVisibility[column['field']] === VisibilityEnum.HIDE;
- });
- this.columnDefs = APP_TABLE_COLDEF;
- }
- })
- );
- this._subscription.add(
- this._appTableService
- .loadGridFailureData()
- .pipe(take(1))
- .subscribe((data: GridFailure[]) => {
- this.gridFailures = data;
- this._gridFailuresAll = data;
- if (this._datePipe) {
- this.lastModDate = this._datePipe.transform(this._getLastModeDate(), Globals.DATE_TIME_FORMAT);
- }
- })
- );
+ this._subscription = combineLatest([this._configService.getConfig(), this._appTableService.loadGridFailureData()])
+ .pipe(take(1))
+ .subscribe(([config, data]) => {
+ if (config && config.visibilityConfiguration) {
+ APP_TABLE_COLDEF.forEach((column: any) => {
+ column['hide'] = config.visibilityConfiguration.tableExternColumnVisibility[column['field']] === VisibilityEnum.HIDE;
+ });
+ this.columnDefs = APP_TABLE_COLDEF;
+ }
+ this.gridFailures = config && config.dataExternInitialVisibility === VisibilityEnum.HIDE ? [] : data;
+ this._gridFailuresAll = data;
+ this._gridFailuresAllConfigured = config && config.dataExternInitialVisibility === VisibilityEnum.HIDE ? [] : data;
+ if (this._datePipe) {
+ this.lastModDate = this._datePipe.transform(this._getLastModeDate(), Globals.DATE_TIME_FORMAT);
+ }
+ });
+
this.gridOptions = {
localeText: Globals.LOCALE_TEXT,
};
@@ -96,8 +91,10 @@
}
private _getLastModeDate(): number {
- let modeDates: number[] = this._gridFailuresAll.map(gf => Date.parse(gf.modDate));
- modeDates = modeDates.sort((a, b) => b - a); // sort timestamps descending
- return modeDates[0];
+ if (!!this._gridFailuresAll && this._gridFailuresAll.length > 0) {
+ let modeDates: number[] = this._gridFailuresAll.map(gf => Date.parse(gf.modDate));
+ modeDates = modeDates.sort((a, b) => b - a); // sort timestamps descending
+ return modeDates[0];
+ }
}
}
diff --git a/projects/openk/grid-failure-information-map/src/shared/models/map-options.model.ts b/projects/openk/grid-failure-information-map/src/shared/models/map-options.model.ts
index 031f129..ae5e3dd 100644
--- a/projects/openk/grid-failure-information-map/src/shared/models/map-options.model.ts
+++ b/projects/openk/grid-failure-information-map/src/shared/models/map-options.model.ts
@@ -21,6 +21,7 @@
public overviewMapInitialLatitude: string = null;
public overviewMapInitialLongitude: string = null;
public visibilityConfiguration: VisibilityConfigurationInterface = null;
+ public dataExternInitialVisibility: string = null;
public constructor(data: any = null) {
Object.keys(data || {})
diff --git a/projects/openk/grid-failure-information-map/src/shared/utility/utilityHelpers.spec.ts b/projects/openk/grid-failure-information-map/src/shared/utility/utilityHelpers.spec.ts
index c1d8917..df78e04 100644
--- a/projects/openk/grid-failure-information-map/src/shared/utility/utilityHelpers.spec.ts
+++ b/projects/openk/grid-failure-information-map/src/shared/utility/utilityHelpers.spec.ts
@@ -11,6 +11,7 @@
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import * as utilityHelpers from '@openk-libs/grid-failure-information-map/shared/utility/utilityHelpers';
+import { VisibilityConfigurationInterface } from '@openk-libs/grid-failure-information-map/shared/models/visibility-configuration.interface';
describe('utilityHelpers', () => {
it('should parse string to Integer via toInteger()', () => {
@@ -43,4 +44,10 @@
let testValue = utilityHelpers.convertISOToLocalDateTime(dateString);
expect(testValue).toBe('19.11.2020 / 14:13');
});
+
+ it('should return true for detailFieldVisibility in case no config is provided', () => {
+ let config: VisibilityConfigurationInterface = null;
+ let testValue = utilityHelpers.determineDetailFieldVisibility(config, 'fieldVisibility', 'description');
+ expect(testValue).toBeTruthy();
+ });
});