[pve-devel] r5801 - in pve-manager/pve2/www/new: . panel tree
svn-commits at proxmox.com
svn-commits at proxmox.com
Thu Apr 7 15:49:26 CEST 2011
Author: dietmar
Date: 2011-04-07 15:49:26 +0200 (Thu, 07 Apr 2011)
New Revision: 5801
Added:
pve-manager/pve2/www/new/panel/
pve-manager/pve2/www/new/panel/StatusPanel.js
Modified:
pve-manager/pve2/www/new/Makefile.am
pve-manager/pve2/www/new/PVEUtils.js
pve-manager/pve2/www/new/StateProvider.js
pve-manager/pve2/www/new/Workspace.js
pve-manager/pve2/www/new/tree/ResourceTree.js
Log:
impl. StatusPanel, confirm page unload
Modified: pve-manager/pve2/www/new/Makefile.am
===================================================================
--- pve-manager/pve2/www/new/Makefile.am 2011-04-07 10:10:13 UTC (rev 5800)
+++ pve-manager/pve2/www/new/Makefile.am 2011-04-07 13:49:26 UTC (rev 5801)
@@ -9,6 +9,7 @@
data/ResourceStore.js \
form/RealmComboBox.js \
form/ViewSelector.js \
+ panel/StatusPanel.js \
window/LoginWindow.js \
tree/ResourceTree.js \
Workspace.js
Modified: pve-manager/pve2/www/new/PVEUtils.js
===================================================================
--- pve-manager/pve2/www/new/PVEUtils.js 2011-04-07 10:10:13 UTC (rev 5800)
+++ pve-manager/pve2/www/new/PVEUtils.js 2011-04-07 13:49:26 UTC (rev 5801)
@@ -1,12 +1,13 @@
Ext.ns('PVE');
// avoid errors when running without development tools
-if (typeof console == "undefined") {
- var console = {
- dir: function() {},
- log: function() {}
- };
+if (!Ext.isDefined(Ext.global.console)) {
+ var console = {
+ dir: function() {},
+ log: function() {}
+ };
}
+console.log("Starting PVE Manager");
Ext.Ajax.defaultHeaders = {
'Accept': 'application/json'
Modified: pve-manager/pve2/www/new/StateProvider.js
===================================================================
--- pve-manager/pve2/www/new/StateProvider.js 2011-04-07 10:10:13 UTC (rev 5800)
+++ pve-manager/pve2/www/new/StateProvider.js 2011-04-07 13:49:26 UTC (rev 5801)
@@ -1,3 +1,11 @@
+// display message on page unload
+PVE.StopPageUnload = false;
+PVE.PageUnloadMessFn = function (){
+ var mess = "Are you sure you want to navigate away from this page?";
+ return PVE.StopPageUnload ? mess : undefined;
+}
+window.onbeforeunload = PVE.PageUnloadMessFn;
+
Ext.define('PVE.StateProvider', {
extend: 'Ext.state.Provider',
@@ -11,7 +19,8 @@
// order is important for notifications
var list = [
'view',
- 'rid'
+ 'rid',
+ 'ltab'
];
var urlstate = Ext.urlDecode(Ext.History.getToken());
@@ -29,9 +38,11 @@
Ext.History.on('change', function(token) {
//console.log("HC " + token);
if (!token) {
- alert("no more history entries");
+ PVE.StopPageUnload = true;
+ Ext.History.back();
return;
}
+ PVE.StopPageUnload = false;
var newstate = Ext.urlDecode(token);
Ext.Array.each(list, function(name) {
if (typeof newstate[name] == "undefined")
Modified: pve-manager/pve2/www/new/Workspace.js
===================================================================
--- pve-manager/pve2/www/new/Workspace.js 2011-04-07 10:10:13 UTC (rev 5800)
+++ pve-manager/pve2/www/new/Workspace.js 2011-04-07 13:49:26 UTC (rev 5801)
@@ -30,6 +30,7 @@
PVE.UserName = null;
if (!self.login) {
+
self.login = Ext.create('PVE.window.LoginWindow', {
handler: function(data) {
self.login = null;
@@ -144,23 +145,12 @@
})
},
{
- //xtype: 'pveStatusPanel',
- xtype: 'tabpanel',
- title: "Realtime logfile viewer",
- tabPosition: 'bottom',
- region:'south',
+ xtype: 'pveStatusPanel',
+ region: 'south',
margins:'0 5 5 5',
height: 200,
collapsible: true,
- split:true,
- items: [
- {
- title: 'tab1'
- },
- {
- title: 'tab2'
- }
- ]
+ split:true
}
]
});
Added: pve-manager/pve2/www/new/panel/StatusPanel.js
===================================================================
--- pve-manager/pve2/www/new/panel/StatusPanel.js (rev 0)
+++ pve-manager/pve2/www/new/panel/StatusPanel.js 2011-04-07 13:49:26 UTC (rev 5801)
@@ -0,0 +1,54 @@
+Ext.define('PVE.panel.StatusPanel', {
+ extend: 'Ext.tab.TabPanel',
+ requires: ['Ext.state.Manager'],
+ alias: 'widget.pveStatusPanel',
+
+ title: "Realtime logfile viewer",
+ tabPosition: 'bottom',
+
+ initComponent: function() {
+ var me = this;
+
+ var stateid = 'ltab';
+ var sp = Ext.state.Manager.getProvider();
+
+ Ext.apply(me, {
+ listeners: {
+ tabchange: function() {
+ var state = { value: me.items.indexOf(me.getActiveTab()) };
+ sp.set(stateid, state);
+ }
+ },
+ items: [
+ {
+ title: 'Cluster log'
+ },
+ {
+ title: 'Recent tasks'
+ }
+ ]
+ });
+
+ var state = sp.get(stateid);
+ if (state && state.value) {
+ me.activeTab = parseInt(state.value);
+ }
+
+ me.callParent();
+
+ var statechange = function(sp, key, state) {
+ if (key === stateid) {
+ var atab = me.items.indexOf(me.getActiveTab());
+ var ntab = parseInt(state.value);
+ if (state && (ntab >= 0) && (atab != state.value)) {
+ me.setActiveTab(ntab);
+ }
+ }
+ };
+
+ sp.on('statechange', statechange);
+ me.on('destroy', function() {
+ sp.un('statechange', statechange);
+ });
+ }
+});
Modified: pve-manager/pve2/www/new/tree/ResourceTree.js
===================================================================
--- pve-manager/pve2/www/new/tree/ResourceTree.js 2011-04-07 10:10:13 UTC (rev 5800)
+++ pve-manager/pve2/www/new/tree/ResourceTree.js 2011-04-07 13:49:26 UTC (rev 5801)
@@ -219,7 +219,7 @@
}
if (!item || changed) {
- console.log("REM UID: " + key + " ITEM " + olditem.data.id);
+ //console.log("REM UID: " + key + " ITEM " + olditem.data.id);
delete index[key];
var parentNode = olditem.parentNode;
//var expanded = parentNode.isExpanded();
@@ -240,7 +240,7 @@
if (filterfn && !filterfn(item))
return;
- console.log("ADD UID: " + item.data.id);
+ //console.log("ADD UID: " + item.data.id);
var info = Ext.apply({ leaf: true }, item.data);
More information about the pve-devel
mailing list