diff --git a/frontend-js/src/main/js/gui/admin/AddProjectDialog.js b/frontend-js/src/main/js/gui/admin/AddProjectDialog.js index 4d2999451332b528cc14989f03e609a3e39d748e..0ab83e41a584db1d9547d034a2ff23d553578a4d 100644 --- a/frontend-js/src/main/js/gui/admin/AddProjectDialog.js +++ b/frontend-js/src/main/js/gui/admin/AddProjectDialog.js @@ -26,6 +26,7 @@ function AddProjectDialog(params) { var self = this; self.registerListenerType("onFileUpload"); self.registerListenerType("onZipFileUpload"); + self.registerListenerType("onProjectAdd"); self.setZipEntries([]); $(self.getElement()).addClass("minerva-edit-project-dialog"); $(self.getElement()).css({overflow: "hidden"}); @@ -1030,6 +1031,10 @@ AddProjectDialog.prototype.getConverter = function () { }); }; +/** + * + * @returns {Promise<Project>} + */ AddProjectDialog.prototype.onSaveClicked = function () { var self = this; var parserClass; @@ -1061,6 +1066,8 @@ AddProjectDialog.prototype.onSaveClicked = function () { "zip-entries": self.getZipEntries() }; return ServerConnector.addProject(options); + }).then(function (project) { + self.callListeners("onProjectAdd", project); }).finally(function () { GuiConnector.hideProcessing(); }); diff --git a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js index 2d4f851a03c16efd46cacc05c9dec3fae7f57b8a..2e87b3d19ae59d846c6ff4e5db44830edef18aaf 100644 --- a/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js +++ b/frontend-js/src/main/js/gui/admin/MapsAdminPanel.js @@ -261,6 +261,9 @@ MapsAdminPanel.prototype.onAddClicked = function () { configuration: self.getConfiguration() }); self._addDialog = dialog; + dialog.addListener("onProjectAdd", function () { + return self.onRefreshClicked() + }); return dialog.init().then(function () { return dialog.open(); }); diff --git a/frontend-js/src/test/js/gui/admin/AddProjectDialog-test.js b/frontend-js/src/test/js/gui/admin/AddProjectDialog-test.js index 8b4e31b352e530ba1597c4e2400ee2a5a428f738..a1e373fcd61fa20bf2328d7b9ffd2655260db4f9 100644 --- a/frontend-js/src/test/js/gui/admin/AddProjectDialog-test.js +++ b/frontend-js/src/test/js/gui/admin/AddProjectDialog-test.js @@ -130,6 +130,10 @@ describe('AddProjectDialog', function () { options = params; }; var dialog = createDialog(); + var projectAdded = false; + dialog.addListener("onProjectAdd", function(){ + projectAdded = true; + }); var file = new Blob(["<node></node>"]); file.name = "test.xml"; @@ -151,6 +155,8 @@ describe('AddProjectDialog', function () { assert.ok(options["version"] !== undefined); assert.ok(options["semantic-zoom"] !== undefined); + + assert.ok(projectAdded); }).finally(function () { return dialog.destroy(); });