[pve-devel] [PATCH manager v2 2/3] gui: content view: Add checkbox for recursive search

Dominic Jäger d.jaeger at proxmox.com
Tue May 19 11:58:17 CEST 2020


Default is no recursion.
This commit depends on "Recursive search for iso and vztmpl" in pve-storage.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
v2: Dominik's Feedback
 - Use helper function for url => No more strange casts
 - Template string
 - Better separation of patches

 www/manager6/storage/ContentView.js | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index 001efc7f..526a8dee 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -379,12 +379,20 @@ Ext.define('PVE.storage.ContentView', {
 	}
 
 	var baseurl = "/nodes/" + nodename + "/storage/" + storage + "/content";
+
+	let get_proxy_url = function(recursive = false) {
+	    let url = `/api2/json${baseurl}`;
+	    if (recursive) {
+		url += `?recursive=1`;
+	    }
+	    return url;
+	};
 	var store = Ext.create('Ext.data.Store',{
 	    model: 'pve-storage-content',
 	    groupField: 'content',
 	    proxy: {
                 type: 'proxmox',
-		url: '/api2/json' + baseurl
+		url: get_proxy_url(),
 	    },
 	    sorters: {
 		property: 'volid',
@@ -578,7 +586,20 @@ Ext.define('PVE.storage.ContentView', {
 			    ]);
 			}
 		    }
-		}
+		},
+		{
+		    xtype: 'proxmoxcheckbox',
+		    fieldLabel: gettext('Recursive'),
+		    labelWidth: 65,
+		    name: 'recursive',
+		    checked: false,
+		    listeners: {
+			change: function(box, newValue) {
+			    me.store.proxy.url = get_proxy_url(newValue);
+			    reload();
+			},
+		    },
+		},
 	    ],
 	    columns: [
 		{
-- 
2.20.1




More information about the pve-devel mailing list