ui: cluster join: hide all fields in assited mode until we got some info

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-08 13:33:06 +02:00
parent 4081db0708
commit 7788262afb

View File

@ -147,7 +147,8 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
fp: '', fp: '',
ip: '', ip: '',
clusterName: '' clusterName: ''
} },
hasAssistedInfo: false,
}, },
formulas: { formulas: {
submittxt: function(get) { submittxt: function(get) {
@ -157,6 +158,10 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
} }
return gettext('Join'); return gettext('Join');
}, },
showClusterFields: (get) => {
let manualMode = !get('assistedEntry.checked');
return get('hasAssistedInfo') || manualMode;
},
}, },
}, },
@ -197,10 +202,10 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
let vm = this.getViewModel(); let vm = this.getViewModel();
let assistedEntryBox = this.lookup('assistedEntry'); let assistedEntryBox = this.lookup('assistedEntry');
let linkEditorContainer = this.lookup('linkEditorContainer');
if (!assistedEntryBox.getValue()) { if (!assistedEntryBox.getValue()) {
// not in assisted entry mode, nothing to do // not in assisted entry mode, nothing to do
vm.set('hasAssistedInfo', false);
return; return;
} }
@ -219,7 +224,7 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
field.valid = false; field.valid = false;
linkEditor.setLinks([]); linkEditor.setLinks([]);
linkEditor.setInfoText(); linkEditor.setInfoText();
linkEditorContainer.setVisible(false); vm.set('hasAssistedInfo', false);
} else { } else {
let interfaces = joinInfo.totem.interface; let interfaces = joinInfo.totem.interface;
let links = Object.values(interfaces).map(iface => { let links = Object.values(interfaces).map(iface => {
@ -252,7 +257,7 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
clusterName: joinInfo.totem.cluster_name clusterName: joinInfo.totem.cluster_name
}; };
field.valid = true; field.valid = true;
linkEditorContainer.setVisible(true); vm.set('hasAssistedInfo', true);
} }
vm.set('info', info); vm.set('info', info);
} }
@ -320,6 +325,9 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
type: 'hbox', type: 'hbox',
align: 'center' align: 'center'
}, },
bind: {
hidden: '{!showClusterFields}',
},
items: [ items: [
{ {
xtype: 'textfield', xtype: 'textfield',
@ -351,7 +359,8 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
allowBlank: false, allowBlank: false,
bind: { bind: {
value: '{info.fp}', value: '{info.fp}',
readOnly: '{assistedEntry.checked}' readOnly: '{assistedEntry.checked}',
hidden: '{!showClusterFields}',
}, },
name: 'fingerprint' name: 'fingerprint'
}, },
@ -359,9 +368,8 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
xtype: 'fieldcontainer', xtype: 'fieldcontainer',
fieldLabel: gettext("Cluster Network"), fieldLabel: gettext("Cluster Network"),
bind: { bind: {
hidden: '{assistedEntry.checked}' hidden: '{!showClusterFields}',
}, },
reference: 'linkEditorContainer',
items: [ items: [
{ {
xtype: 'pveCorosyncLinkEditor', xtype: 'pveCorosyncLinkEditor',