mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Bug #4650: Fix sunstone tab actions dependencies
(cherry picked from commit 19434406f92ced389cdc598a608c5d45f23abb4b)
This commit is contained in:
parent
34672cbb1f
commit
12dec15bc7
@ -145,7 +145,11 @@ define(function(require) {
|
||||
'logo': (_config['view']["small_logo"] || "images/one_small_logo.png"),
|
||||
'vmLogos': (_config['vm_logos']),
|
||||
'enabledTabs': _config['view']['enabled_tabs'],
|
||||
'onedConf': _config['oned_conf']
|
||||
'onedConf': _config['oned_conf'],
|
||||
|
||||
"allTabs": function() {
|
||||
return Object.keys(_config['view']['tabs']);
|
||||
}
|
||||
}
|
||||
|
||||
return Config;
|
||||
|
@ -42,17 +42,14 @@ define(function(require) {
|
||||
};
|
||||
|
||||
var _addMainTabs = function() {
|
||||
_addActions();
|
||||
|
||||
$.each(Config.enabledTabs, function(i, tabName){
|
||||
var name = './tabs/' + tabName;
|
||||
var tabObj = require(name);
|
||||
var _tabId = tabObj.tabId;
|
||||
SunstoneCfg["tabs"][_tabId] = tabObj;
|
||||
|
||||
var actions = tabObj.actions;
|
||||
if (actions) {
|
||||
_addActions(actions)
|
||||
}
|
||||
|
||||
var panels = tabObj.panels;
|
||||
if (panels) {
|
||||
_addPanels(_tabId, panels)
|
||||
@ -80,11 +77,18 @@ define(function(require) {
|
||||
});
|
||||
}
|
||||
|
||||
var _addActions = function(actions) {
|
||||
$.each(actions, function(actionName, action) {
|
||||
SunstoneCfg["actions"][actionName] = action;
|
||||
})
|
||||
return false;
|
||||
var _addActions = function() {
|
||||
$.each(Config.allTabs(), function(i, tabName){
|
||||
var name = './tabs/' + tabName;
|
||||
var tabObj = require(name);
|
||||
|
||||
var actions = tabObj.actions;
|
||||
if (actions) {
|
||||
$.each(actions, function(actionName, action) {
|
||||
SunstoneCfg["actions"][actionName] = action;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var _addDialogs = function(dialogs) {
|
||||
@ -999,13 +1003,11 @@ define(function(require) {
|
||||
* tab will be used
|
||||
*/
|
||||
function _hideFormPanelLoading(tabId) {
|
||||
var context;
|
||||
if (tabId){
|
||||
context = $("#" + tabId);
|
||||
} else {
|
||||
context = $(".tab:visible"); // current tab
|
||||
tabId = context.attr("id");
|
||||
if (tabId == undefined){
|
||||
tabId = _getTab()
|
||||
}
|
||||
|
||||
var context = $("#" + tabId);
|
||||
//$(".sunstone-form", context).html(content);
|
||||
|
||||
$(".loadingForm", context).hide();
|
||||
@ -1024,11 +1026,19 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function _hideFormPanel(tabId) {
|
||||
if (tabId == undefined){
|
||||
tabId = _getTab()
|
||||
}
|
||||
|
||||
var context = $("#" + tabId);
|
||||
$('[href="back"]', context).trigger("click");
|
||||
}
|
||||
|
||||
function _popFormPanelLoading(tabId) {
|
||||
if (tabId == undefined){
|
||||
tabId = _getTab()
|
||||
}
|
||||
|
||||
if (!_formPanelVisible($("#"+tabId)) && router != undefined){
|
||||
router.navigate(tabId+"/form");
|
||||
}
|
||||
@ -1062,6 +1072,10 @@ define(function(require) {
|
||||
}
|
||||
|
||||
function _enableFormPanelSubmit(tabId) {
|
||||
if (tabId == undefined){
|
||||
tabId = _getTab()
|
||||
}
|
||||
|
||||
var context = $("#" + tabId);
|
||||
$(".submit_button", context).
|
||||
removeAttr("disabled").
|
||||
|
@ -63,7 +63,7 @@ define(function(require) {
|
||||
type: "single",
|
||||
call: OpenNebulaResource.instantiate,
|
||||
callback: function(request, response){
|
||||
Sunstone.hideFormPanel(TAB_ID);
|
||||
Sunstone.hideFormPanel();
|
||||
OpenNebulaAction.clear_cache("SERVICE");
|
||||
|
||||
Notifier.notifyCustom(Locale.tr("Service created"), " ID: " + response.DOCUMENT.ID, false);
|
||||
@ -72,7 +72,7 @@ define(function(require) {
|
||||
return Sunstone.getDataTable(TAB_ID).elements(opts);
|
||||
},
|
||||
error: function(request, response){
|
||||
Sunstone.hideFormPanelLoading(TAB_ID);
|
||||
Sunstone.hideFormPanelLoading();
|
||||
Notifier.onError(request, response);
|
||||
},
|
||||
notify: false
|
||||
|
@ -160,7 +160,7 @@ define(function(require) {
|
||||
n_roles_done += 1;
|
||||
|
||||
if(n_roles_done == n_roles){
|
||||
Sunstone.enableFormPanelSubmit(TAB_ID);
|
||||
Sunstone.enableFormPanelSubmit();
|
||||
}
|
||||
},
|
||||
error: function(request,error_json, container){
|
||||
|
@ -153,7 +153,7 @@ define(function(require) {
|
||||
type: "multiple",
|
||||
call: OpenNebulaResource.instantiate,
|
||||
callback: function(request, response) {
|
||||
Sunstone.hideFormPanel(TAB_ID);
|
||||
Sunstone.hideFormPanel();
|
||||
OpenNebulaAction.clear_cache("VM");
|
||||
|
||||
Notifier.notifyCustom(Locale.tr("VM created"), " ID: " + response, false);
|
||||
@ -172,7 +172,7 @@ define(function(require) {
|
||||
type: "single",
|
||||
call: OpenNebulaResource.instantiate,
|
||||
callback: function(request, response) {
|
||||
Sunstone.hideFormPanel(TAB_ID);
|
||||
Sunstone.hideFormPanel();
|
||||
OpenNebulaAction.clear_cache("VM");
|
||||
},
|
||||
error: function(request, response){
|
||||
@ -198,7 +198,7 @@ define(function(require) {
|
||||
type: "single",
|
||||
call: OpenNebulaResource.instantiate_persistent,
|
||||
callback: function(request, response) {
|
||||
Sunstone.hideFormPanel(TAB_ID);
|
||||
Sunstone.hideFormPanel();
|
||||
OpenNebulaAction.clear_cache("VM");
|
||||
|
||||
Notifier.notifyCustom(Locale.tr("VM created"), " ID: " + response, false);
|
||||
|
@ -128,7 +128,7 @@ define(function(require) {
|
||||
|
||||
if (!this.selected_nodes || this.selected_nodes.length == 0) {
|
||||
Notifier.notifyError(Locale.tr("No template selected"));
|
||||
Sunstone.hideFormPanelLoading(this.tabId);
|
||||
Sunstone.hideFormPanelLoading();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user