-/*jslint confusion: true*/
Ext.define('PVE.ClusterCreateWindow', {
extend: 'Proxmox.window.Edit',
xtype: 'pveClusterCreateWindow',
fieldLabel: gettext('Cluster Name'),
allowBlank: false,
maxLength: 15,
- name: 'clustername'
+ name: 'clustername',
},
{
xtype: 'fieldcontainer',
- fieldLabel: gettext("Cluster Links"),
- style: {
- 'padding-top': '5px',
- },
+ fieldLabel: gettext("Cluster Network"),
items: [
{
xtype: 'pveCorosyncLinkEditor',
- style: {
- 'padding-bottom': '5px',
- },
- name: 'links'
+ infoText: gettext("Multiple links are used as failover, lower numbers have higher priority."),
+ name: 'links',
},
- {
- xtype: 'label',
- text: gettext("Multiple links are used as failover, lower numbers have higher priority.")
- }
- ]
- }]
- }
+ ],
+ }],
+ },
});
Ext.define('PVE.ClusterInfoWindow', {
joinInfo: {
ipAddress: undefined,
fingerprint: undefined,
- totem: {}
+ 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.")
+ html: gettext("Copy the Join Information here and use it on the node you want to add."),
},
{
xtype: 'container',
{
xtype: 'textfield',
fieldLabel: gettext('IP Address'),
- cbind: { value: '{joinInfo.ipAddress}' },
- editable: false
+ cbind: {
+ value: '{joinInfo.ipAddress}',
+ },
+ editable: false,
},
{
xtype: 'textfield',
fieldLabel: gettext('Fingerprint'),
- cbind: { value: '{joinInfo.fingerprint}' },
- editable: false
+ cbind: {
+ value: '{joinInfo.fingerprint}',
+ },
+ editable: false,
},
{
xtype: 'textarea',
inputId: 'pveSerializedClusterInfo',
fieldLabel: gettext('Join Information'),
grow: true,
- cbind: { joinInfo: '{joinInfo}' },
+ cbind: {
+ joinInfo: '{joinInfo}',
+ },
editable: false,
listeners: {
afterrender: function(field) {
var jsons = Ext.JSON.encode(field.joinInfo);
var base64s = Ext.util.Base64.encode(jsons);
field.setValue(base64s);
- }
- }
- }
- ]
- }
+ },
+ },
+ },
+ ],
+ },
],
dockedItems: [{
dock: 'bottom',
el.select();
document.execCommand("copy");
},
- text: gettext('Copy Information')
- }]
- }]
+ text: gettext('Copy Information'),
+ }],
+ }],
});
Ext.define('PVE.ClusterJoinNodeWindow', {
info: {
fp: '',
ip: '',
- clusterName: ''
- }
+ clusterName: '',
+ },
+ hasAssistedInfo: false,
},
formulas: {
submittxt: function(get) {
}
return gettext('Join');
},
+ showClusterFields: (get) => {
+ let manualMode = !get('assistedEntry.checked');
+ return get('hasAssistedInfo') || manualMode;
+ },
},
},
'#': {
close: function() {
delete PVE.Utils.silenceAuthFailures;
- }
+ },
},
'proxmoxcheckbox[name=assistedEntry]': {
- change: 'onInputTypeChange'
+ change: 'onInputTypeChange',
},
'textarea[name=serializedinfo]': {
change: 'recomputeSerializedInfo',
- enable: 'resetField'
+ enable: 'resetField',
},
'textfield': {
- disable: 'resetField'
- }
+ disable: 'resetField',
+ },
},
resetField: function(field) {
field.reset();
let vm = this.getViewModel();
let assistedEntryBox = this.lookup('assistedEntry');
+
if (!assistedEntryBox.getValue()) {
// not in assisted entry mode, nothing to do
+ vm.set('hasAssistedInfo', false);
return;
}
let info = {
fp: '',
ip: '',
- clusterName: ''
+ clusterName: '',
};
if (!(joinInfo && joinInfo.totem)) {
field.valid = false;
linkEditor.setLinks([]);
linkEditor.setInfoText();
+ vm.set('hasAssistedInfo', false);
} else {
let interfaces = joinInfo.totem.interface;
let links = Object.values(interfaces).map(iface => {
+ let linkNumber = iface.linknumber;
+ let peerLink;
+ if (joinInfo.peerLinks) {
+ peerLink = joinInfo.peerLinks[linkNumber];
+ }
return {
- number: iface.linknumber,
+ number: linkNumber,
value: '',
- text: '',
- allowBlank: false
+ text: peerLink ? Ext.String.format(gettext("peer's link address: {0}"), peerLink) : '',
+ allowBlank: false,
};
});
linkEditor.setInfoText();
- if (links.length == 1 && joinInfo.ring_addr !== undefined &&
- joinInfo.ring_addr[0] === joinInfo.ipAddress) {
-
+ if (links.length === 1 && joinInfo.ring_addr !== undefined &&
+ joinInfo.ring_addr[0] === joinInfo.ipAddress
+ ) {
links[0].allowBlank = true;
- linkEditor.setInfoText(gettext("Leave empty to use IP resolved by node's hostname"));
+ links[0].emptyText = gettext("IP resolved by node's hostname");
}
linkEditor.setLinks(links);
info = {
ip: joinInfo.ipAddress,
fp: joinInfo.fingerprint,
- clusterName: joinInfo.totem.cluster_name
+ clusterName: joinInfo.totem.cluster_name,
};
field.valid = true;
+ vm.set('hasAssistedInfo', true);
}
-
vm.set('info', info);
- }
+ },
},
submit: function() {
Ext.defer(function() {
window.location.reload(true);
}, 5000);
- var txt = gettext('Cluster join task finished, node certificate may have changed, reload GUI!');
+ let txt = gettext('Cluster join task finished, node certificate may have changed, reload GUI!');
// ensure user cannot do harm
Ext.getBody().mask(txt, ['pve-static-mask']);
// TaskView may hide above mask, so tell him directly
Ext.Msg.show({
title: gettext('Join Task Finished'),
icon: Ext.Msg.INFO,
- msg: txt
+ msg: txt,
});
}
},
value: true,
autoEl: {
tag: 'div',
- 'data-qtip': gettext('Select if join information should be extracted from pasted cluster information, deselect for manual entering')
+ 'data-qtip': gettext('Select if join information should be extracted from pasted cluster information, deselect for manual entering'),
},
- boxLabel: gettext('Assisted join: Paste encoded cluster join information and enter password.')
+ boxLabel: gettext('Assisted join: Paste encoded cluster join information and enter password.'),
},
{
xtype: 'textarea',
fieldLabel: gettext('Information'),
emptyText: gettext('Paste encoded Cluster Information here'),
validator: function(val) {
- return val === '' || this.valid ||
- gettext('Does not seem like a valid encoded Cluster Information!');
+ return val === '' || this.valid || gettext('Does not seem like a valid encoded Cluster Information!');
},
bind: {
disabled: '{!assistedEntry.checked}',
- hidden: '{!assistedEntry.checked}'
+ hidden: '{!assistedEntry.checked}',
},
- value: ''
+ value: '',
},
{
xtype: 'panel',
width: 776,
layout: {
type: 'hbox',
- align: 'center'
+ align: 'center',
+ },
+ bind: {
+ hidden: '{!showClusterFields}',
},
items: [
{
allowBlank: false,
bind: {
value: '{info.ip}',
- readOnly: '{assistedEntry.checked}'
+ readOnly: '{assistedEntry.checked}',
},
- name: 'hostname'
+ name: 'hostname',
},
{
xtype: 'textfield',
emptyText: gettext("Peer's root password"),
fieldLabel: gettext('Password'),
allowBlank: false,
- name: 'password'
+ name: 'password',
},
- ]
+ ],
},
{
xtype: 'textfield',
allowBlank: false,
bind: {
value: '{info.fp}',
- readOnly: '{assistedEntry.checked}'
+ readOnly: '{assistedEntry.checked}',
+ hidden: '{!showClusterFields}',
},
- name: 'fingerprint'
+ name: 'fingerprint',
},
{
xtype: 'fieldcontainer',
- fieldLabel: gettext("Cluster Links"),
+ fieldLabel: gettext("Cluster Network"),
+ bind: {
+ hidden: '{!showClusterFields}',
+ },
items: [
{
xtype: 'pveCorosyncLinkEditor',
itemId: 'linkEditor',
reference: 'linkEditor',
- allowNumberEdit: false
+ allowNumberEdit: false,
},
- ]
- }]
+ ],
+ }],
});