all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] ui: datastore: add tuning options to gui
Date: Mon, 28 Nov 2022 11:13:06 +0100	[thread overview]
Message-ID: <20221128101306.1501307-1-d.csapak@proxmox.com> (raw)

in datastore -> options
a simple edit window with 2 comboboxes for
* sync-level
* chunk-order

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/storage.rst            |  2 ++
 www/OnlineHelpInfo.js       |  4 +++
 www/Utils.js                | 33 +++++++++++++++++++++
 www/datastore/OptionView.js | 57 +++++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+)

diff --git a/docs/storage.rst b/docs/storage.rst
index d61c3a40..07c3ad8e 100644
--- a/docs/storage.rst
+++ b/docs/storage.rst
@@ -316,6 +316,8 @@ There are a few per-datastore options:
 * :ref:`Maintenance Mode <maintenance_mode>`
 * Verification of incoming backups
 
+.. _datastore_tuning_options:
+
 Tuning
 ^^^^^^
 There are some tuning related options for the datastore that are more advanced
diff --git a/www/OnlineHelpInfo.js b/www/OnlineHelpInfo.js
index cc00b658..5561f275 100644
--- a/www/OnlineHelpInfo.js
+++ b/www/OnlineHelpInfo.js
@@ -143,6 +143,10 @@ const proxmoxOnlineHelpInfo = {
     "link": "/docs/storage.html#storage-namespaces",
     "title": "Backup Namespaces"
   },
+  "datastore-tuning-options": {
+    "link": "/docs/storage.html#datastore-tuning-options",
+    "title": "Tuning"
+  },
   "sysadmin-host-administration": {
     "link": "/docs/sysadmin.html#sysadmin-host-administration",
     "title": "Host System Administration"
diff --git a/www/Utils.js b/www/Utils.js
index f6d353ef..298ad084 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -709,4 +709,37 @@ Ext.define('PBS.Utils', {
 	return Ext.String.htmlEncode(value);
     },
 
+    tuningOptions: {
+	'chunk-order': {
+	    '__default__': Proxmox.Utils.defaultText + ` (${gettext('None')})`,
+	    none: gettext('None'),
+	    inode: gettext('Inode'),
+	},
+	'sync-level': {
+	    '__default__': Proxmox.Utils.defaultText + ` (${gettext('Filesystem')})`,
+	    none: gettext('None'),
+	    file: gettext('File'),
+	    filesystem: gettext('Filesystem'),
+	},
+    },
+
+    render_tuning_options: function(tuning) {
+	let options = [];
+	let order = tuning['chunk-order'];
+	delete tuning['chunk-order'];
+	order = PBS.Utils.tuningOptions['chunk-order'][order ?? '__default__'];
+	options.push(`${gettext('Chunk Order')}: ${order}`);
+
+	let sync = tuning['sync-level'];
+	delete tuning['sync-level'];
+	sync = PBS.Utils.tuningOptions['sync-level'][sync ?? '__default__'];
+	options.push(`${gettext('Sync Level')}: ${sync}`);
+
+	for (const [k, v] of Object.entries(tuning)) {
+	    options.push(`${k}: ${v}`);
+	}
+
+	return options.join(', ');
+    },
+
 });
diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js
index eb335979..e9c8ea36 100644
--- a/www/datastore/OptionView.js
+++ b/www/datastore/OptionView.js
@@ -157,5 +157,62 @@ Ext.define('PBS.Datastore.Options', {
 		xtype: 'pbsMaintenanceOptionEdit',
 	    },
 	},
+	'tuning': {
+	    required: true,
+	    header: gettext('Tuning Options'),
+	    renderer: function(value) {
+		let tuning = PBS.Utils.parsePropertyString(value);
+		return PBS.Utils.render_tuning_options(tuning);
+	    },
+	    editor: {
+		xtype: 'proxmoxWindowEdit',
+		title: gettext('Tuning Options'),
+		onlineHelp: 'datastore_tuning_options',
+		width: 350,
+		items: {
+		    xtype: 'inputpanel',
+		    onGetValues: function(values) {
+			if (!Ext.isArray(values.delete ?? [])) {
+			    values.delete = [values.delete];
+			}
+			for (const k of values.delete ?? []) {
+			    delete values[k];
+			}
+			delete values.delete;
+			let tuning = PBS.Utils.printPropertyString(values);
+			if (!tuning) {
+			    return {
+				'delete': 'tuning',
+			    };
+			}
+			return {
+			    tuning,
+			};
+		    },
+		    setValues: function(values) {
+			values = PBS.Utils.parsePropertyString(values?.tuning);
+			return Proxmox.panel.InputPanel.prototype.setValues.call(this, values);
+		    },
+		    items: [
+			{
+			    xtype: 'proxmoxKVComboBox',
+			    name: 'chunk-order',
+			    fieldLabel: gettext('Chunk Order'),
+			    comboItems: Object.entries(PBS.Utils.tuningOptions['chunk-order']),
+			    deleteEmpty: true,
+			    value: '__default__',
+			},
+			{
+			    xtype: 'proxmoxKVComboBox',
+			    name: 'sync-level',
+			    fieldLabel: gettext('Sync Level'),
+			    comboItems: Object.entries(PBS.Utils.tuningOptions['sync-level']),
+			    deleteEmpty: true,
+			    value: '__default__',
+			},
+		    ],
+		},
+	    },
+	},
     },
 });
-- 
2.30.2





             reply	other threads:[~2022-11-28 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28 10:13 Dominik Csapak [this message]
2022-11-28 13:18 ` [pbs-devel] applied: " 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=20221128101306.1501307-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-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