[pve-devel] r6357 - in pve-manager/pve2: . bin www/manager/storage

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Jul 22 13:48:41 CEST 2011


Author: dietmar
Date: 2011-07-22 13:48:40 +0200 (Fri, 22 Jul 2011)
New Revision: 6357

Modified:
   pve-manager/pve2/ChangeLog
   pve-manager/pve2/bin/pvesh
   pve-manager/pve2/www/manager/storage/NFSEdit.js
Log:
	* www/manager/storage/NFSEdit.js: impl. PVE.storage.NFSScan

	* bin/pvesh (check_proxyto): check that we execute on local node
	(proxy not implemented)



Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog	2011-07-22 09:09:40 UTC (rev 6356)
+++ pve-manager/pve2/ChangeLog	2011-07-22 11:48:40 UTC (rev 6357)
@@ -1,5 +1,10 @@
 2011-07-22  Proxmox Support Team  <support at proxmox.com>
 
+	* www/manager/storage/NFSEdit.js: impl. PVE.storage.NFSScan
+
+	* bin/pvesh (check_proxyto): check that we execute on local node
+	(proxy not implemented)
+
 	* www/manager/Utils.js: overwrite ComboBox.onLoad to fix ExtJS
 	bug.
 

Modified: pve-manager/pve2/bin/pvesh
===================================================================
--- pve-manager/pve2/bin/pvesh	2011-07-22 09:09:40 UTC (rev 6356)
+++ pve-manager/pve2/bin/pvesh	2011-07-22 11:48:40 UTC (rev 6357)
@@ -194,6 +194,19 @@
     return $method;
 }
 
+sub check_proxyto {
+    my ($info, $uri_param) = @_;
+
+    if ($info->{proxyto}) {
+	my $pn = $info->{proxyto};
+	my $node = $uri_param->{$pn};
+
+	if ($node ne 'localhost' && ($node ne PVE::INotify::nodename())) {
+	    die "can't proxy to remote node - not implemented";
+	}
+    }
+}
+
 sub call_method {
     my ($dir, $cmd, $args) = @_;
 
@@ -205,6 +218,8 @@
 	die "no '$cmd' handler for '$dir'\n";
     }
 
+    check_proxyto($info, $uri_param);
+
     my $data = $handler->cli_handler2("$cmd $dir", $info->{name}, $args, [], $uri_param, $read_password);
 
     warn "200 OK\n"; # always print OK status if successful
@@ -357,6 +372,8 @@
 	die "no such resource\n";
     }
 
+    check_proxyto($info, $uri_param);
+
     if (!PVE::JSONSchema::method_get_child_link($info)) {
 	die "resource does not define child links\n";
     }

Modified: pve-manager/pve2/www/manager/storage/NFSEdit.js
===================================================================
--- pve-manager/pve2/www/manager/storage/NFSEdit.js	2011-07-22 09:09:40 UTC (rev 6356)
+++ pve-manager/pve2/www/manager/storage/NFSEdit.js	2011-07-22 11:48:40 UTC (rev 6357)
@@ -1,3 +1,56 @@
+Ext.define('PVE.storage.NFSScan', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: 'widget.pveNFSScan',
+
+    queryParam: 'server',
+
+    doRawQuery: function() {
+    },
+
+    onTriggerClick: function() {
+	var me = this;
+
+	if (!me.queryCaching || me.lastQuery !== me.nfsServer) {
+	    me.store.removeAll();
+	}
+
+	me.allQuery = me.nfsServer;
+
+	me.callParent();
+    },
+
+    setServer: function(server) {
+	var me = this;
+
+	me.nfsServer = server;
+    },
+
+    initComponent : function() {
+	var me = this;
+
+	if (!me.nodename) {
+	    me.nodename = 'localhost';
+	}
+
+	var store = Ext.create('Ext.data.Store', {
+	    fields: [ 'path', 'options' ],
+	    proxy: {
+		type: 'pve',
+		url: '/api2/json/nodes/' + me.nodename + '/scan/nfs'
+	    }
+	    //filterOnLoad: true
+	});
+
+	Ext.apply(me, {
+	    store: store,
+	    valueField: 'path',
+	    displayField: 'path'
+	});
+
+	me.callParent();
+    }
+});
+
 Ext.define('PVE.storage.NFSInputPanel', {
     extend: 'PVE.panel.InputPanel',
 
@@ -36,10 +89,19 @@
 		name: 'server',
 		value: '',
 		fieldLabel: 'Server',
-		allowBlank: false
+		allowBlank: false,
+		listeners: {
+		    change: function(f, value) {
+			if (me.create) {
+			    var exportField = me.down('field[name=export]');
+			    exportField.setServer(value);
+			    exportField.setValue('');
+			}
+		    }
+		}
 	    },
 	    {
-		xtype: me.create ? 'textfield' : 'displayfield',
+		xtype: me.create ? 'pveNFSScan' : 'displayfield',
 		height: 22, // hack: set same height as text fields
 		name: 'export',
 		value: '',




More information about the pve-devel mailing list