From e8713a1f096f1c779bd4240118b7ffa926636b90 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Thu, 24 May 2018 10:03:58 +0200
Subject: [PATCH] info window with information when google consent for some
 data overlay is missing

---
 frontend-js/src/main/js/gui/leftPanel/LeftPanel.js    | 8 ++++++++
 frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js | 9 +++++++++
 frontend-js/src/main/js/minerva.js                    | 3 +++
 3 files changed, 20 insertions(+)

diff --git a/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js b/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js
index 5f3db721db..07820ce17e 100644
--- a/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js
+++ b/frontend-js/src/main/js/gui/leftPanel/LeftPanel.js
@@ -324,4 +324,12 @@ LeftPanel.prototype.destroy = function () {
   return Promise.all(promises);
 };
 
+LeftPanel.prototype.setGoogleLicenseConsentRequired = function (value) {
+  this._googleLicenseConsentRequired = value;
+};
+
+LeftPanel.prototype.isGoogleLicenseConsentRequired = function () {
+  return this._googleLicenseConsentRequired;
+};
+
 module.exports = LeftPanel;
diff --git a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js
index 4f9d56c7d3..0598ec4fd8 100644
--- a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js
+++ b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js
@@ -350,9 +350,13 @@ OverlayPanel.prototype.refresh = function () {
 
         body = document.createElement("tbody");
         table.appendChild(body);
+        self.setGoogleLicenseConsentRequired(false);
         for (i = 0; i < customOverlays.length; i++) {
           overlay = customOverlays[i];
           body.appendChild(self.createOverlayRow(overlay, selectedOverlay[overlay.getId()], !overlay.isGoogleLicenseConsent()));
+          if (!overlay.isGoogleLicenseConsent()) {
+            self.setGoogleLicenseConsentRequired(true);
+          }
         }
       }
 
@@ -509,4 +513,9 @@ OverlayPanel.prototype.openAddOverlayDialog = function () {
 OverlayPanel.prototype.init = function () {
   return this.refresh();
 };
+
+OverlayPanel.prototype.setGoogleLicenseConsentRequired = function (value) {
+  this.getParent().setGoogleLicenseConsentRequired(value);
+};
+
 module.exports = OverlayPanel;
diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js
index 9e976cfcfc..4496b71b6c 100644
--- a/frontend-js/src/main/js/minerva.js
+++ b/frontend-js/src/main/js/minerva.js
@@ -553,6 +553,9 @@ function create(params) {
       return customMap.openSubmap(submapId);
     }
   }).then(function () {
+    if (leftPanel.isGoogleLicenseConsentRequired()) {
+      GuiConnector.alert("Some data overlays doesn't have consent to the terms of the <a href='https://cloud.google.com/maps-platform/terms/'>license of Google Maps Platform</a>. To be able to visualize them you must edit data overlay. ")
+    }
     var result = createResult(customMap);
 
     if (params.isDebug()) {
-- 
GitLab