From 73d9f76bd21fb6dd18fc005d48dce2a18dbe6023 Mon Sep 17 00:00:00 2001
From: fsdavid <daviti1@mail.com>
Date: Wed, 8 May 2019 10:31:54 +0200
Subject: [PATCH] Upgrade to angular 7 version

---
 angular-cli                                   |  1 +
 package.json                                  | 57 ++++++++++++-------
 src/atlasViewer/atlasViewer.style.css         |  2 +
 src/index.html                                |  1 +
 .../cookieAgreement.component.ts              | 20 +++++++
 .../mobileOverlay/mobileOverlay.component.ts  |  8 ++-
 .../nehubaContainer.component.ts              | 15 +++--
 .../nehubaViewer/nehubaViewer.component.ts    | 11 +++-
 8 files changed, 82 insertions(+), 33 deletions(-)
 create mode 160000 angular-cli
 create mode 100644 src/ui/cookieAgreement/cookieAgreement.component.ts

diff --git a/angular-cli b/angular-cli
new file mode 160000
index 000000000..f00ba8358
--- /dev/null
+++ b/angular-cli
@@ -0,0 +1 @@
+Subproject commit f00ba83584b80053dd6eb0de2ffae6c104b08a01
diff --git a/package.json b/package.json
index de42925f1..c17a8a426 100644
--- a/package.json
+++ b/package.json
@@ -23,50 +23,63 @@
   "author": "",
   "license": "ISC",
   "devDependencies": {
-    "@angular/animations": "^6.0.7",
-    "@angular/common": "^6.0.7",
-    "@angular/compiler": "^6.0.7",
-    "@angular/compiler-cli": "^6.0.3",
-    "@angular/core": "^6.0.3",
-    "@angular/elements": "^6.0.7",
-    "@angular/forms": "^6.0.7",
-    "@angular/http": "^6.0.7",
-    "@angular/platform-browser": "^6.0.7",
-    "@angular/platform-browser-dynamic": "^6.0.7",
+    "@angular/animations": "^7.2.15",
+    "@angular/cli": "^7.3.9",
+    "@angular/common": "^7.2.15",
+    "@angular/compiler": "^7.2.15",
+    "@angular/compiler-cli": "^7.2.15",
+    "@angular/core": "^7.2.15",
+    "@angular/elements": "^7.2.15",
+    "@angular/forms": "^7.2.15",
+    "@angular/http": "^7.2.15",
+    "@angular/language-service": "^7.2.15",
+    "@angular/platform-browser": "^7.2.15",
+    "@angular/platform-browser-dynamic": "^7.2.15",
     "@ngrx/store": "^6.0.1",
     "@ngtools/webpack": "^6.0.5",
     "@types/chart.js": "^2.7.20",
-    "@types/jasmine": "^2.8.8",
+    "@types/jasmine": "^3.3.12",
+    "@types/jasminewd2": "^2.0.6",
+    "@types/node": "^12.0.0",
     "@types/webpack-env": "^1.13.6",
     "angular2-template-loader": "^0.6.2",
     "chart.js": "^2.7.2",
-    "core-js": "^2.5.6",
+    "codelyzer": "^5.0.1",
+    "core-js": "^3.0.1",
     "file-loader": "^1.1.11",
     "html-webpack-plugin": "^3.2.0",
     "jasmine": "^3.1.0",
-    "jasmine-core": "^3.1.0",
-    "karma": "^2.0.5",
+    "jasmine-core": "^3.4.0",
+    "jasmine-spec-reporter": "^4.2.1",
+    "karma": "^4.1.0",
     "karma-chrome-launcher": "^2.2.0",
-    "karma-jasmine": "^1.1.2",
+    "karma-cli": "^2.0.0",
+    "karma-jasmine": "^2.0.1",
     "karma-typescript": "^3.0.13",
     "karma-webpack": "^3.0.0",
     "lodash.merge": "^4.6.1",
     "ng2-charts": "^1.6.0",
     "ngx-bootstrap": "3.0.1",
-    "protractor": "^5.4.0",
+    "protractor": "^5.4.2",
     "raw-loader": "^0.5.1",
     "reflect-metadata": "^0.1.12",
-    "rxjs": "6.2.2",
+    "rxjs": "6.5.1",
     "showdown": "^1.8.6",
     "ts-loader": "^4.3.0",
-    "typescript": "^2.7.2",
+    "ts-node": "^8.1.0",
+    "tslint": "^5.16.0",
+    "typescript": "^3.4.5",
     "uglifyjs-webpack-plugin": "^1.2.5",
     "webpack": "^4.25.0",
-    "webpack-cli": "^3.1.2",
+    "webpack-cli": "^3.3.2",
     "webpack-closure-compiler": "^2.1.6",
     "webpack-dev-server": "^3.1.4",
-    "webpack-merge": "^4.1.2",
-    "zone.js": "^0.8.26"
+    "webpack-merge": "^4.1.2"
   },
-  "dependencies": {}
+  "dependencies": {
+    "@angular/cdk": "^7.3.7",
+    "@angular/material": "^7.3.7",
+    "@angular/router": "^7.2.15",
+    "zone.js": "^0.9.1"
+  }
 }
diff --git a/src/atlasViewer/atlasViewer.style.css b/src/atlasViewer/atlasViewer.style.css
index 54684efb3..5826648e8 100644
--- a/src/atlasViewer/atlasViewer.style.css
+++ b/src/atlasViewer/atlasViewer.style.css
@@ -1,3 +1,5 @@
+/* @import '~@angular/material/prebuilt-themes/indigo-pink.css'; */
+
 :host, :host > .atlas-container
 {
   display:block;
diff --git a/src/index.html b/src/index.html
index 3a45da9bc..a1ec5a948 100644
--- a/src/index.html
+++ b/src/index.html
@@ -8,6 +8,7 @@
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
   <link rel = "stylesheet" href = "extra_styles.css">
   <link rel = "stylesheet" href = "plugin_styles.css">
+  <link href="node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css" rel="stylesheet">
   <title>Interactive Atlas Viewer</title>
 </head>
 <body>
diff --git a/src/ui/cookieAgreement/cookieAgreement.component.ts b/src/ui/cookieAgreement/cookieAgreement.component.ts
new file mode 100644
index 000000000..d780619a5
--- /dev/null
+++ b/src/ui/cookieAgreement/cookieAgreement.component.ts
@@ -0,0 +1,20 @@
+import { Component } from '@angular/core'
+import { BsModalService } from 'ngx-bootstrap/modal/bs-modal.service';
+
+@Component({
+    selector: 'cookie-agreement',
+    templateUrl: './cookieAgreement.template.html',
+    styleUrls: [
+      './cookieAgreement.style.css'
+    ]
+})
+export class CookieAgreement {
+  showMore = false;   
+
+  constructor(private modalService: BsModalService,) {}
+
+  AgreeCookies() {
+    localStorage.setItem('cookies', 'agreed');
+    this.modalService.hide(1);
+  }
+}
\ No newline at end of file
diff --git a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
index cd0241392..9be2dc782 100644
--- a/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
+++ b/src/ui/nehubaContainer/mobileOverlay/mobileOverlay.component.ts
@@ -75,15 +75,17 @@ export class MobileOverlay implements OnInit, OnDestroy{
 
     this.intersectionObserver.observe(this.menuContainer.nativeElement)
   
+    const scanDragScanAccumulator: (acc:TouchEvent[], item: TouchEvent, idx: number) => TouchEvent[] = (acc,curr) => acc.length < 2
+      ? acc.concat(curr)
+      : acc.slice(1).concat(curr)
+      
     this._drag$ = fromEvent(this.initiator.nativeElement, 'touchmove').pipe(
       takeUntil(fromEvent(this.initiator.nativeElement, 'touchend').pipe(
         filter((ev:TouchEvent) => ev.touches.length === 0)
       )),
       map((ev:TouchEvent) => (ev.preventDefault(), ev.stopPropagation(), ev)),
       filter((ev:TouchEvent) => ev.touches.length === 1),
-      scan((acc,curr) => acc.length < 2
-        ? acc.concat(curr)
-        : acc.slice(1).concat(curr), []),
+      scan(scanDragScanAccumulator, []),
       filter(ev => ev.length === 2)
     )
 
diff --git a/src/ui/nehubaContainer/nehubaContainer.component.ts b/src/ui/nehubaContainer/nehubaContainer.component.ts
index 9a5f81a7f..80ab346b9 100644
--- a/src/ui/nehubaContainer/nehubaContainer.component.ts
+++ b/src/ui/nehubaContainer/nehubaContainer.component.ts
@@ -9,6 +9,7 @@ import { timedValues } from "../../util/generator";
 import { AtlasViewerDataService } from "../../atlasViewer/atlasViewer.dataService.service";
 import { AtlasViewerConstantsServices } from "../../atlasViewer/atlasViewer.constantService.service";
 import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
+import { pipeFromArray } from "rxjs/internal/util/pipe";
 
 @Component({
   selector : 'ui-nehuba-container',
@@ -210,11 +211,15 @@ export class NehubaContainer implements OnInit, OnDestroy{
     
     /* each time a new viewer is initialised, take the first event to get the translation function */
     this.newViewer$.pipe(
-      switchMap(() => fromEvent(this.elementRef.nativeElement, 'sliceRenderEvent')
-        .pipe(
-          ...takeOnePipe
-        )
-      )
+      // switchMap(() => fromEvent(this.elementRef.nativeElement, 'sliceRenderEvent')
+      //   .pipe(
+      //     ...takeOnePipe
+      //   )
+      // )
+
+      switchMap(() => pipeFromArray([...takeOnePipe])(fromEvent(this.elementRef.nativeElement, 'sliceRenderEvent')))
+
+
     ).subscribe((events)=>{
       [0,1,2].forEach(idx=>this.nanometersToOffsetPixelsFn[idx] = (events[idx] as any).detail.nanometersToOffsetPixels)
     })
diff --git a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
index 518cf2516..488f5181d 100644
--- a/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
+++ b/src/ui/nehubaContainer/nehubaViewer/nehubaViewer.component.ts
@@ -7,6 +7,7 @@ import { buffer, map, filter, debounceTime, take, takeUntil, scan, switchMap, ta
 import { AtlasViewerConstantsServices } from "../../../atlasViewer/atlasViewer.constantService.service";
 import { takeOnePipe, identifySrcElement } from "../nehubaContainer.component";
 import { ViewerConfiguration } from "src/services/state/viewerConfig.store";
+import { pipeFromArray } from "rxjs/internal/util/pipe";
 
 @Component({
   templateUrl : './nehubaViewer.template.html',
@@ -335,9 +336,13 @@ export class NehubaViewerUnit implements OnDestroy{
     this.onDestroyCb.push(() => window['nehubaViewer'] = null)
 
     this.ondestroySubscriptions.push(
-      fromEvent(this.elementRef.nativeElement, 'viewportToData').pipe(
-        ...takeOnePipe
-      ).subscribe((events:CustomEvent[]) => {
+      // fromEvent(this.elementRef.nativeElement, 'viewportToData').pipe(
+      //   ...takeOnePipe
+      // ).subscribe((events:CustomEvent[]) => {
+      //   [0,1,2].forEach(idx => this.viewportToDatas[idx] = events[idx].detail.viewportToData)
+      // })
+      pipeFromArray([...takeOnePipe])(fromEvent(this.elementRef.nativeElement, 'viewportToData'))
+      .subscribe((events:CustomEvent[]) => {
         [0,1,2].forEach(idx => this.viewportToDatas[idx] = events[idx].detail.viewportToData)
       })
     )
-- 
GitLab