[pve-devel] [PATCH manager 3/5] dc/Cluster: allow to get join information
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Apr 3 10:44:03 CEST 2018
Am 04/03/2018 um 10:16 AM schrieb Dominik Csapak:
> i guess it would be good to make this window non-resizable
> because the fields do not really resize well
>
OK.
> otherwise looks good
>
> On 03/27/2018 03:45 PM, Thomas Lamprecht wrote:
>> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
>> ---
>> www/manager6/dc/Cluster.js | 20 +++++++++++
>> www/manager6/dc/ClusterEdit.js | 76
>> ++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 96 insertions(+)
>>
>> diff --git a/www/manager6/dc/Cluster.js b/www/manager6/dc/Cluster.js
>> index 97f7496d..ca43c8f9 100644
>> --- a/www/manager6/dc/Cluster.js
>> +++ b/www/manager6/dc/Cluster.js
>> @@ -101,6 +101,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: [
>> @@ -111,6 +123,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 0c44ec44..249801c3 100644
>> --- a/www/manager6/dc/ClusterEdit.js
>> +++ b/www/manager6/dc/ClusterEdit.js
>> @@ -29,3 +29,79 @@ 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,
>> + 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')
>> + }]
>> + }]
>> +});
More information about the pve-devel
mailing list