[pve-devel] [PATCH manager 2/3] accept type 'node' for NotesView

Dominik Csapak d.csapak at proxmox.com
Tue May 22 17:02:05 CEST 2018


so that we can use it for the notes of a node

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/panel/NotesView.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
index b420d8c8..7923bcc4 100644
--- a/www/manager6/panel/NotesView.js
+++ b/www/manager6/panel/NotesView.js
@@ -31,22 +31,25 @@ Ext.define('PVE.panel.NotesView', {
 	    throw "no node name specified";
 	}
 
+	var type = me.pveSelNode.data.type;
+	if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+	    throw 'invalid type specified';
+	}
+
 	var vmid = me.pveSelNode.data.vmid;
-	if (!vmid) {
+	if (!vmid && type !== 'node') {
 	    throw "no VM ID specified";
 	}
 
-	var vmtype = me.pveSelNode.data.type;
-	var url;
+	me.url = '/api2/extjs/nodes/' + nodename + '/';
 
-	if (vmtype === 'qemu') {
-	    me.url = '/api2/extjs/nodes/' + nodename + '/qemu/' + vmid + '/config';
-	} else if (vmtype === 'lxc') {
-	    me.url = '/api2/extjs/nodes/' + nodename + '/lxc/' + vmid + '/config';
-	} else {
-	    throw "unknown vm type '" + vmtype + "'";
+	// add the type specific path if qemu/lxc
+	if (type === 'qemu' || type === 'lxc') {
+	    me.url += type + '/' + vmid + '/';
 	}
 
+	me.url += 'config';
+
 	Ext.apply(me, {
 	    listeners: {
 		render: function(c) {
-- 
2.11.0





More information about the pve-devel mailing list