From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 6/6] ui: cluster backup: use cluster-wide storage selector
Date: Mon, 6 Sep 2021 13:32:31 +0200 [thread overview]
Message-ID: <20210906113231.61790-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210906113231.61790-1-f.ebner@proxmox.com>
adapted from the existing storage selector.
Previously, only the storages for the local node would be shown, which
prevented configuring a job for remote nodes when the storage is not
available on the local node.
In contrast to the existing storage selector, no usage information is
displayed. It's not readily available, and while it could be extracted
from the global resource store, that's a bit messy, and in case a
local storage is available on multiple nodes, there are multiple
values to deal with. Instead, show the list of nodes where the storage
is available and whether it is shared, which is relevant when seen
from a cluster perspective.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
www/manager6/Makefile | 1 +
www/manager6/dc/Backup.js | 5 +-
www/manager6/form/ClusterStorageSelector.js | 96 +++++++++++++++++++++
3 files changed, 99 insertions(+), 3 deletions(-)
create mode 100644 www/manager6/form/ClusterStorageSelector.js
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 3f81d9c4..17d30177 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -26,6 +26,7 @@ JSSRC= \
form/CacheTypeSelector.js \
form/CalendarEvent.js \
form/CephPoolSelector.js \
+ form/ClusterStorageSelector.js \
form/CompressionSelector.js \
form/ContentTypeSelector.js \
form/ControllerSelector.js \
diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 68f67811..7d4db0f0 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -54,9 +54,8 @@ Ext.define('PVE.dc.BackupEdit', {
},
});
- let storagesel = Ext.create('PVE.form.StorageSelector', {
+ let storagesel = Ext.create('PVE.form.ClusterStorageSelector', {
fieldLabel: gettext('Storage'),
- nodename: 'localhost',
storageContent: 'backup',
allowBlank: false,
name: 'storage',
@@ -159,7 +158,7 @@ Ext.define('PVE.dc.BackupEdit', {
emptyText: '-- ' + gettext('All') + ' --',
listeners: {
change: function(f, value) {
- storagesel.setNodename(value || 'localhost');
+ storagesel.setNodename(value);
let mode = selModeField.getValue();
store.clearFilter();
store.filterBy(function(rec) {
diff --git a/www/manager6/form/ClusterStorageSelector.js b/www/manager6/form/ClusterStorageSelector.js
new file mode 100644
index 00000000..8207549c
--- /dev/null
+++ b/www/manager6/form/ClusterStorageSelector.js
@@ -0,0 +1,96 @@
+Ext.define('PVE.form.ClusterStorageSelector', {
+ extend: 'Proxmox.form.ComboGrid',
+ alias: 'widget.pveClusterStorageSelector',
+
+ allowBlank: false,
+ valueField: 'storage',
+ displayField: 'storage',
+
+ listConfig: {
+ width: 450,
+ columns: [
+ {
+ header: gettext('Name'),
+ dataIndex: 'storage',
+ hideable: false,
+ flex: 1,
+ },
+ {
+ header: gettext('Type'),
+ width: 140,
+ dataIndex: 'type',
+ renderer: PVE.Utils.format_storage_type,
+ },
+ {
+ header: gettext('Nodes'),
+ width: 120,
+ dataIndex: 'nodes',
+ renderer: (value) => value ? value : '-- ' + gettext('All') + ' --',
+ },
+ {
+ header: gettext('Shared'),
+ width: 70,
+ dataIndex: 'shared',
+ renderer: Proxmox.Utils.format_boolean,
+ },
+ ],
+ },
+
+ store: {
+ xclass: 'Ext.data.Store',
+ model: 'pve-cluster-storage',
+ proxy: {
+ type: 'proxmox',
+ url: `/api2/json/storage`,
+ },
+ sorters: [{
+ property: 'storage',
+ order: 'DESC',
+ }],
+ autoLoad: true,
+ },
+
+ updateFilters: function() {
+ let me = this;
+
+ let filters = [
+ (storage) => !storage.data.disable,
+ ];
+
+ if (me.storageContent) {
+ filters.push(
+ (storage) => storage.data.content.split(',').includes(me.storageContent),
+ );
+ }
+
+ if (me.nodename) {
+ filters.push(
+ (storage) => !storage.data.nodes || storage.data.nodes.includes(me.nodename),
+ );
+ }
+
+ me.getStore().clearFilter();
+ me.getStore().setFilters(filters);
+ },
+
+ setNodename: function(nodename) {
+ let me = this;
+
+ me.nodename = nodename;
+ me.updateFilters();
+ me.validate();
+ },
+
+ listeners: {
+ beforerender: function() {
+ let me = this;
+ me.updateFilters();
+ },
+ },
+}, function() {
+ Ext.define('pve-cluster-storage', {
+ extend: 'Ext.data.Model',
+ fields: ['storage', 'type', 'nodes', 'shared'],
+ idProperty: 'storage',
+ });
+});
--
2.30.2
next prev parent reply other threads:[~2021-09-06 11:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-06 11:32 [pve-devel] [PATCH-SERIES manager] ui: some backup job improvements Fabian Ebner
2021-09-06 11:32 ` [pve-devel] [PATCH manager 1/6] ui: cluster backup: fix running backup with prune settings Fabian Ebner
2021-09-08 10:59 ` [pve-devel] applied: " Thomas Lamprecht
2021-09-06 11:32 ` [pve-devel] [PATCH manager 2/6] ui: factor out input panel for editing " Fabian Ebner
2021-09-08 11:01 ` [pve-devel] applied: " Thomas Lamprecht
2021-09-06 11:32 ` [pve-devel] [PATCH manager 3/6] ui: prune edit: prepare for being re-used for backup jobs Fabian Ebner
2021-09-08 11:01 ` [pve-devel] applied: " Thomas Lamprecht
2021-09-06 11:32 ` [pve-devel] [PATCH manager 4/6] fix #1803: ui: cluster backup: handle job-specific retention options Fabian Ebner
2021-09-08 11:01 ` [pve-devel] applied: " Thomas Lamprecht
2021-09-06 11:32 ` [pve-devel] [PATCH manager 5/6] ui: backup job detail: also show retention settings Fabian Ebner
2021-09-08 11:04 ` Thomas Lamprecht
2021-09-08 14:15 ` [pve-devel] applied: " Thomas Lamprecht
2021-09-06 11:32 ` Fabian Ebner [this message]
2021-09-08 11:06 ` [pve-devel] [PATCH manager 6/6] ui: cluster backup: use cluster-wide storage selector Thomas Lamprecht
2021-09-09 6:56 ` Fabian Ebner
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=20210906113231.61790-7-f.ebner@proxmox.com \
--to=f.ebner@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