Commit 4a9b14ec authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch...

Merge branch '400-project-list-in-the-admin-area-does-not-update-new-project-row-or-removed-row' into 'master'

Resolve "Project list in the admin area does not update new project row or removed row"

Closes #400

See merge request piotr.gawron/minerva!306
parents 357ad008 6f95d24d
Pipeline #5112 passed with stage
in 1 minute and 48 seconds
...@@ -26,6 +26,7 @@ function AddProjectDialog(params) { ...@@ -26,6 +26,7 @@ function AddProjectDialog(params) {
var self = this; var self = this;
self.registerListenerType("onFileUpload"); self.registerListenerType("onFileUpload");
self.registerListenerType("onZipFileUpload"); self.registerListenerType("onZipFileUpload");
self.registerListenerType("onProjectAdd");
self.setZipEntries([]); self.setZipEntries([]);
$(self.getElement()).addClass("minerva-edit-project-dialog"); $(self.getElement()).addClass("minerva-edit-project-dialog");
$(self.getElement()).css({overflow: "hidden"}); $(self.getElement()).css({overflow: "hidden"});
...@@ -1030,6 +1031,10 @@ AddProjectDialog.prototype.getConverter = function () { ...@@ -1030,6 +1031,10 @@ AddProjectDialog.prototype.getConverter = function () {
}); });
}; };
/**
*
* @returns {Promise<Project>}
*/
AddProjectDialog.prototype.onSaveClicked = function () { AddProjectDialog.prototype.onSaveClicked = function () {
var self = this; var self = this;
var parserClass; var parserClass;
...@@ -1061,6 +1066,8 @@ AddProjectDialog.prototype.onSaveClicked = function () { ...@@ -1061,6 +1066,8 @@ AddProjectDialog.prototype.onSaveClicked = function () {
"zip-entries": self.getZipEntries() "zip-entries": self.getZipEntries()
}; };
return ServerConnector.addProject(options); return ServerConnector.addProject(options);
}).then(function (project) {
self.callListeners("onProjectAdd", project);
}).finally(function () { }).finally(function () {
GuiConnector.hideProcessing(); GuiConnector.hideProcessing();
}); });
......
...@@ -261,6 +261,9 @@ MapsAdminPanel.prototype.onAddClicked = function () { ...@@ -261,6 +261,9 @@ MapsAdminPanel.prototype.onAddClicked = function () {
configuration: self.getConfiguration() configuration: self.getConfiguration()
}); });
self._addDialog = dialog; self._addDialog = dialog;
dialog.addListener("onProjectAdd", function () {
return self.onRefreshClicked()
});
return dialog.init().then(function () { return dialog.init().then(function () {
return dialog.open(); return dialog.open();
}); });
......
...@@ -130,6 +130,10 @@ describe('AddProjectDialog', function () { ...@@ -130,6 +130,10 @@ describe('AddProjectDialog', function () {
options = params; options = params;
}; };
var dialog = createDialog(); var dialog = createDialog();
var projectAdded = false;
dialog.addListener("onProjectAdd", function(){
projectAdded = true;
});
var file = new Blob(["<node></node>"]); var file = new Blob(["<node></node>"]);
file.name = "test.xml"; file.name = "test.xml";
...@@ -151,6 +155,8 @@ describe('AddProjectDialog', function () { ...@@ -151,6 +155,8 @@ describe('AddProjectDialog', function () {
assert.ok(options["version"] !== undefined); assert.ok(options["version"] !== undefined);
assert.ok(options["semantic-zoom"] !== undefined); assert.ok(options["semantic-zoom"] !== undefined);
assert.ok(projectAdded);
}).finally(function () { }).finally(function () {
return dialog.destroy(); return dialog.destroy();
}); });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment