This patch implements the UI components for the hidden storage feature:
  - Add hidden checkbox to iSCSI storage edit dialog
  - Filter hidden storages from resource tree display
  - Include hidden property in storage API response
  - Show hidden status in storage management view

  This is part 2 of 2 patches that together implement hidden storage
  support for iSCSI. This patch depends on the storage plugin changes
  submitted to pve-storage.

  Depends-on: [PATCH pve-storage v1 1/2] iscsi: add hidden option to hide 
storage from UI

  Signed-off-by: Nansen Su

---
 PVE/API2Tools.pm                  |  1 +
 www/manager6/dc/StorageView.js    |  7 +++++++
 www/manager6/storage/IScsiEdit.js | 10 ++++++++++
 www/manager6/tree/ResourceTree.js |  4 ++++
 4 files changed, 22 insertions(+)

diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
index d6154925..6a82c800 100644
--- a/PVE/API2Tools.pm
+++ b/PVE/API2Tools.pm
@@ -149,6 +149,7 @@ sub extract_storage_stats {
         status => 'unknown',
         shared => $scfg->{shared} || 0,
         content => $content,
+        hidden => $scfg->{hidden} || 0,
     };
 
     if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
diff --git a/www/manager6/dc/StorageView.js b/www/manager6/dc/StorageView.js
index e4c6f07d..93e5ffec 100644
--- a/www/manager6/dc/StorageView.js
+++ b/www/manager6/dc/StorageView.js
@@ -154,6 +154,13 @@ Ext.define(
                         sortable: true,
                         dataIndex: 'bwlimit',
                     },
+                    {
+                        header: gettext('Hidden'),
+                        flex: 1,
+                        sortable: true,
+                        dataIndex: 'hidden',
+                        renderer: Proxmox.Utils.format_boolean,
+                    },
                 ],
                 listeners: {
                     activate: () => store.load(),
diff --git a/www/manager6/storage/IScsiEdit.js 
b/www/manager6/storage/IScsiEdit.js
index cd474f7d..283aec09 100644
--- a/www/manager6/storage/IScsiEdit.js
+++ b/www/manager6/storage/IScsiEdit.js
@@ -145,5 +145,15 @@ Ext.define('PVE.storage.IScsiInputPanel', {
             checked: true,
             fieldLabel: gettext('Use LUNs directly'),
         },
+        {
+            xtype: 'checkbox',
+            name: 'hidden',
+            uncheckedValue: 0,
+            fieldLabel: gettext('Hide in UI'),
+            autoEl: {
+                tag: 'div',
+                'data-qtip': gettext('Hide this storage from the resource 
tree'),
+            },
+        },
     ],
 });
diff --git a/www/manager6/tree/ResourceTree.js 
b/www/manager6/tree/ResourceTree.js
index 58611aa3..d9ec67e5 100644
--- a/www/manager6/tree/ResourceTree.js
+++ b/www/manager6/tree/ResourceTree.js
@@ -425,6 +425,10 @@ Ext.define('PVE.tree.ResourceTree', {
                 if (filterFn && !filterFn(item)) {
                     return;
                 }
+                // skip hidden storage
+                if (item.data.type === 'storage' && item.data.hidden) {
+                    return;
+                }
                 let info = Ext.apply({ leaf: true }, item.data);
 
                 let child = me.groupChild(rootnode, info, groups, 0);
-- 
2.50.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to