Skip to content

Commit

Permalink
B #3217: Create or update a virtual network in sunstone (#3461)
Browse files Browse the repository at this point in the history
* B #3217: Create or update a VN in Sunstone

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>

* B #3217: Create or update a VN in Sunstone

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
(cherry picked from commit d087ed3)
  • Loading branch information
jloboescalona2 authored and tinova committed Jul 8, 2019
1 parent cc93fda commit e975a35
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/sunstone/public/app/sunstone.js
Expand Up @@ -1247,11 +1247,10 @@ define(function(require) {
var dialogInstance = SunstoneCfg["dialogInstances"][dialogId];
if (dialogInstance == undefined) {
var Dialog = SunstoneCfg["dialogs"][dialogId];
var dialogInstance = new Dialog();
dialogInstance = new Dialog();
dialogInstance.insert();
SunstoneCfg["dialogInstances"][dialogId] = dialogInstance;
}

return dialogInstance;
};

Expand Down
1 change: 0 additions & 1 deletion src/sunstone/public/app/tabs/images-tab/dialogs/clone.js
Expand Up @@ -104,7 +104,6 @@ define(function(require) {
Sunstone.getDialog(DIALOG_ID).hide();
Sunstone.getDialog(DIALOG_ID).reset();
setTimeout(function() {
console.log("d");
Sunstone.runAction("Image.refresh");
}, 1500);
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/sunstone/public/app/tabs/vnets-tab/actions.js
Expand Up @@ -152,7 +152,8 @@ define(function(require) {
Sunstone.getDialog(CLUSTERS_DIALOG_ID).setParams({
element: response[XML_ROOT],
resource:"vnet",
resource_name: RESOURCE
resource_name: RESOURCE,
only_update_template: false
});

Sunstone.getDialog(CLUSTERS_DIALOG_ID).reset();
Expand Down
5 changes: 0 additions & 5 deletions src/sunstone/public/app/utils/dialogs/clusters.js
Expand Up @@ -82,9 +82,7 @@ define(function(require) {

$("#" + DIALOG_ID + "Form", dialog).submit(function() {
var selectedClustersList = that.clustersTable.retrieveResourceTableSelect();

if ( that.only_update_template != undefined && that.only_update_template != true) {

$.each(selectedClustersList, function(index, clusterId) {
if ($.inArray(clusterId, that.originalClusterIds) === -1) {
if(that.resource == "datastore"){
Expand All @@ -94,7 +92,6 @@ define(function(require) {
}
}
});

$.each(that.originalClusterIds, function(index, clusterId) {
if ($.inArray(clusterId, selectedClustersList) === -1) {
if(that.resource == "datastore"){
Expand All @@ -111,9 +108,7 @@ define(function(require) {

Sunstone.getDialog(DIALOG_ID).hide();
Sunstone.getDialog(DIALOG_ID).reset();

setTimeout(function() {
console.log("n");
Sunstone.runAction(that.resource_name+".refresh");
}, 1500);

Expand Down
18 changes: 16 additions & 2 deletions src/sunstone/public/app/utils/notifier.js
Expand Up @@ -41,8 +41,22 @@ define(function(require) {
//Notification on error
var _notifyError = function(msg, target=undefined, context=undefined) {
if(target && context){
var tab = $(target).find($(".is-invalid-input",context)).closest(".tabs-panel",context);
tab.parent().siblings($(".tabs",context)).find($("a[href$=\"#"+tab.attr("id")+"\"]",context)).click();
var tab = $(target).find($(".is-invalid-input",context));
tab.parents().each(
function(id,element){
var parent = $(element);
if(parent.hasClass("tabs-panel")){
var tabs = parent.parent().siblings($(".tabs",context));
if(tabs && tabs.length){
var find = tabs.find($("a[href$=\"#"+parent.attr("id")+"\"]",context))
if(find && find.length){
find.click();
return false;
}
}
}
}
);
}
$.jGrowl(msg, {theme: "jGrowl-notify-error", position: "bottom-right", sticky: true});
};
Expand Down

0 comments on commit e975a35

Please sign in to comment.