all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2] fix #3994: Options menu entry in the System menu
Date: Fri,  6 May 2022 14:39:10 +0200	[thread overview]
Message-ID: <20220506123910.146775-1-d.tschlatscher@proxmox.com> (raw)

Add the subentry "Options" in the "System" menu to expose some options
in the GUI which were not exposed before.

Added a new file for displaying and editing the node config options
which were not exposed through the GUI yet. Namely those are the
settings for wakeonlan and startall-on-boot-delay. Edited the Makefile
to include the newly created file.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
---
Changes from v2:

- Moved the file from the widget-toolkit to the pve-manager repository
  because it implements PVE specific functionality.
- I originally rewrote this class to use a ViewController, but then
  found out that the ObjectGrid does most of what I wanted already, I
  just had to address it correctly.
  This means the code is now a bit shorter and a lot more concise.

 www/manager6/Makefile                |  1 +
 www/manager6/node/Config.js          |  9 ++++
 www/manager6/node/NodeOptionsView.js | 67 ++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 www/manager6/node/NodeOptionsView.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 2c7b1e70..d16770b1 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -195,6 +195,7 @@ JSSRC= 							\
 	node/Subscription.js				\
 	node/Summary.js					\
 	node/ZFS.js					\
+	node/NodeOptionsView.js				\
 	pool/Config.js					\
 	pool/StatusView.js				\
 	pool/Summary.js					\
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 52357df8..7e7d45f7 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -195,6 +195,15 @@ Ext.define('PVE.node.Config', {
 		    nodename: nodename,
 		    onlineHelp: 'sysadmin_network_configuration',
 		},
+		{
+		    xtype: 'proxmoxNodeOptionsView',
+		    title: gettext('Options'),
+		    iconCls: 'fa fa-gear',
+		    groups: ['services'],
+		    itemId: 'options',
+		    nodename: nodename,
+		    onlineHelp: 'proxmox_node_management',
+		},
 		{
 		    xtype: 'proxmoxNodeHostsView',
 		    title: gettext('Hosts'),
diff --git a/www/manager6/node/NodeOptionsView.js b/www/manager6/node/NodeOptionsView.js
new file mode 100644
index 00000000..b841b7b0
--- /dev/null
+++ b/www/manager6/node/NodeOptionsView.js
@@ -0,0 +1,67 @@
+Ext.define('Proxmox.node.NodeOptionsView', {
+    extend: 'Proxmox.grid.ObjectGrid',
+    alias: ['widget.proxmoxNodeOptionsView'],
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    cbindData: function(_initialconfig) {
+	let me = this;
+
+	let baseUrl = `/nodes/${me.nodename}/config`;
+	me.url = `/api2/json${baseUrl}`;
+	me.editorConfig = {
+	    url: `/api2/extjs/${baseUrl}`,
+	};
+
+	return {};
+    },
+
+    listeners: {
+	itemdblclick: function() { this.run_editor(); },
+	activate: function() { this.rstore.startUpdate(); },
+	destroy: function() { this.rstore.stopUpdate(); },
+	deactivate: function() { this.rstore.stopUpdate(); },
+    },
+
+    tbar: [
+	{
+	    text: gettext('Edit'),
+	    xtype: 'proxmoxButton',
+	    disabled: true,
+	    handler: btn => btn.up('grid').run_editor(),
+	},
+    ],
+
+    gridRows: [
+	{
+	    xtype: 'integer',
+	    name: 'startall-onboot-delay',
+	    text: gettext('Start on boot delay'),
+	    minValue: 0,
+	    maxValue: 300,
+	    labelWidth: 130,
+	    deleteEmpty: true,
+	    renderer: function(value) {
+		if (value === undefined) {
+		    return Proxmox.Utils.defaultText;
+		}
+
+		let secString = value === '1' ? gettext('Second') : gettext('Seconds');
+		return `${value} ${secString}`;
+	    },
+	},
+	{
+	    xtype: 'text',
+	    name: 'wakeonlan',
+	    text: gettext('Wake on LAN'),
+	    vtype: 'MacAddress',
+	    deleteEmpty: true,
+	    renderer: function(value) {
+		if (value === undefined) {
+		    return Proxmox.Utils.NoneText;
+		}
+
+		return value;
+	    },
+	},
+    ],
+});
-- 
2.30.2





             reply	other threads:[~2022-05-06 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 12:39 Daniel Tschlatscher [this message]
2022-05-11 12:27 ` Markus Frank
2022-05-12 15:13 ` [pve-devel] applied: " Thomas Lamprecht
2022-05-13  7:55   ` Daniel Tschlatscher
2022-05-13  8:00     ` Thomas Lamprecht

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=20220506123910.146775-1-d.tschlatscher@proxmox.com \
    --to=d.tschlatscher@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal