Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.frontend into SI-2786-BUG-delete-Kontakte-fehlerhaftes-PLZ-handling
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..4102866 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',
   },
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/utility/utilityHelpers.ts b/projects/grid-failure-information-app/src/app/shared/utility/utilityHelpers.ts
index becb2c7..3345c1f 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,10 @@
     firstInput = firstInput.housenumber;
     secondInput = secondInput.housenumber;
   }
+  // NULL or UNDEFINED handling
+  firstInput = !firstInput ? '0' : firstInput;
+  secondInput = !secondInput ? '0' : 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-table-app/src/app/app.component.ts b/projects/grid-failure-information-table-app/src/app/app.component.ts
index 16db99c..a83235a 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
@@ -38,7 +38,7 @@
   public lastModDate: string;
 
   private _gridApi;
-  private _gridFailuresAll: GridFailure[];
+  private _gridFailuresAll: GridFailure[] = [];
   private _subscription: Subscription = new Subscription();
 
   constructor(private _appTableService: AppTableService, private _configService: AppConfigService, private _datePipe: DatePipe) {
@@ -51,7 +51,9 @@
   @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._gridFailuresAll;
+    }
   }
 
   ngOnInit() {
@@ -96,8 +98,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];
+    }
   }
 }