[pve-devel] [PATCH manager v2 2/5] dc/Cluster: allow cluster create over WebUI

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 4 14:36:44 CEST 2018


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

changes v1 -> v2:
* add 'allowBlank: false' to cluster name field, it's required by the API
  (Dominik)

 www/manager6/Makefile          |  1 +
 www/manager6/dc/Cluster.js     | 23 +++++++++++++++++++++++
 www/manager6/dc/ClusterEdit.js | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 www/manager6/dc/ClusterEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 0796aa2c..6daa259f 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -194,6 +194,7 @@ JSSRC= 				                 	\
 	dc/Config.js					\
 	dc/NodeView.js					\
 	dc/Cluster.js					\
+	dc/ClusterEdit.js				\
 	Workspace.js
 
 lint: ${JSSRC}
diff --git a/www/manager6/dc/Cluster.js b/www/manager6/dc/Cluster.js
index 10e25bf0..c38a2da5 100644
--- a/www/manager6/dc/Cluster.js
+++ b/www/manager6/dc/Cluster.js
@@ -90,7 +90,30 @@ Ext.define('PVE.ClusterAdministration', {
 			fp: nodeinfo.pve_fp
 		    });
 		},
+
+		onCreate: function() {
+		    var view = this.getView();
+		    view.store.stopUpdate();
+		    var win = Ext.create('PVE.ClusterCreateWindow', {
+			autoShow: true,
+			listeners: {
+			    destroy: function() {
+				view.store.startUpdate();
+			    }
+			}
+		    });
+		}
 	    },
+	    tbar: [
+		{
+		    text: gettext('Create Cluster'),
+		    reference: 'createButton',
+		    handler: 'onCreate',
+		    bind: {
+			disabled: '{isInCluster}'
+		    }
+		}
+	    ],
 	    layout: 'hbox',
 	    bodyPadding: 5,
 	    items: [
diff --git a/www/manager6/dc/ClusterEdit.js b/www/manager6/dc/ClusterEdit.js
new file mode 100644
index 00000000..cef35f7c
--- /dev/null
+++ b/www/manager6/dc/ClusterEdit.js
@@ -0,0 +1,32 @@
+/*jslint confusion: true*/
+Ext.define('PVE.ClusterCreateWindow', {
+    extend: 'Proxmox.window.Edit',
+    xtype: 'pveClusterCreateWindow',
+
+    title: gettext('Create Cluster'),
+    width: 600,
+
+    method: 'POST',
+    url: '/cluster/config',
+
+    isCreate: true,
+    subject: gettext('Cluster'),
+    showTaskViewer: true,
+
+    items: [
+	{
+	    xtype: 'textfield',
+	    fieldLabel: gettext('Cluster Name'),
+	    allowBlank: false,
+	    name: 'clustername'
+	},
+	{
+	    xtype: 'proxmoxtextfield',
+	    fieldLabel: gettext('Ring 0 Address'),
+	    emptyText: gettext("Optional, defaults to IP resolved by node's hostname"),
+	    name: 'ring0_addr',
+	    skipEmptyText: true
+	}
+	// TODO: for advanced options: ring1_addr
+    ]
+});
-- 
2.14.2





More information about the pve-devel mailing list