diff --git a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js index 1300eb5498d110faf62b3b29a00bbe8323261c28..e9d7fedeb011dd4f9f52b6df1c992342f56b72d2 100644 --- a/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js +++ b/frontend-js/src/main/js/gui/leftPanel/OverlayPanel.js @@ -240,16 +240,16 @@ OverlayPanel.prototype.openEditOverlayDialog = function (overlay) { }, { text: "REMOVE", click: function () { - self.getMap().removeSelectedLayout(overlay.getId()); - var windowSelf = this; - return ServerConnector.removeOverlay({ - overlayId: overlay.getId() - }).then(function () { - return self.refresh(); - }).then(function () { - $(windowSelf).dialog("close"); - }).then(null, GuiConnector.alert); + return GuiConnector.showConfirmationDialog({ + message: "Do you want to delete overlay: " + overlay.getName() + "?" + }).then(function (confirmation) { + if (confirmation) { + return self.removeOverlay(overlay).then(function () { + $(windowSelf).dialog("close"); + }).then(null, GuiConnector.alert); + } + }); } }, { text: "CANCEL", @@ -400,6 +400,15 @@ OverlayPanel.prototype.init = function () { return this.refresh(showDefault); }; +OverlayPanel.prototype.removeOverlay = function (overlay) { + self = this; + return self.getMap().removeSelectedLayout(overlay.getId()).then(function () { + return ServerConnector.removeOverlay({overlayId: overlay.getId()}); + }).then(function () { + return self.refresh(); + }) +}; + OverlayPanel.prototype.destroy = function () { var self = this; Panel.prototype.destroy.call(this);