[pve-devel] [PATCH manager v2 3/5] dc/Cluster: allow to get join information

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


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

changes v1 -> v2:
* no need for join info window to be resizable (Dominik)

 www/manager6/dc/Cluster.js     | 20 +++++++++++
 www/manager6/dc/ClusterEdit.js | 77 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)

diff --git a/www/manager6/dc/Cluster.js b/www/manager6/dc/Cluster.js
index c38a2da5..8e955f76 100644
--- a/www/manager6/dc/Cluster.js
+++ b/www/manager6/dc/Cluster.js
@@ -102,6 +102,18 @@ Ext.define('PVE.ClusterAdministration', {
 			    }
 			}
 		    });
+		},
+
+		onClusterInfo: function() {
+		    var vm = this.getViewModel();
+		    var win = Ext.create('PVE.ClusterInfoWindow', {
+			joinInfo: {
+			    ipAddress: vm.get('preferred_node.addr'),
+			    fingerprint: vm.get('preferred_node.fp'),
+			    totem: vm.get('totem')
+			}
+		    });
+		    win.show();
 		}
 	    },
 	    tbar: [
@@ -112,6 +124,14 @@ Ext.define('PVE.ClusterAdministration', {
 		    bind: {
 			disabled: '{isInCluster}'
 		    }
+		},
+		{
+		    text: gettext('Join Information'),
+		    reference: 'addButton',
+		    handler: 'onClusterInfo',
+		    bind: {
+			disabled: '{!isInCluster}'
+		    }
 		}
 	    ],
 	    layout: 'hbox',
diff --git a/www/manager6/dc/ClusterEdit.js b/www/manager6/dc/ClusterEdit.js
index cef35f7c..8d7843cb 100644
--- a/www/manager6/dc/ClusterEdit.js
+++ b/www/manager6/dc/ClusterEdit.js
@@ -30,3 +30,80 @@ Ext.define('PVE.ClusterCreateWindow', {
 	// TODO: for advanced options: ring1_addr
     ]
 });
+
+Ext.define('PVE.ClusterInfoWindow', {
+    extend: 'Ext.window.Window',
+    xtype: 'pveClusterInfoWindow',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    width: 800,
+    modal: true,
+    resizable: false,
+    title: gettext('Cluster Join Information'),
+
+    joinInfo: {
+	ipAddress: undefined,
+	fingerprint: undefined,
+	totem: {}
+    },
+
+    items: [
+	{
+	    xtype: 'component',
+	    border: false,
+	    padding: '10 10 10 10',
+	    html: gettext("Copy the Join Information here and use it on the node you want to add.")
+	},
+	{
+	    xtype: 'container',
+	    layout: 'form',
+	    border: false,
+	    padding: '0 10 10 10',
+	    items: [
+		{
+		    xtype: 'textfield',
+		    fieldLabel: gettext('IP Address'),
+		    cbind: { value: '{joinInfo.ipAddress}' },
+		    editable: false
+		},
+		{
+		    xtype: 'textfield',
+		    fieldLabel: gettext('Fingerprint'),
+		    cbind: { value: '{joinInfo.fingerprint}' },
+		    editable: false
+		},
+		{
+		    xtype: 'textarea',
+		    inputId: 'pveSerializedClusterInfo',
+		    fieldLabel: gettext('Join Information'),
+		    grow: true,
+		    cbind: { joinInfo: '{joinInfo}' },
+		    editable: false,
+		    listeners: {
+			afterrender: function(field) {
+			    if (!field.joinInfo) {
+				return;
+			    }
+			    var jsons = Ext.JSON.encode(field.joinInfo);
+			    var base64s = Ext.util.Base64.encode(jsons);
+			    field.setValue(base64s);
+			}
+		    }
+		}
+	    ]
+	}
+    ],
+    dockedItems: [{
+	dock: 'bottom',
+	xtype: 'toolbar',
+	items: [{
+	    xtype: 'button',
+	    handler: function(b) {
+		var el = document.getElementById('pveSerializedClusterInfo');
+		el.select();
+		document.execCommand("copy");
+	    },
+	    text: gettext('Copy Information')
+	}]
+    }]
+});
-- 
2.14.2





More information about the pve-devel mailing list