]> git.proxmox.com Git - pve-manager.git/blobdiff - www/manager6/dc/ClusterEdit.js
ui: eslint: fix trailing comma and comma related whitespaces errors
[pve-manager.git] / www / manager6 / dc / ClusterEdit.js
index fcc517d205d1fe73159be28975baa23990813963..124dcc90031b25eb4c4837acfbe86cd59de25076 100644 (file)
@@ -1,4 +1,3 @@
-/*jslint confusion: true*/
 Ext.define('PVE.ClusterCreateWindow', {
     extend: 'Proxmox.window.Edit',
     xtype: 'pveClusterCreateWindow',
@@ -22,7 +21,7 @@ Ext.define('PVE.ClusterCreateWindow', {
            fieldLabel: gettext('Cluster Name'),
            allowBlank: false,
            maxLength: 15,
-           name: 'clustername'
+           name: 'clustername',
        },
        {
            xtype: 'fieldcontainer',
@@ -31,11 +30,11 @@ Ext.define('PVE.ClusterCreateWindow', {
                {
                    xtype: 'pveCorosyncLinkEditor',
                    infoText: gettext("Multiple links are used as failover, lower numbers have higher priority."),
-                   name: 'links'
+                   name: 'links',
                },
-           ]
-       }]
-    }
+           ],
+       }],
+    },
 });
 
 Ext.define('PVE.ClusterInfoWindow', {
@@ -51,7 +50,7 @@ Ext.define('PVE.ClusterInfoWindow', {
     joinInfo: {
        ipAddress: undefined,
        fingerprint: undefined,
-       totem: {}
+       totem: {},
     },
 
     items: [
@@ -59,7 +58,7 @@ Ext.define('PVE.ClusterInfoWindow', {
            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',
@@ -100,11 +99,11 @@ Ext.define('PVE.ClusterInfoWindow', {
                            var jsons = Ext.JSON.encode(field.joinInfo);
                            var base64s = Ext.util.Base64.encode(jsons);
                            field.setValue(base64s);
-                       }
-                   }
-               }
-           ]
-       }
+                       },
+                   },
+               },
+           ],
+       },
     ],
     dockedItems: [{
        dock: 'bottom',
@@ -116,9 +115,9 @@ Ext.define('PVE.ClusterInfoWindow', {
                el.select();
                document.execCommand("copy");
            },
-           text: gettext('Copy Information')
-       }]
-    }]
+           text: gettext('Copy Information'),
+       }],
+    }],
 });
 
 Ext.define('PVE.ClusterJoinNodeWindow', {
@@ -146,8 +145,9 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
            info: {
                fp: '',
                ip: '',
-               clusterName: ''
-           }
+               clusterName: '',
+           },
+           hasAssistedInfo: false,
        },
        formulas: {
            submittxt: function(get) {
@@ -157,6 +157,10 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
                }
                return gettext('Join');
            },
+           showClusterFields: (get) => {
+               let manualMode = !get('assistedEntry.checked');
+               return get('hasAssistedInfo') || manualMode;
+           },
        },
     },
 
@@ -166,18 +170,18 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
            '#': {
                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();
@@ -197,8 +201,10 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
            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;
            }
 
@@ -210,13 +216,14 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
            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 => {
@@ -229,7 +236,7 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
                        number: linkNumber,
                        value: '',
                        text: peerLink ? Ext.String.format(gettext("peer's link address: {0}"), peerLink) : '',
-                       allowBlank: false
+                       allowBlank: false,
                    };
                });
 
@@ -246,13 +253,13 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
                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() {
@@ -275,7 +282,7 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
            Ext.Msg.show({
                title: gettext('Join Task Finished'),
                icon: Ext.Msg.INFO,
-               msg: txt
+               msg: txt,
            });
        }
     },
@@ -289,9 +296,9 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
        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',
@@ -306,16 +313,19 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
        },
        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: [
            {
@@ -328,7 +338,7 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
                    value: '{info.ip}',
                    readOnly: '{assistedEntry.checked}',
                },
-               name: 'hostname'
+               name: 'hostname',
            },
            {
                xtype: 'textfield',
@@ -338,9 +348,9 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
                emptyText: gettext("Peer's root password"),
                fieldLabel: gettext('Password'),
                allowBlank: false,
-               name: 'password'
+               name: 'password',
            },
-       ]
+       ],
     },
     {
        xtype: 'textfield',
@@ -348,20 +358,24 @@ Ext.define('PVE.ClusterJoinNodeWindow', {
        allowBlank: false,
        bind: {
            value: '{info.fp}',
-           readOnly: '{assistedEntry.checked}'
+           readOnly: '{assistedEntry.checked}',
+           hidden: '{!showClusterFields}',
        },
-       name: 'fingerprint'
+       name: 'fingerprint',
     },
     {
        xtype: 'fieldcontainer',
        fieldLabel: gettext("Cluster Network"),
+       bind: {
+           hidden: '{!showClusterFields}',
+       },
        items: [
            {
                xtype: 'pveCorosyncLinkEditor',
                itemId: 'linkEditor',
                reference: 'linkEditor',
-               allowNumberEdit: false
+               allowNumberEdit: false,
            },
-       ]
-    }]
+       ],
+    }],
 });