public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] dc menu: close 3504: Add datacenter notes
Date: Thu,  8 Jul 2021 13:41:24 +0200	[thread overview]
Message-ID: <20210708114124.161545-2-d.jaeger@proxmox.com> (raw)
In-Reply-To: <20210708114124.161545-1-d.jaeger@proxmox.com>

Like notes for nodes.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
Depends on the pve-cluster patch.

 www/manager6/dc/Config.js       |  6 ++++
 www/manager6/panel/NotesView.js | 49 +++++++++++++++++----------------
 2 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index a8dcb74e..9fb47afa 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -27,6 +27,12 @@ Ext.define('PVE.dc.Config', {
 		iconCls: 'fa fa-book',
 		itemId: 'summary',
 	    },
+	    {
+		xtype: 'pveNotesView',
+		title: gettext('Notes'),
+		iconCls: 'fa fa-sticky-note-o',
+		itemId: 'notes',
+	    },
 	    {
 		title: gettext('Cluster'),
 		xtype: 'pveClusterAdministration',
diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
index b281f892..6e7b55f6 100644
--- a/www/manager6/panel/NotesView.js
+++ b/www/manager6/panel/NotesView.js
@@ -79,37 +79,40 @@ Ext.define('PVE.panel.NotesView', {
     }],
 
     initComponent: function() {
-	var me = this;
+	const me = this;
+	const type = me.pveSelNode.data.type;
 
-	var nodename = me.pveSelNode.data.node;
-	if (!nodename) {
-	    throw "no node name specified";
-	}
+	if (me.pveSelNode.data.id === 'root') {
+	    me.url = '/api2/extjs/cluster/options';
+	} else {
+	    const nodename = me.pveSelNode.data.node;
+	    if (!nodename) {
+		throw "no node name specified";
+	    }
 
-	let type = me.pveSelNode.data.type;
-	if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
-	    throw 'invalid type specified';
-	}
+	    if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+		throw 'invalid type specified';
+	    }
 
-	var vmid = me.pveSelNode.data.vmid;
-	if (!vmid && type !== 'node') {
-	    throw "no VM ID specified";
-	}
+	    const vmid = me.pveSelNode.data.vmid;
+	    if (!vmid && type !== 'node') {
+		throw "no VM ID specified";
+	    }
 
-	me.url = `/api2/extjs/nodes/${nodename}/`;
+	    me.url = `/api2/extjs/nodes/${nodename}/`;
 
-	// add the type specific path if qemu/lxc and set the backend's maxLen
-	if (type === 'qemu' || type === 'lxc') {
-	    me.url += `${type}/${vmid}/`;
-	    me.maxLength = 8 * 1024;
-	} else {
-	    me.maxLength = 64 * 1024;
+	    // add the type specific path if qemu/lxc and set the backend's maxLen
+	    if (type === 'qemu' || type === 'lxc') {
+		me.url += `${type}/${vmid}/`;
+		me.maxLength = 8 * 1024;
+	    } else {
+		me.maxLength = 64 * 1024;
+	    }
+	    me.url += 'config';
 	}
 
-	me.url += 'config';
-
 	me.callParent();
-	if (type === 'node') {
+	if (type === 'node' || type === '') { // is '' for datacenter
 	    me.down('#tbar').setVisible(true);
 	} else if (me.pveSelNode.data.template !== 1) {
 	    me.setCollapsible(true);
-- 
2.30.2





      reply	other threads:[~2021-07-08 11:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 11:41 [pve-devel] [PATCH pve-cluster] dc.cfg: Add notes to datacenter config Dominic Jäger
2021-07-08 11:41 ` Dominic Jäger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210708114124.161545-2-d.jaeger@proxmox.com \
    --to=d.jaeger@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal