utils: some eslint fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-06-06 13:52:17 +02:00
parent 41a786fc86
commit eb9dfa15da

View File

@ -16,12 +16,12 @@ Ext.enableAriaPanels = false;
if (!Ext.isDefined(Ext.global.console)) {
var console = {
dir: function() {},
log: function() {}
log: function() {},
};
}
Ext.Ajax.defaultHeaders = {
'Accept': 'application/json'
'Accept': 'application/json',
};
Ext.Ajax.on('beforerequest', function(conn, options) {
@ -223,7 +223,6 @@ Ext.define('Proxmox.Utils', { utilities: {
},
compute_min_label_width: function(text, width) {
if (width === undefined) { width = 100; }
var tm = new Ext.util.TextMetrics();
@ -269,13 +268,11 @@ Ext.define('Proxmox.Utils', { utilities: {
}
if (!msg) {
el.unmask();
} else {
if (msg === true) {
} else if (msg === true) {
el.mask(gettext("Loading..."));
} else {
el.mask(msg);
}
}
},
getResponseErrorMessage: (err) => {
@ -286,7 +283,7 @@ Ext.define('Proxmox.Utils', { utilities: {
if (err.response && err.response.responseText) {
let txt = err.response.responseText;
try {
let res = JSON.parse(txt)
let res = JSON.parse(txt);
if (res.errors && typeof res.errors === 'object') {
for (let [key, value] of Object.entries(res.errors)) {
msg.push(Ext.String.htmlEncode(`${key}: ${value}`));
@ -354,9 +351,8 @@ Ext.define('Proxmox.Utils', { utilities: {
// Ext.Ajax.request
API2Request: function(reqOpts) {
var newopts = Ext.apply({
waitMsg: gettext('Please wait...')
waitMsg: gettext('Please wait...'),
}, reqOpts);
if (!newopts.url.match(/^\/api2/)) {
@ -408,7 +404,7 @@ Ext.define('Proxmox.Utils', { utilities: {
response.htmlStatus = msg;
Ext.callback(callbackFn, options.scope, [options, false, response]);
Ext.callback(failureFn, options.scope, [response, options]);
}
},
});
};
@ -448,12 +444,12 @@ Ext.define('Proxmox.Utils', { utilities: {
return;
}
orig_cmd();
}
},
});
} else {
orig_cmd();
}
}
},
});
},
@ -527,7 +523,7 @@ Ext.define('Proxmox.Utils', { utilities: {
OVSBridge: 'OVS Bridge',
OVSBond: 'OVS Bond',
OVSPort: 'OVS Port',
OVSIntPort: 'OVS IntPort'
OVSIntPort: 'OVS IntPort',
},
render_network_iface_type: function(value) {
@ -622,7 +618,7 @@ Ext.define('Proxmox.Utils', { utilities: {
dircreate: [gettext('Directory Storage'), gettext('Create')],
lvmcreate: [gettext('LVM Storage'), gettext('Create')],
lvmthincreate: [gettext('LVM-Thin Storage'), gettext('Create')],
zfscreate: [ gettext('ZFS Storage'), gettext('Create') ]
zfscreate: [gettext('ZFS Storage'), gettext('Create')],
},
// to add or change existing for product specific ones
@ -674,7 +670,6 @@ Ext.define('Proxmox.Utils', { utilities: {
},
render_uptime: function(value) {
var uptime = value;
if (uptime === undefined) {
@ -760,7 +755,7 @@ Ext.define('Proxmox.Utils', { utilities: {
if (nw) {
nw.focus();
}
}
},
},