mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Feature #3748: Info panels can save their state when the refresh button is clicked
This commit is contained in:
parent
c2a6c673fb
commit
a819cb31a8
@ -536,10 +536,22 @@ define(function(require) {
|
||||
var activaTabHref = activaTab.attr('href');
|
||||
}
|
||||
|
||||
var isRefresh = (activaTabHref != undefined);
|
||||
var prevPanelInstances = SunstoneCfg['tabs'][tabName]["panelInstances"];
|
||||
var prevPanelStates = {};
|
||||
|
||||
if(isRefresh && prevPanelInstances != undefined){
|
||||
$.each(prevPanelInstances, function(panelName, panel) {
|
||||
if(panel.getState){
|
||||
prevPanelStates[panelName] = panel.getState(context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var panels = SunstoneCfg['tabs'][tabName].panels;
|
||||
var active = false;
|
||||
var templatePanelsParams = []
|
||||
var panelInstances = []
|
||||
SunstoneCfg['tabs'][tabName]["panelInstances"] = {};
|
||||
|
||||
$.each(panels, function(panelName, Panel) {
|
||||
if (Config.isTabPanelEnabled((contextTabId||tabName), panelName)) {
|
||||
@ -554,7 +566,7 @@ define(function(require) {
|
||||
|
||||
try {
|
||||
var panelInstance = new Panel(info, contextTabId);
|
||||
panelInstances.push(panelInstance);
|
||||
SunstoneCfg['tabs'][tabName]["panelInstances"][panelName] = panelInstance;
|
||||
templatePanelsParams.push({
|
||||
'panelName': panelName,
|
||||
'icon': panelInstance.icon,
|
||||
@ -578,9 +590,13 @@ define(function(require) {
|
||||
|
||||
context.html(html);
|
||||
|
||||
$.each(panelInstances, function(index, panel) {
|
||||
$.each(SunstoneCfg['tabs'][tabName]["panelInstances"], function(panelName, panel) {
|
||||
panel.setup(context);
|
||||
|
||||
if(isRefresh && prevPanelStates[panelName] && panel.setState){
|
||||
panel.setState( prevPanelStates[panelName], context );
|
||||
}
|
||||
|
||||
if (panel.onShow) {
|
||||
context.off('click', '[href="#' + panel.panelId + '"]');
|
||||
context.on('click', '[href="#' + panel.panelId + '"]', function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user