Commit 4a3d7101 authored by Thomas Lamprecht's avatar Thomas Lamprecht Committed by Dietmar Maurer

add goBack function

Add function to go a step back in browsing history.
Also don't use the anim var in setActiveItem when no old appWindow
is defined, as it is undefined in this scope.
Signed-off-by: 's avatarThomas Lamprecht <t.lamprecht@proxmox.com>
parent ab3cc94a
...@@ -74,6 +74,20 @@ Ext.define('PVE.Workspace', { statics: { ...@@ -74,6 +74,20 @@ Ext.define('PVE.Workspace', { statics: {
}); });
}, },
goBack: function() {
var actions = PVE.Workspace.history.getActions(),
lastAction = actions[actions.length - 2];
var url = '';
if(lastAction) {
actions.pop();
url = lastAction.getUrl();
}
// use loadPage directly so we don't cause new additions to the history
PVE.Workspace.loadPage(url);
},
__setAppWindow: function(comp, dir) { __setAppWindow: function(comp, dir) {
var old = PVE.Workspace.appWindow; var old = PVE.Workspace.appWindow;
...@@ -94,7 +108,7 @@ Ext.define('PVE.Workspace', { statics: { ...@@ -94,7 +108,7 @@ Ext.define('PVE.Workspace', { statics: {
} }
}, 500); }, 500);
} else { } else {
Ext.Viewport.setActiveItem(PVE.Workspace.appWindow, anim); Ext.Viewport.setActiveItem(PVE.Workspace.appWindow);
} }
}, },
......
Markdown is supported
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