[pve-devel] r6302 - in pve-manager/pve2: . www/manager www/manager/qemu
svn-commits at proxmox.com
svn-commits at proxmox.com
Thu Jul 14 14:08:50 CEST 2011
Author: dietmar
Date: 2011-07-14 14:08:50 +0200 (Thu, 14 Jul 2011)
New Revision: 6302
Added:
pve-manager/pve2/www/manager/qemu/NotesEdit.js
pve-manager/pve2/www/manager/qemu/NotesView.js
Modified:
pve-manager/pve2/ChangeLog
pve-manager/pve2/www/manager/Makefile.am
pve-manager/pve2/www/manager/Utils.js
pve-manager/pve2/www/manager/qemu/Options.js
pve-manager/pve2/www/manager/qemu/Summary.js
Log:
* www/manager/qemu/NotesEdit.js: Notes editor
* www/manager/qemu/NotesView.js: Notes viewer
* www/manager/Utils.js (API2Request): store decoded result to avoid
decoding twice.
Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog 2011-07-14 10:31:53 UTC (rev 6301)
+++ pve-manager/pve2/ChangeLog 2011-07-14 12:08:50 UTC (rev 6302)
@@ -1,5 +1,12 @@
2011-07-14 Proxmox Support Team <support at proxmox.com>
+ * www/manager/qemu/NotesEdit.js: Notes editor
+
+ * www/manager/qemu/NotesView.js: Notes viewer
+
+ * www/manager/Utils.js (API2Request): store decoded result to avoid
+ decoding twice.
+
* www/manager/window/Edit.js: change alias to
'widget.pveWindowEdit' (I got unexpected side effects when using
'widget.PVE.window.Edit'). Anyway, the new name is better because
Modified: pve-manager/pve2/www/manager/Makefile.am
===================================================================
--- pve-manager/pve2/www/manager/Makefile.am 2011-07-14 10:31:53 UTC (rev 6301)
+++ pve-manager/pve2/www/manager/Makefile.am 2011-07-14 12:08:50 UTC (rev 6302)
@@ -69,6 +69,8 @@
qemu/CDEdit.js \
qemu/HDEdit.js \
qemu/DisplayEdit.js \
+ qemu/NotesEdit.js \
+ qemu/NotesView.js \
qemu/KeyboardEdit.js \
qemu/HardwareView.js \
qemu/Options.js \
Modified: pve-manager/pve2/www/manager/Utils.js
===================================================================
--- pve-manager/pve2/www/manager/Utils.js 2011-07-14 10:31:53 UTC (rev 6301)
+++ pve-manager/pve2/www/manager/Utils.js 2011-07-14 12:08:50 UTC (rev 6302)
@@ -249,6 +249,7 @@
options.success = function(response, options) {
var result = Ext.decode(response.responseText);
+ response.result = result;
if (!result.success) {
response.htmlStatus = PVE.Utils.extractRequestError(result, true);
Ext.callback(callbackFn, options.scope, [options, false, response]);
Added: pve-manager/pve2/www/manager/qemu/NotesEdit.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/NotesEdit.js (rev 0)
+++ pve-manager/pve2/www/manager/qemu/NotesEdit.js 2011-07-14 12:08:50 UTC (rev 6302)
@@ -0,0 +1,24 @@
+Ext.define('PVE.qemu.NotesEdit', {
+ extend: 'PVE.window.Edit',
+
+ initComponent : function() {
+ var me = this;
+
+ Ext.apply(me, {
+ title: "Notes",
+ width: 600,
+ layout: 'fit',
+ items: {
+ xtype: 'textarea',
+ name: 'description',
+ rows: 7,
+ value: '',
+ hideLabel: true
+ }
+ });
+
+ me.callParent();
+
+ me.load();
+ }
+});
Added: pve-manager/pve2/www/manager/qemu/NotesView.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/NotesView.js (rev 0)
+++ pve-manager/pve2/www/manager/qemu/NotesView.js 2011-07-14 12:08:50 UTC (rev 6302)
@@ -0,0 +1,55 @@
+Ext.define('PVE.qemu.NotesView', {
+ extend: 'Ext.panel.Panel',
+
+ load: function() {
+ var me = this;
+
+ PVE.Utils.API2Request({
+ url: me.url,
+ failure: function(response, opts) {
+ me.update("Error " + response.htmlStatus);
+ },
+ success: function(response, opts) {
+ var data = response.result.data.description || '';
+ me.update(Ext.htmlEncode(data));
+ }
+ });
+ },
+
+ initComponent : function() {
+ var me = this;
+
+ var nodename = me.pveSelNode.data.node;
+ if (!nodename) {
+ throw "no node name specified";
+ }
+
+ var vmid = me.pveSelNode.data.vmid;
+ if (!vmid) {
+ throw "no VM ID specified";
+ }
+
+ Ext.apply(me, {
+ title: "Notes",
+ url: '/api2/extjs/nodes/' + nodename + '/qemu/' + vmid + '/config',
+ style: 'padding-left:10px',
+ bodyStyle: 'white-space:pre',
+ bodyPadding: 10,
+ autoScroll: true,
+ listeners: {
+ render: function(c) {
+ c.el.on('dblclick', function() {
+ var win = Ext.create('PVE.qemu.NotesEdit', {
+ pveSelNode: me.pveSelNode,
+ url: me.url
+ });
+ win.show();
+ win.on('destroy', me.load, me);
+ })
+ }
+ }
+ });
+
+ me.callParent();
+ }
+});
Modified: pve-manager/pve2/www/manager/qemu/Options.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Options.js 2011-07-14 10:31:53 UTC (rev 6301)
+++ pve-manager/pve2/www/manager/qemu/Options.js 2011-07-14 12:08:50 UTC (rev 6302)
@@ -143,18 +143,7 @@
metaData.style = 'white-space:pre;';
return Ext.htmlEncode(value);
},
- editor: {
- xtype: 'pveWindowEdit',
- title: 'Notes',
- width: 600,
- layout: 'fit',
- items: {
- xtype: 'textarea',
- name: 'description',
- rows: 10,
- hideLabel: true
- }
- }
+ editor: 'PVE.qemu.NotesEdit',
}
};
Modified: pve-manager/pve2/www/manager/qemu/Summary.js
===================================================================
--- pve-manager/pve2/www/manager/qemu/Summary.js 2011-07-14 10:31:53 UTC (rev 6301)
+++ pve-manager/pve2/www/manager/qemu/Summary.js 2011-07-14 12:08:50 UTC (rev 6302)
@@ -133,8 +133,8 @@
});
me.mon(rstore, 'load', function(s, records, success) {
- var statusrec = s.data.get('status');
- var status = statusrec ? statusrec.data.value : 'unknown';
+ var rec = s.data.get('status');
+ var status = rec ? rec.data.value : 'unknown';
tbar.down('#start').setDisabled(status === 'running');
tbar.down('#reset').setDisabled(status !== 'running');
@@ -144,6 +144,11 @@
tbar.down('#remove').setDisabled(status !== 'stopped');
});
+ var notesview = Ext.create('PVE.qemu.NotesView', {
+ pveSelNode: me.pveSelNode,
+ flex: 1
+ });
+
Ext.apply(me, {
tbar: tbar,
autoScroll: true,
@@ -160,18 +165,7 @@
align: 'stretchmax'
},
border: false,
- items: [
- statusview,
- {
- title: 'Notes',
- style: 'padding-left:10px',
- bodyPadding: 10,
- pveSelNode: me.pveSelNode,
- rstore: rstore,
- html: "test",
- width: 400
- }
- ]
+ items: [ statusview, notesview ]
},
{
xtype: 'pveRRDView',
@@ -204,7 +198,11 @@
]
});
- me.on('show', rstore.startUpdate);
+ me.on('show', function() {
+ rstore.startUpdate();
+ notesview.load();
+ });
+
me.on('hide', rstore.stopUpdate);
me.on('destroy', rstore.stopUpdate);
More information about the pve-devel
mailing list