diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index e018b49956..835d57f3a8 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -633,6 +633,7 @@ tabs: SecurityGroup.chgrp: true SecurityGroup.chmod: true SecurityGroup.clone_dialog: true + SecurityGroup.commit_dialog: true SecurityGroup.delete: true support-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 13a0d9c8c7..17db081e3b 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -632,6 +632,7 @@ tabs: SecurityGroup.chgrp: true SecurityGroup.chmod: true SecurityGroup.clone_dialog: true + SecurityGroup.commit_dialog: true SecurityGroup.delete: true support-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 0b29e99e8d..a11d926ce3 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -632,6 +632,7 @@ tabs: SecurityGroup.chgrp: false SecurityGroup.chmod: false SecurityGroup.clone_dialog: false + SecurityGroup.commit_dialog: false SecurityGroup.delete: false support-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index 8b5407818b..770200e78b 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -632,6 +632,7 @@ tabs: SecurityGroup.chgrp: false SecurityGroup.chmod: false SecurityGroup.clone_dialog: false + SecurityGroup.commit_dialog: false SecurityGroup.delete: false support-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index 528ded8836..0a9ed38740 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -636,6 +636,7 @@ tabs: SecurityGroup.chgrp: true SecurityGroup.chmod: true SecurityGroup.clone_dialog: true + SecurityGroup.commit_dialog: true SecurityGroup.delete: true oneflow-dashboard-tab: panel_tabs: diff --git a/src/sunstone/models/OpenNebulaJSON/SecurityGroupJSON.rb b/src/sunstone/models/OpenNebulaJSON/SecurityGroupJSON.rb index cfea214b9e..75bebbbc6f 100644 --- a/src/sunstone/models/OpenNebulaJSON/SecurityGroupJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/SecurityGroupJSON.rb @@ -49,6 +49,7 @@ module OpenNebulaJSON when "chmod" then self.chmod_json(action_hash['params']) when "clone" then self.clone(action_hash['params']) when "rename" then self.rename(action_hash['params']) + when "commit" then self.commit(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -91,5 +92,9 @@ module OpenNebulaJSON def clone(params=Hash.new) super(params['name']) end + + def commit(params=Hash.new) + super(params['recover'] == true) + end end end diff --git a/src/sunstone/public/app/opennebula/securitygroup.js b/src/sunstone/public/app/opennebula/securitygroup.js index 2b75c5f6bb..21410bea5a 100644 --- a/src/sunstone/public/app/opennebula/securitygroup.js +++ b/src/sunstone/public/app/opennebula/securitygroup.js @@ -63,7 +63,11 @@ define(function(require) { }, "getName": function(id){ return OpenNebulaAction.getName(id, RESOURCE); - } + }, + "commit" : function(params) { + var action_obj = {"recover": params.data.extra_param}; + OpenNebulaAction.simple_action(params, RESOURCE, "commit", action_obj); + }, } return SecurityGroup; diff --git a/src/sunstone/public/app/tabs/secgroups-tab/actions.js b/src/sunstone/public/app/tabs/secgroups-tab/actions.js index 7bc8b2cb30..37599bfb1a 100644 --- a/src/sunstone/public/app/tabs/secgroups-tab/actions.js +++ b/src/sunstone/public/app/tabs/secgroups-tab/actions.js @@ -27,6 +27,7 @@ define(function(require) { var TAB_ID = require('./tabId'); var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId'); var CLONE_DIALOG_ID = require('./dialogs/clone/dialogId'); + var CONFIRM_DIALOG_ID = require('utils/dialogs/generic-confirm/dialogId'); var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID, XML_ROOT); @@ -46,6 +47,7 @@ define(function(require) { "SecurityGroup.append_template" : _commonActions.appendTemplate(), "SecurityGroup.update_dialog" : _commonActions.checkAndShowUpdate(), "SecurityGroup.show_to_update" : _commonActions.showUpdate(CREATE_DIALOG_ID), + "SecurityGroup.commit": _commonActions.multipleAction('commit'), "SecurityGroup.clone_dialog" : { type: "custom", @@ -64,7 +66,45 @@ define(function(require) { }, error: Notifier.onError, notify: true - } + }, + + "SecurityGroup.commit_dialog": + { + type: "custom", + call: function() { + Sunstone.getDialog(CONFIRM_DIALOG_ID).setParams({ + //header : + body : Locale.tr( + "Please note: each time the rules are edited, the commit operation is done automatically. "+ + "

"+ + "This action will force the propagation of security group changes to VMs. "+ + "The operation takes time to iterate over all VMs in the security group, "+ + "the progress can be checked in the \"VMs\" panel."+ + "

"+ + "With the recover option set, the commit operation will only operate on "+ + "outdated and error VMs. This is intended to reinitialize the updating "+ + "process if a previous one was interrupted."), + //question : + buttons : [ + Locale.tr("Commit --recover"), + Locale.tr("Commit"), + ], + submit : [ + function(){ + Sunstone.runAction('SecurityGroup.commit', Sunstone.getDataTable(TAB_ID).elements(), true); + return false; + }, + function(){ + Sunstone.runAction('SecurityGroup.commit', Sunstone.getDataTable(TAB_ID).elements(), false); + return false; + } + ] + }); + + Sunstone.getDialog(CONFIRM_DIALOG_ID).reset(); + Sunstone.getDialog(CONFIRM_DIALOG_ID).show(); + } + }, }; return _actions; diff --git a/src/sunstone/public/app/tabs/secgroups-tab/buttons.js b/src/sunstone/public/app/tabs/secgroups-tab/buttons.js index de7ce18cea..5c5d723862 100644 --- a/src/sunstone/public/app/tabs/secgroups-tab/buttons.js +++ b/src/sunstone/public/app/tabs/secgroups-tab/buttons.js @@ -51,6 +51,11 @@ define(function(require) { layout: "main", text: Locale.tr("Clone") }, + "SecurityGroup.commit_dialog" : { + type: "action", + layout: "main", + text: Locale.tr("Commit") + }, "SecurityGroup.delete" : { type: "confirm", layout: "del",