diff --git a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js index 209c06808623718061424b002b9198dc45baf3d0..2dbf2bc598e88796b83ee5dda5adc4f00ab99f2d 100644 --- a/frontend-js/src/main/js/gui/admin/EditProjectDialog.js +++ b/frontend-js/src/main/js/gui/admin/EditProjectDialog.js @@ -305,6 +305,15 @@ EditProjectDialog.prototype._createOverlayTable = function() { }); }); + $(overlaysTable).on("click", "[name='downloadSource']", function() { + var button = this; + return ServerConnector.getOverlaySourceDownloadUrl({ + overlayId : $(button).attr("data") + }).then(function(url) { + return self.downloadFile(url); + }).then(null, GuiConnector.alert); + }); + return overlaysTable; }; @@ -327,13 +336,18 @@ EditProjectDialog.prototype.createUsersTabContent = function() { }; EditProjectDialog.prototype.init = function() { + var self = this; + return self.refreshOverlays().then(function() { + $(window).trigger('resize'); + }); +}; + +EditProjectDialog.prototype.refreshOverlays = function() { var self = this; return ServerConnector.getOverlays({ projectId : self.getProject().getProjectId() }).then(function(overlays) { return self.setOverlays(overlays); - }).then(function() { - $(window).trigger('resize'); }); }; @@ -460,5 +474,13 @@ EditProjectDialog.prototype.saveOverlay = function(overlayId) { return ServerConnector.updateOverlay(overlay); }; +EditProjectDialog.prototype.removeOverlay = function(overlayId) { + var self = this; + return ServerConnector.removeOverlay({ + overlayId : overlayId + }).then(function() { + return self.refreshOverlays(); + }); +}; module.exports = EditProjectDialog;