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