diff --git a/Toolkit.js b/Toolkit.js
index 30f2a88..d528ea7 100644
--- a/Toolkit.js
+++ b/Toolkit.js
@@ -14,16 +14,16 @@ Ext.apply(Ext.form.field.VTypes, {
return Proxmox.Utils.IP4_match.test(v);
},
IPAddressText: gettext('Example') + ': 192.168.1.1',
- IPAddressMask: /[\d\.]/i,
+ IPAddressMask: /[\d.]/i,
IPCIDRAddress: function(v) {
- var result = Proxmox.Utils.IP4_cidr_match.exec(v);
+ let result = Proxmox.Utils.IP4_cidr_match.exec(v);
// limits according to JSON Schema see
// pve-common/src/PVE/JSONSchema.pm
return result !== null && result[1] >= 8 && result[1] <= 32;
},
- IPCIDRAddressText: gettext('Example') + ': 192.168.1.1/24' + "
" + gettext('Valid CIDR Range') + ': 8-32',
- IPCIDRAddressMask: /[\d\.\/]/i,
+ IPCIDRAddressText: gettext('Example') + ': 192.168.1.1/24
' + gettext('Valid CIDR Range') + ': 8-32',
+ IPCIDRAddressMask: /[\d./]/i,
IP6Address: function(v) {
return Proxmox.Utils.IP6_match.test(v);
@@ -32,13 +32,13 @@ Ext.apply(Ext.form.field.VTypes, {
IP6AddressMask: /[A-Fa-f0-9:]/,
IP6CIDRAddress: function(v) {
- var result = Proxmox.Utils.IP6_cidr_match.exec(v);
+ let result = Proxmox.Utils.IP6_cidr_match.exec(v);
// limits according to JSON Schema see
// pve-common/src/PVE/JSONSchema.pm
return result !== null && result[1] >= 8 && result[1] <= 128;
},
- IP6CIDRAddressText: gettext('Example') + ': 2001:DB8::42/64' + "
" + gettext('Valid CIDR Range') + ': 8-128',
- IP6CIDRAddressMask: /[A-Fa-f0-9:\/]/,
+ IP6CIDRAddressText: gettext('Example') + ': 2001:DB8::42/64
' + gettext('Valid CIDR Range') + ': 8-128',
+ IP6CIDRAddressMask: /[A-Fa-f0-9:/]/,
IP6PrefixLength: function(v) {
return v >= 0 && v <= 128;
@@ -50,10 +50,10 @@ Ext.apply(Ext.form.field.VTypes, {
return Proxmox.Utils.IP64_match.test(v);
},
IP64AddressText: gettext('Example') + ': 192.168.1.1 2001:DB8::42',
- IP64AddressMask: /[A-Fa-f0-9\.:]/,
+ IP64AddressMask: /[A-Fa-f0-9.:]/,
IP64CIDRAddress: function(v) {
- var result = Proxmox.Utils.IP64_cidr_match.exec(v);
+ let result = Proxmox.Utils.IP64_cidr_match.exec(v);
if (result === null) {
return false;
}
@@ -66,7 +66,7 @@ Ext.apply(Ext.form.field.VTypes, {
}
},
IP64CIDRAddressText: gettext('Example') + ': 192.168.1.1/24 2001:DB8::42/64',
- IP64CIDRAddressMask: /[A-Fa-f0-9\.:\/]/,
+ IP64CIDRAddressMask: /[A-Fa-f0-9.:/]/,
MacAddress: function(v) {
return (/^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$/).test(v);
@@ -101,24 +101,24 @@ Ext.apply(Ext.form.field.VTypes, {
InterfaceName: function(v) {
return (/^[a-z][a-z0-9_]{1,20}$/).test(v);
},
- InterfaceNameText: gettext("Allowed characters") + ": 'a-z', '0-9', '_'" + "
" +
- gettext("Minimum characters") + ": 2" + "
" +
- gettext("Maximum characters") + ": 21" + "
" +
+ InterfaceNameText: gettext("Allowed characters") + ": 'a-z', '0-9', '_'
" +
+ gettext("Minimum characters") + ": 2
" +
+ gettext("Maximum characters") + ": 21
" +
gettext("Must start with") + ": 'a-z'",
StorageId: function(v) {
- return (/^[a-z][a-z0-9\-\_\.]*[a-z0-9]$/i).test(v);
+ return (/^[a-z][a-z0-9\-_.]*[a-z0-9]$/i).test(v);
},
- StorageIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '-', '_', '.'" + "
" +
- gettext("Minimum characters") + ": 2" + "
" +
+ StorageIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '-', '_', '.'
" +
+ gettext("Minimum characters") + ": 2
" +
gettext("Must start with") + ": 'A-Z', 'a-z'
" +
gettext("Must end with") + ": 'A-Z', 'a-z', '0-9'
",
ConfigId: function(v) {
- return (/^[a-z][a-z0-9\_]+$/i).test(v);
+ return (/^[a-z][a-z0-9_]+$/i).test(v);
},
- ConfigIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '_'" + "
" +
- gettext("Minimum characters") + ": 2" + "
" +
+ ConfigIdText: gettext("Allowed characters") + ": 'A-Z', 'a-z', '0-9', '_'
" +
+ gettext("Minimum characters") + ": 2
" +
gettext("Must start with") + ": " + gettext("letter"),
HttpProxy: function(v) {
@@ -133,7 +133,7 @@ Ext.apply(Ext.form.field.VTypes, {
// workaround for https://www.sencha.com/forum/showthread.php?302150
proxmoxMail: function(v) {
- return (/^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v);
+ return (/^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v);
},
proxmoxMailText: gettext('Example') + ": user@example.com",
@@ -148,10 +148,10 @@ Ext.apply(Ext.form.field.VTypes, {
DnsOrIpText: gettext('Not a valid DNS name or IP address.'),
HostList: function(v) {
- var list = v.split(/[\ \,\;]+/);
- var i;
+ let list = v.split(/[ ,;]+/);
+ let i;
for (i = 0; i < list.length; i++) {
- if (list[i] == "") {
+ if (list[i] === '') {
continue;
}
@@ -168,9 +168,8 @@ Ext.apply(Ext.form.field.VTypes, {
password: function(val, field) {
if (field.initialPassField) {
- var pwd = field.up('form').down(
- '[name=' + field.initialPassField + ']');
- return val == pwd.getValue();
+ let pwd = field.up('form').down(`[name=${field.initialPassField}]`);
+ return val === pwd.getValue();
}
return true;
},
@@ -184,7 +183,7 @@ Ext.apply(Ext.form.field.VTypes, {
Ext.define('EXTJS_23846.Element', {
override: 'Ext.dom.Element',
}, function(Element) {
- var supports = Ext.supports,
+ let supports = Ext.supports,
proto = Element.prototype,
eventMap = proto.eventMap,
additiveEvents = proto.additiveEvents;
@@ -213,11 +212,11 @@ Ext.define('EXTJS_23846.Element', {
Ext.define('EXTJS_23846.Gesture', {
override: 'Ext.event.publisher.Gesture',
}, function(Gesture) {
- var me = Gesture.instance;
+ let gestures = Gesture.instance;
if (Ext.supports.TouchEvents && !Ext.isWebKit && Ext.os.is.Desktop) {
- me.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
- me.registerEvents();
+ gestures.handledDomEvents.push('mousedown', 'mousemove', 'mouseup');
+ gestures.registerEvents();
}
});
@@ -226,7 +225,7 @@ Ext.define('EXTJS_18900.Pie', {
// from 6.0.2
betweenAngle: function(x, a, b) {
- var pp = Math.PI * 2,
+ let pp = Math.PI * 2,
offset = this.rotationOffset;
if (a === b) {
@@ -273,7 +272,7 @@ Ext.define('Proxmox.UnderlayPool', {
override: 'Ext.dom.UnderlayPool',
checkOut: function() {
- var cache = this.cache,
+ let cache = this.cache,
len = cache.length,
el;
@@ -324,12 +323,13 @@ Ext.define('Proxmox.form.ComboBox', {
reset: function() {
// copied from combobox
- var me = this;
+ let me = this;
me.callParent();
// clear and set when not the same
- var value = me.getValue();
- if (Ext.isArray(me.originalValue) && Ext.isArray(value) && !Ext.Array.equals(value, me.originalValue)) {
+ let value = me.getValue();
+ if (Ext.isArray(me.originalValue) && Ext.isArray(value) &&
+ !Ext.Array.equals(value, me.originalValue)) {
me.clearValue();
me.setValue(me.originalValue);
}
@@ -373,67 +373,66 @@ Ext.define(null, {
jumpToFocus: false,
saveFocusState: function() {
- var me = this,
- store = me.dataSource,
- actionableMode = me.actionableMode,
- navModel = me.getNavigationModel(),
- focusPosition = actionableMode ? me.actionPosition : navModel.getPosition(true),
- refocusRow, refocusCol;
+ let me = this,
+ store = me.dataSource,
+ actionableMode = me.actionableMode,
+ navModel = me.getNavigationModel(),
+ focusPosition = actionableMode ? me.actionPosition : navModel.getPosition(true),
+ refocusRow, refocusCol;
- if (focusPosition) {
- // Separate this from the instance that the nav model is using.
- focusPosition = focusPosition.clone();
+ if (focusPosition) {
+ // Separate this from the instance that the nav model is using.
+ focusPosition = focusPosition.clone();
- // Exit actionable mode.
- // We must inform any Actionables that they must relinquish control.
- // Tabbability must be reset.
- if (actionableMode) {
- me.ownerGrid.setActionableMode(false);
- }
+ // Exit actionable mode.
+ // We must inform any Actionables that they must relinquish control.
+ // Tabbability must be reset.
+ if (actionableMode) {
+ me.ownerGrid.setActionableMode(false);
+ }
- // Blur the focused descendant, but do not trigger focusLeave.
- me.el.dom.focus();
+ // Blur the focused descendant, but do not trigger focusLeave.
+ me.el.dom.focus();
- // Exiting actionable mode navigates to the owning cell, so in either focus mode we must
- // clear the navigation position
- navModel.setPosition();
+ // Exiting actionable mode navigates to the owning cell, so in either focus mode we must
+ // clear the navigation position
+ navModel.setPosition();
- // The following function will attempt to refocus back in the same mode to the same cell
- // as it was at before based upon the previous record (if it's still inthe store), or the row index.
- return function() {
- // If we still have data, attempt to refocus in the same mode.
- if (store.getCount()) {
- // Adjust expectations of where we are able to refocus according to what kind of destruction
- // might have been wrought on this view's DOM during focus save.
- refocusRow = Math.min(focusPosition.rowIdx, me.all.getCount() - 1);
- refocusCol = Math.min(focusPosition.colIdx, me.getVisibleColumnManager().getColumns().length - 1);
- focusPosition = new Ext.grid.CellContext(me).setPosition(
- store.contains(focusPosition.record) ? focusPosition.record : refocusRow, refocusCol);
+ // The following function will attempt to refocus back in the same mode to the same cell
+ // as it was at before based upon the previous record (if it's still inthe store), or the row index.
+ return function() {
+ // If we still have data, attempt to refocus in the same mode.
+ if (store.getCount()) {
+ // Adjust expectations of where we are able to refocus according to what kind of destruction
+ // might have been wrought on this view's DOM during focus save.
+ refocusRow = Math.min(focusPosition.rowIdx, me.all.getCount() - 1);
+ refocusCol = Math.min(focusPosition.colIdx,
+ me.getVisibleColumnManager().getColumns().length - 1);
+ refocusRow = store.contains(focusPosition.record) ? focusPosition.record : refocusRow;
+ focusPosition = new Ext.grid.CellContext(me).setPosition(refocusRow, refocusCol);
- if (actionableMode) {
- me.ownerGrid.setActionableMode(true, focusPosition);
- } else {
- me.cellFocused = true;
+ if (actionableMode) {
+ me.ownerGrid.setActionableMode(true, focusPosition);
+ } else {
+ me.cellFocused = true;
// we sometimes want to scroll back to where we were
- var x = me.getScrollX();
- var y = me.getScrollY();
+ let x = me.getScrollX();
+ let y = me.getScrollY();
- // Pass "preventNavigation" as true so that that does not cause selection.
- navModel.setPosition(focusPosition, null, null, null, true);
+ // Pass "preventNavigation" as true so that that does not cause selection.
+ navModel.setPosition(focusPosition, null, null, null, true);
if (!me.jumpToFocus) {
me.scrollTo(x, y);
}
- }
- }
- // No rows - focus associated column header
- else {
- focusPosition.column.focus();
- }
- };
- }
- return Ext.emptyFn;
+ }
+ } else { // No rows - focus associated column header
+ focusPosition.column.focus();
+ }
+ };
+ }
+ return Ext.emptyFn;
},
});
@@ -461,7 +460,7 @@ Ext.define(null, {
override: 'Ext.layout.container.boxOverflow.Scroller',
createWheelListener: function() {
- var me = this;
+ let me = this;
if (Ext.isFirefox) {
me.wheelListener = me.layout.innerCt.on('wheel', me.onMouseWheelFirefox, me, { destroyable: true });
} else {
@@ -474,7 +473,7 @@ Ext.define(null, {
// because it is already
onMouseWheelFirefox: function(e) {
e.stopEvent();
- var delta = e.browserEvent.deltaY || 0;
+ let delta = e.browserEvent.deltaY || 0;
this.scrollBy(delta * this.wheelIncrement, false);
},
@@ -483,7 +482,7 @@ Ext.define(null, {
// add '@' to the valid id
Ext.define('Proxmox.validIdReOverride', {
override: 'Ext.Component',
- validIdRe: /^[a-z_][a-z0-9\-_\@]*$/i,
+ validIdRe: /^[a-z_][a-z0-9\-_@]*$/i,
});
// force alert boxes to be rendered with an Error Icon
@@ -492,9 +491,9 @@ Ext.define('Proxmox.validIdReOverride', {
Ext.onReady(function() {
/*jslint confusion: true */
Ext.override(Ext.Msg, {
- alert: function(title, message, fn, scope) {
+ alert: function(title, message, fn, scope) { // eslint-disable-line consistent-return
if (Ext.isString(title)) {
- var config = {
+ let config = {
title: title,
message: message,
icon: this.ERROR,
@@ -530,7 +529,7 @@ Ext.define('Ext.ux.IFrame', {
},
initEvents: function() {
- var me = this;
+ let me = this;
me.callParent();
me.iframeEl.on('load', me.onLoad, me);
},
@@ -543,7 +542,7 @@ Ext.define('Ext.ux.IFrame', {
},
getBody: function() {
- var doc = this.getDoc();
+ let doc = this.getDoc();
return doc.body || doc.documentElement;
},
@@ -556,7 +555,7 @@ Ext.define('Ext.ux.IFrame', {
},
getWin: function() {
- var me = this,
+ let me = this,
name = me.frameName,
win = Ext.isIE
? me.iframeEl.dom.contentWindow
@@ -565,7 +564,7 @@ Ext.define('Ext.ux.IFrame', {
},
getFrame: function() {
- var me = this;
+ let me = this;
return me.iframeEl.dom;
},
@@ -575,29 +574,29 @@ Ext.define('Ext.ux.IFrame', {
},
cleanupListeners: function(destroying) {
- var doc, prop;
+ let doc, prop;
if (this.rendered) {
try {
doc = this.getDoc();
if (doc) {
- /*jslint nomen: true*/
Ext.get(doc).un(this._docListeners);
- /*jslint nomen: false*/
if (destroying && doc.hasOwnProperty) {
for (prop in doc) {
- if (doc.hasOwnProperty(prop)) {
+ if (Object.prototype.hasOwnProperty.call(doc, prop)) {
delete doc[prop];
}
}
}
}
- } catch (e) { }
+ } catch (e) {
+ // do nothing
+ }
}
},
onLoad: function() {
- var me = this,
+ let me = this,
doc = me.getDoc(),
fn = me.onRelayedEvent;
@@ -638,7 +637,7 @@ Ext.define('Ext.ux.IFrame', {
onRelayedEvent: function(event) {
// relay event from the iframe's document to the document that owns the iframe...
- var iframeEl = this.iframeEl,
+ let iframeEl = this.iframeEl,
// Get the left-based iframe position
iframeXY = iframeEl.getTrueXY(),
@@ -659,7 +658,7 @@ Ext.define('Ext.ux.IFrame', {
},
load: function(src) {
- var me = this,
+ let me = this,
text = me.loadMask,
frame = me.getFrame();
diff --git a/Utils.js b/Utils.js
index f86fa09..c3b13f4 100644
--- a/Utils.js
+++ b/Utils.js
@@ -14,7 +14,7 @@ Ext.enableAriaPanels = false;
// avoid errors when running without development tools
if (!Ext.isDefined(Ext.global.console)) {
- var console = {
+ let console = {
dir: function() {
// do nothing
},
@@ -93,7 +93,7 @@ utilities: {
if (!value) {
return Proxmox.Utils.defaultText + ' (English)';
}
- var text = Proxmox.Utils.language_map[value];
+ let text = Proxmox.Utils.language_map[value];
if (text) {
return text + ' (' + value + ')';
}
@@ -101,7 +101,7 @@ utilities: {
},
language_array: function() {
- var data = [['__default__', Proxmox.Utils.render_language('')]];
+ let data = [['__default__', Proxmox.Utils.render_language('')]];
Ext.Object.each(Proxmox.Utils.language_map, function(key, value) {
data.push([key, Proxmox.Utils.render_language(value)]);
});
@@ -192,22 +192,22 @@ utilities: {
},
format_duration_long: function(ut) {
- var days = Math.floor(ut / 86400);
+ let days = Math.floor(ut / 86400);
ut -= days*86400;
- var hours = Math.floor(ut / 3600);
+ let hours = Math.floor(ut / 3600);
ut -= hours*3600;
- var mins = Math.floor(ut / 60);
+ let mins = Math.floor(ut / 60);
ut -= mins*60;
- var hours_str = '00' + hours.toString();
+ let hours_str = '00' + hours.toString();
hours_str = hours_str.substr(hours_str.length - 2);
- var mins_str = "00" + mins.toString();
+ let mins_str = "00" + mins.toString();
mins_str = mins_str.substr(mins_str.length - 2);
- var ut_str = "00" + ut.toString();
+ let ut_str = "00" + ut.toString();
ut_str = ut_str.substr(ut_str.length - 2);
if (days) {
- var ds = days > 1 ? Proxmox.Utils.daysText : Proxmox.Utils.dayText;
+ let ds = days > 1 ? Proxmox.Utils.daysText : Proxmox.Utils.dayText;
return days.toString() + ' ' + ds + ' ' +
hours_str + ':' + mins_str + ':' + ut_str;
} else {
@@ -232,8 +232,8 @@ utilities: {
compute_min_label_width: function(text, width) {
if (width === undefined) { width = 100; }
- var tm = new Ext.util.TextMetrics();
- var min = tm.getWidth(text + ':');
+ let tm = new Ext.util.TextMetrics();
+ let min = tm.getWidth(text + ':');
return min < width ? width : min;
},
@@ -269,7 +269,7 @@ utilities: {
// comp.setLoading() is buggy in ExtJS 4.0.7, so we
// use el.mask() instead
setErrorMask: function(comp, msg) {
- var el = comp.el;
+ let el = comp.el;
if (!el) {
return;
}
@@ -334,7 +334,7 @@ utilities: {
},
extractRequestError: function(result, verbose) {
- var msg = gettext('Successful');
+ let msg = gettext('Successful');
if (!result.success) {
msg = gettext("Unknown error");
@@ -358,7 +358,7 @@ utilities: {
// Ext.Ajax.request
API2Request: function(reqOpts) {
- var newopts = Ext.apply({
+ let newopts = Ext.apply({
waitMsg: gettext('Please wait...'),
}, reqOpts);
@@ -367,7 +367,7 @@ utilities: {
}
delete newopts.callback;
- var createWrapper = function(successFn, callbackFn, failureFn) {
+ let createWrapper = function(successFn, callbackFn, failureFn) {
Ext.apply(newopts, {
success: function(response, options) {
if (options.waitMsgTarget) {
@@ -377,7 +377,7 @@ utilities: {
options.waitMsgTarget.setLoading(false);
}
}
- var result = Ext.decode(response.responseText);
+ let result = Ext.decode(response.responseText);
response.result = result;
if (!result.success) {
response.htmlStatus = Proxmox.Utils.extractRequestError(result, true);
@@ -402,7 +402,7 @@ utilities: {
} catch (e) {
// ignore
}
- var msg = gettext('Connection error') + ' - server offline?';
+ let msg = gettext('Connection error') + ' - server offline?';
if (response.aborted) {
msg = gettext('Connection error') + ' - aborted.';
} else if (response.timedout) {
@@ -419,7 +419,7 @@ utilities: {
createWrapper(reqOpts.success, reqOpts.callback, reqOpts.failure);
- var target = newopts.waitMsgTarget;
+ let target = newopts.waitMsgTarget;
if (target) {
if (Proxmox.Utils.toolkit === 'touch') {
target.setMasked({ xtype: 'loadmask', message: newopts.waitMsg });
@@ -657,11 +657,8 @@ utilities: {
},
format_size: function(size) {
- /*jslint confusion: true */
-
- var units = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
- var num = 0;
-
+ let units = ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
+ let num = 0;
while (size >= 1024 && num++ <= units.length) {
size = size / 1024;
}
@@ -678,7 +675,7 @@ utilities: {
},
render_uptime: function(value) {
- var uptime = value;
+ let uptime = value;
if (uptime === undefined) {
return '';
@@ -692,9 +689,9 @@ utilities: {
},
parse_task_upid: function(upid) {
- var task = {};
+ let task = {};
- var res = upid.match(/^UPID:([^\s:]+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):(([0-9A-Fa-f]{8,16}):)?([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
+ let res = upid.match(/^UPID:([^\s:]+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):(([0-9A-Fa-f]{8,16}):)?([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/);
if (!res) {
throw "unable to parse upid '" + upid + "'";
}
@@ -722,12 +719,12 @@ utilities: {
},
render_timestamp: function(value, metaData, record, rowIndex, colIndex, store) {
- var servertime = new Date(value * 1000);
+ let servertime = new Date(value * 1000);
return Ext.Date.format(servertime, 'Y-m-d H:i:s');
},
get_help_info: function(section) {
- var helpMap;
+ let helpMap;
if (typeof proxmoxOnlineHelpInfo !== 'undefined') {
helpMap = proxmoxOnlineHelpInfo; // eslint-disable-line no-undef
} else if (typeof pveOnlineHelpInfo !== 'undefined') {
@@ -741,7 +738,7 @@ utilities: {
},
get_help_link: function(section) {
- var info = Proxmox.Utils.get_help_info(section);
+ let info = Proxmox.Utils.get_help_info(section);
if (!info) {
return undefined;
}
@@ -749,7 +746,7 @@ utilities: {
},
openXtermJsViewer: function(vmtype, vmid, nodename, vmname, cmd) {
- var url = Ext.Object.toQueryString({
+ let url = Ext.Object.toQueryString({
console: vmtype, // kvm, lxc, upgrade or shell
xtermjs: 1,
vmid: vmid,
@@ -758,7 +755,7 @@ utilities: {
cmd: cmd,
});
- var nw = window.open("?" + url, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
+ let nw = window.open("?" + url, '_blank', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420');
if (nw) {
nw.focus();
}
@@ -768,22 +765,22 @@ utilities: {
singleton: true,
constructor: function() {
- var me = this;
+ let me = this;
Ext.apply(me, me.utilities);
- var IPV4_OCTET = "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])";
- var IPV4_REGEXP = "(?:(?:" + IPV4_OCTET + "\\.){3}" + IPV4_OCTET + ")";
- var IPV6_H16 = "(?:[0-9a-fA-F]{1,4})";
- var IPV6_LS32 = "(?:(?:" + IPV6_H16 + ":" + IPV6_H16 + ")|" + IPV4_REGEXP + ")";
- var IPV4_CIDR_MASK = "([0-9]{1,2})";
- var IPV6_CIDR_MASK = "([0-9]{1,3})";
+ let IPV4_OCTET = "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])";
+ let IPV4_REGEXP = "(?:(?:" + IPV4_OCTET + "\\.){3}" + IPV4_OCTET + ")";
+ let IPV6_H16 = "(?:[0-9a-fA-F]{1,4})";
+ let IPV6_LS32 = "(?:(?:" + IPV6_H16 + ":" + IPV6_H16 + ")|" + IPV4_REGEXP + ")";
+ let IPV4_CIDR_MASK = "([0-9]{1,2})";
+ let IPV6_CIDR_MASK = "([0-9]{1,3})";
me.IP4_match = new RegExp("^(?:" + IPV4_REGEXP + ")$");
me.IP4_cidr_match = new RegExp("^(?:" + IPV4_REGEXP + ")/" + IPV4_CIDR_MASK + "$");
/* eslint-disable no-useless-concat,no-multi-spaces */
- var IPV6_REGEXP = "(?:" +
+ let IPV6_REGEXP = "(?:" +
"(?:(?:" + "(?:" + IPV6_H16 + ":){6})" + IPV6_LS32 + ")|" +
"(?:(?:" + "::" + "(?:" + IPV6_H16 + ":){5})" + IPV6_LS32 + ")|" +
"(?:(?:(?:" + IPV6_H16 + ")?::" + "(?:" + IPV6_H16 + ":){4})" + IPV6_LS32 + ")|" +
@@ -803,7 +800,7 @@ utilities: {
me.IP64_match = new RegExp("^(?:" + IPV6_REGEXP + "|" + IPV4_REGEXP + ")$");
me.IP64_cidr_match = new RegExp("^(?:" + IPV6_REGEXP + "/" + IPV6_CIDR_MASK + ")|(?:" + IPV4_REGEXP + "/" + IPV4_CIDR_MASK + ")$");
- var DnsName_REGEXP = "(?:(([a-zA-Z0-9]([a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*([A-Za-z0-9]([A-Za-z0-9\\-]*[A-Za-z0-9])?))";
+ let DnsName_REGEXP = "(?:(([a-zA-Z0-9]([a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*([A-Za-z0-9]([A-Za-z0-9\\-]*[A-Za-z0-9])?))";
me.DnsName_match = new RegExp("^" + DnsName_REGEXP + "$");
me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(:\\d+)?$");
diff --git a/button/Button.js b/button/Button.js
index 9b8d66e..93c773c 100644
--- a/button/Button.js
+++ b/button/Button.js
@@ -24,14 +24,14 @@ Ext.define('Proxmox.button.Button', {
parentXType: 'grid',
initComponent: function() {
- var me = this;
+ let me = this;
if (me.handler) {
// Note: me.realHandler may be a string (see named scopes)
- var realHandler = me.handler;
+ let realHandler = me.handler;
me.handler = function(button, event) {
- var rec, msg;
+ let rec, msg;
if (me.selModel) {
rec = me.selModel.getSelection()[0];
if (!rec || me.enableFn(rec) === false) {
@@ -66,9 +66,9 @@ Ext.define('Proxmox.button.Button', {
me.callParent();
- var grid;
+ let grid;
if (!me.selModel && me.selModel !== null && me.selModel !== false) {
- parent = me.up(me.parentXType);
+ let parent = me.up(me.parentXType);
if (parent && parent.selModel) {
me.selModel = parent.selModel;
}
@@ -85,7 +85,7 @@ Ext.define('Proxmox.button.Button', {
if (me.selModel) {
me.mon(me.selModel, "selectionchange", function() {
- var rec = me.selModel.getSelection()[0];
+ let rec = me.selModel.getSelection()[0];
if (!rec || me.enableFn(rec) === false) {
me.setDisabled(true);
} else {
@@ -113,7 +113,7 @@ Ext.define('Proxmox.button.StdRemoveButton', {
},
getUrl: function(rec) {
- var me = this;
+ let me = this;
if (me.selModel) {
return me.baseurl + '/' + rec.getId();
@@ -130,16 +130,16 @@ Ext.define('Proxmox.button.StdRemoveButton', {
getRecordName: (rec) => rec.getId(),
confirmMsg: function(rec) {
- var me = this;
+ let me = this;
- var name = me.getRecordName(rec);
+ let name = me.getRecordName(rec);
return Ext.String.format(gettext('Are you sure you want to remove entry {0}'), `'${name}'`);
},
handler: function(btn, event, rec) {
- var me = this;
+ let me = this;
- var url = me.getUrl(rec);
+ let url = me.getUrl(rec);
if (typeof me.delay !== 'undefined' && me.delay >= 0) {
url += "?delay=" + me.delay;
diff --git a/button/HelpButton.js b/button/HelpButton.js
index 8fbcf5c..d97a6c4 100644
--- a/button/HelpButton.js
+++ b/button/HelpButton.js
@@ -1,9 +1,6 @@
/* help button pointing to an online documentation
for components contained in a modal window
*/
-/*global
- proxmoxOnlineHelpInfo
-*/
Ext.define('Proxmox.button.Help', {
extend: 'Ext.button.Button',
xtype: 'proxmoxHelpButton',
@@ -27,28 +24,28 @@ Ext.define('Proxmox.button.Help', {
},
},
onProxmoxShowHelp: function(helpLink) {
- var me = this.getView();
- if (me.listenToGlobalEvent === true) {
- me.setOnlineHelp(helpLink);
- me.show();
+ let view = this.getView();
+ if (view.listenToGlobalEvent === true) {
+ view.setOnlineHelp(helpLink);
+ view.show();
}
},
onProxmoxHideHelp: function() {
- var me = this.getView();
- if (me.listenToGlobalEvent === true) {
- me.hide();
+ let view = this.getView();
+ if (view.listenToGlobalEvent === true) {
+ view.hide();
}
},
},
// this sets the link and the tooltip text
setOnlineHelp: function(blockid) {
- var me = this;
+ let me = this;
- var info = Proxmox.Utils.get_help_info(blockid);
+ let info = Proxmox.Utils.get_help_info(blockid);
if (info) {
me.onlineHelp = blockid;
- var title = info.title;
+ let title = info.title;
if (info.subtitle) {
title += ' - ' + info.subtitle;
}
@@ -58,13 +55,13 @@ Ext.define('Proxmox.button.Help', {
// helper to set the onlineHelp via a config object
setHelpConfig: function(config) {
- var me = this;
+ let me = this;
me.setOnlineHelp(config.onlineHelp);
},
handler: function() {
- var me = this;
- var docsURI;
+ let me = this;
+ let docsURI;
if (me.onlineHelp) {
docsURI = Proxmox.Utils.get_help_link(me.onlineHelp);
@@ -78,8 +75,7 @@ Ext.define('Proxmox.button.Help', {
},
initComponent: function() {
- /*jslint confusion: true */
- var me = this;
+ let me = this;
me.callParent();
diff --git a/data/DiffStore.js b/data/DiffStore.js
index db608c5..e4143f5 100644
--- a/data/DiffStore.js
+++ b/data/DiffStore.js
@@ -40,7 +40,7 @@ Ext.define('Proxmox.data.DiffStore', {
},
constructor: function(config) {
- var me = this;
+ let me = this;
config = config || {};
@@ -73,10 +73,10 @@ Ext.define('Proxmox.data.DiffStore', {
me.rstore = rstore;
- var first_load = true;
+ let first_load = true;
- var cond_add_item = function(data, id) {
- var olditem = me.getById(id);
+ let cond_add_item = function(data, id) {
+ let olditem = me.getById(id);
if (olditem) {
olditem.beginEdit();
Ext.Array.each(me.model.prototype.fields, function(field) {
@@ -87,13 +87,13 @@ Ext.define('Proxmox.data.DiffStore', {
olditem.endEdit(true);
olditem.commit();
} else {
- var newrec = Ext.create(me.model, data);
- var pos = me.appendAtStart && !first_load ? 0 : me.data.length;
+ let newrec = Ext.create(me.model, data);
+ let pos = me.appendAtStart && !first_load ? 0 : me.data.length;
me.insert(pos, newrec);
}
};
- var loadFn = function(s, records, success) {
+ let loadFn = function(s, records, success) {
if (!success) {
return;
}
@@ -102,11 +102,11 @@ Ext.define('Proxmox.data.DiffStore', {
// getSource returns null if data is not filtered
// if it is filtered it returns all records
- var allItems = me.getData().getSource() || me.getData();
+ let allItems = me.getData().getSource() || me.getData();
// remove vanished items
allItems.each(function(olditem) {
- var item = me.rstore.getById(olditem.getId());
+ let item = me.rstore.getById(olditem.getId());
if (!item) {
me.remove(olditem);
}
diff --git a/data/ObjectStore.js b/data/ObjectStore.js
index e9fd2ce..860cbfd 100644
--- a/data/ObjectStore.js
+++ b/data/ObjectStore.js
@@ -7,8 +7,8 @@ Ext.define('Proxmox.data.ObjectStore', {
extend: 'Proxmox.data.UpdateStore',
getRecord: function() {
- var me = this;
- var record = Ext.create('Ext.data.Model');
+ let me = this;
+ let record = Ext.create('Ext.data.Model');
me.getData().each(function(item) {
record.set(item.data.key, item.data.value);
});
@@ -17,7 +17,7 @@ Ext.define('Proxmox.data.ObjectStore', {
},
constructor: function(config) {
- var me = this;
+ let me = this;
config = config || {};
diff --git a/data/ProxmoxProxy.js b/data/ProxmoxProxy.js
index e9e78f7..53e92f3 100644
--- a/data/ProxmoxProxy.js
+++ b/data/ProxmoxProxy.js
@@ -59,8 +59,7 @@ Ext.define('Proxmox.RestProxy', {
{
name: 'id',
convert: function(value, record) {
- var info = record.data;
- var text;
+ let info = record.data;
if (value) {
return value;
diff --git a/data/RRDStore.js b/data/RRDStore.js
index 65b0410..67ffb57 100644
--- a/data/RRDStore.js
+++ b/data/RRDStore.js
@@ -7,7 +7,7 @@ Ext.define('Proxmox.data.RRDStore', {
alias: 'store.proxmoxRRDStore',
setRRDUrl: function(timeframe, cf) {
- var me = this;
+ let me = this;
if (!timeframe) {
timeframe = me.timeframe;
}
@@ -28,7 +28,7 @@ Ext.define('Proxmox.data.RRDStore', {
cf: 'AVERAGE',
constructor: function(config) {
- var me = this;
+ let me = this;
config = config || {};
@@ -47,9 +47,9 @@ Ext.define('Proxmox.data.RRDStore', {
throw "no rrdurl specified";
}
- var stateid = 'proxmoxRRDTypeSelection';
- var sp = Ext.state.Manager.getProvider();
- var stateinit = sp.get(stateid);
+ let stateid = 'proxmoxRRDTypeSelection';
+ let sp = Ext.state.Manager.getProvider();
+ let stateinit = sp.get(stateid);
if (stateinit) {
if (stateinit.timeframe !== me.timeframe || stateinit.cf !== me.rrdcffn) {
diff --git a/data/reader/JsonObject.js b/data/reader/JsonObject.js
index 5deadd3..0489df8 100644
--- a/data/reader/JsonObject.js
+++ b/data/reader/JsonObject.js
@@ -18,7 +18,7 @@
*
* Additional feature: specify allowed properties with default values with 'rows' object
*
- * var rows = {
+ * let rows = {
* memory: {
* required: true,
* defaultValue: 512
@@ -36,7 +36,7 @@ Ext.define('Proxmox.data.reader.JsonObject', {
rows: undefined,
constructor: function(config) {
- var me = this;
+ let me = this;
Ext.apply(me, config || {});
@@ -44,16 +44,16 @@ Ext.define('Proxmox.data.reader.JsonObject', {
},
getResponseData: function(response) {
- var me = this;
+ let me = this;
- var data = [];
+ let data = [];
try {
- var result = Ext.decode(response.responseText);
+ let result = Ext.decode(response.responseText);
// get our data items inside the server response
- var root = result[me.getRootProperty()];
+ let root = result[me.getRootProperty()];
if (me.readArray) {
- var rec_hash = {};
+ let rec_hash = {};
Ext.Array.each(root, function(rec) {
if (Ext.isDefined(rec.key)) {
rec_hash[rec.key] = rec;
@@ -62,7 +62,7 @@ Ext.define('Proxmox.data.reader.JsonObject', {
if (me.rows) {
Ext.Object.each(me.rows, function(key, rowdef) {
- var rec = rec_hash[key];
+ let rec = rec_hash[key];
if (Ext.isDefined(rec)) {
if (!Ext.isDefined(rec.value)) {
rec.value = rowdef.defaultValue;
@@ -82,10 +82,10 @@ Ext.define('Proxmox.data.reader.JsonObject', {
});
}
} else {
- var org_root = root;
+ let org_root = root;
if (Ext.isArray(org_root)) {
- if (root.length == 1) {
+ if (root.length === 1) {
root = org_root[0];
} else {
root = {};
diff --git a/form/BondModeSelector.js b/form/BondModeSelector.js
index 8131496..1fe45b9 100644
--- a/form/BondModeSelector.js
+++ b/form/BondModeSelector.js
@@ -5,7 +5,7 @@ Ext.define('Proxmox.form.BondModeSelector', {
openvswitch: false,
initComponent: function() {
- var me = this;
+ let me = this;
if (me.openvswitch) {
me.comboItems = Proxmox.Utils.bond_mode_array([
diff --git a/form/Checkbox.js b/form/Checkbox.js
index dd654df..2b29e1c 100644
--- a/form/Checkbox.js
+++ b/form/Checkbox.js
@@ -11,14 +11,14 @@ Ext.define('Proxmox.form.Checkbox', {
inputValue: '1',
getSubmitData: function() {
- var me = this,
+ let me = this,
data = null,
val;
if (!me.disabled && me.submitValue) {
val = me.getSubmitValue();
if (val !== null) {
data = {};
- if (val == me.getDefaultValue() && me.getDeleteDefaultValue()) {
+ if (val === me.getDefaultValue() && me.getDeleteDefaultValue()) {
data.delete = me.getName();
} else {
data[me.getName()] = val;
@@ -33,7 +33,7 @@ Ext.define('Proxmox.form.Checkbox', {
// also accept integer 1 as true
setRawValue: function(value) {
- var me = this;
+ let me = this;
if (value === 1) {
me.callParent([true]);
diff --git a/form/ComboGrid.js b/form/ComboGrid.js
index c9eaa5c..e5a1920 100644
--- a/form/ComboGrid.js
+++ b/form/ComboGrid.js
@@ -16,11 +16,11 @@ Ext.define('Proxmox.form.ComboGrid', {
// hack: allow to select empty value
// seems extjs does not allow that when 'editable == false'
onKeyUp: function(e, t) {
- var me = this;
- var key = e.getKey();
+ let me = this;
+ let key = e.getKey();
if (!me.editable && me.allowBlank && !me.multiSelect &&
- (key == e.BACKSPACE || key == e.DELETE)) {
+ (key === e.BACKSPACE || key === e.DELETE)) {
me.setValue('');
}
@@ -44,14 +44,14 @@ Ext.define('Proxmox.form.ComboGrid', {
weight: -1,
hidden: true,
handler: function() {
- var me = this;
+ let me = this;
me.setValue('');
},
},
},
setValue: function(value) {
- var me = this;
+ let me = this;
let empty = Ext.isArray(value) ? !value.length : !value;
me.triggers.clear.setVisible(!empty && me.allowBlank);
return me.callParent([value]);
@@ -68,7 +68,7 @@ Ext.define('Proxmox.form.ComboGrid', {
// should be an array) and else we do callParent so
// it should not impact any other use of the class
getRawValue: function() {
- var me = this;
+ let me = this;
if (me.multiSelect) {
return me.rawValue;
} else {
@@ -77,7 +77,7 @@ Ext.define('Proxmox.form.ComboGrid', {
},
getSubmitData: function() {
- var me = this;
+ let me = this;
let data = null;
if (!me.disabled && me.submitValue) {
@@ -94,9 +94,9 @@ Ext.define('Proxmox.form.ComboGrid', {
},
getSubmitValue: function() {
- var me = this;
+ let me = this;
- var value = me.callParent();
+ let value = me.callParent();
if (value !== '') {
return value;
}
@@ -111,121 +111,122 @@ Ext.define('Proxmox.form.ComboGrid', {
// override ExtJS protected method
onBindStore: function(store, initial) {
- var me = this,
- picker = me.picker,
- extraKeySpec,
- valueCollectionConfig;
+ let me = this,
+ picker = me.picker,
+ extraKeySpec,
+ valueCollectionConfig;
- // We're being bound, not unbound...
- if (store) {
- // If store was created from a 2 dimensional array with generated field names 'field1' and 'field2'
- if (store.autoCreated) {
- me.queryMode = 'local';
- me.valueField = me.displayField = 'field1';
- if (!store.expanded) {
- me.displayField = 'field2';
- }
+ // We're being bound, not unbound...
+ if (store) {
+ // If store was created from a 2 dimensional array with generated field names 'field1' and 'field2'
+ if (store.autoCreated) {
+ me.queryMode = 'local';
+ me.valueField = me.displayField = 'field1';
+ if (!store.expanded) {
+ me.displayField = 'field2';
+ }
- // displayTpl config will need regenerating with the autogenerated displayField name 'field1'
- me.setDisplayTpl(null);
- }
- if (!Ext.isDefined(me.valueField)) {
- me.valueField = me.displayField;
- }
+ // displayTpl config will need regenerating with the autogenerated displayField name 'field1'
+ me.setDisplayTpl(null);
+ }
+ if (!Ext.isDefined(me.valueField)) {
+ me.valueField = me.displayField;
+ }
- // Add a byValue index to the store so that we can efficiently look up records by the value field
- // when setValue passes string value(s).
- // The two indices (Ext.util.CollectionKeys) are configured unique: false, so that if duplicate keys
- // are found, they are all returned by the get call.
- // This is so that findByText and findByValue are able to return the *FIRST* matching value. By default,
- // if unique is true, CollectionKey keeps the *last* matching value.
- extraKeySpec = {
- byValue: {
- rootProperty: 'data',
- unique: false,
- },
- };
- extraKeySpec.byValue.property = me.valueField;
- store.setExtraKeys(extraKeySpec);
+ // Add a byValue index to the store so that we can efficiently look up records by the value field
+ // when setValue passes string value(s).
+ // The two indices (Ext.util.CollectionKeys) are configured unique: false, so that if duplicate keys
+ // are found, they are all returned by the get call.
+ // This is so that findByText and findByValue are able to return the *FIRST* matching value. By default,
+ // if unique is true, CollectionKey keeps the *last* matching value.
+ extraKeySpec = {
+ byValue: {
+ rootProperty: 'data',
+ unique: false,
+ },
+ };
+ extraKeySpec.byValue.property = me.valueField;
+ store.setExtraKeys(extraKeySpec);
- if (me.displayField === me.valueField) {
- store.byText = store.byValue;
- } else {
- extraKeySpec.byText = {
- rootProperty: 'data',
- unique: false,
- };
- extraKeySpec.byText.property = me.displayField;
- store.setExtraKeys(extraKeySpec);
- }
+ if (me.displayField === me.valueField) {
+ store.byText = store.byValue;
+ } else {
+ extraKeySpec.byText = {
+ rootProperty: 'data',
+ unique: false,
+ };
+ extraKeySpec.byText.property = me.displayField;
+ store.setExtraKeys(extraKeySpec);
+ }
- // We hold a collection of the values which have been selected, keyed by this field's valueField.
- // This collection also functions as the selected items collection for the BoundList's selection model
- valueCollectionConfig = {
- rootProperty: 'data',
- extraKeys: {
- byInternalId: {
- property: 'internalId',
- },
- byValue: {
- property: me.valueField,
- rootProperty: 'data',
- },
- },
- // Whenever this collection is changed by anyone, whether by this field adding to it,
- // or the BoundList operating, we must refresh our value.
- listeners: {
- beginupdate: me.onValueCollectionBeginUpdate,
- endupdate: me.onValueCollectionEndUpdate,
- scope: me,
- },
- };
+ // We hold a collection of the values which have been selected, keyed by this field's valueField.
+ // This collection also functions as the selected items collection for the BoundList's selection model
+ valueCollectionConfig = {
+ rootProperty: 'data',
+ extraKeys: {
+ byInternalId: {
+ property: 'internalId',
+ },
+ byValue: {
+ property: me.valueField,
+ rootProperty: 'data',
+ },
+ },
+ // Whenever this collection is changed by anyone, whether by this field adding to it,
+ // or the BoundList operating, we must refresh our value.
+ listeners: {
+ beginupdate: me.onValueCollectionBeginUpdate,
+ endupdate: me.onValueCollectionEndUpdate,
+ scope: me,
+ },
+ };
- // This becomes our collection of selected records for the Field.
- me.valueCollection = new Ext.util.Collection(valueCollectionConfig);
+ // This becomes our collection of selected records for the Field.
+ me.valueCollection = new Ext.util.Collection(valueCollectionConfig);
- // We use the selected Collection as our value collection and the basis
- // for rendering the tag list.
+ // We use the selected Collection as our value collection and the basis
+ // for rendering the tag list.
- //proxmox override: since the picker is represented by a grid panel,
- // we changed here the selection to RowModel
- me.pickerSelectionModel = new Ext.selection.RowModel({
- mode: me.multiSelect ? 'SIMPLE' : 'SINGLE',
- // There are situations when a row is selected on mousedown but then the mouse is dragged to another row
- // and released. In these situations, the event target for the click event won't be the row where the mouse
- // was released but the boundview. The view will then determine that it should fire a container click, and
- // the DataViewModel will then deselect all prior selections. Setting `deselectOnContainerClick` here will
- // prevent the model from deselecting.
- deselectOnContainerClick: false,
- enableInitialSelection: false,
- pruneRemoved: false,
- selected: me.valueCollection,
- store: store,
- listeners: {
- scope: me,
- lastselectedchanged: me.updateBindSelection,
- },
- });
+ //proxmox override: since the picker is represented by a grid panel,
+ // we changed here the selection to RowModel
+ me.pickerSelectionModel = new Ext.selection.RowModel({
+ mode: me.multiSelect ? 'SIMPLE' : 'SINGLE',
+ // There are situations when a row is selected on mousedown but then the mouse is
+ // dragged to another row and released. In these situations, the event target for
+ // the click event won't be the row where the mouse was released but the boundview.
+ // The view will then determine that it should fire a container click, and the
+ // DataViewModel will then deselect all prior selections. Setting
+ // `deselectOnContainerClick` here will prevent the model from deselecting.
+ deselectOnContainerClick: false,
+ enableInitialSelection: false,
+ pruneRemoved: false,
+ selected: me.valueCollection,
+ store: store,
+ listeners: {
+ scope: me,
+ lastselectedchanged: me.updateBindSelection,
+ },
+ });
- if (!initial) {
- me.resetToDefault();
- }
+ if (!initial) {
+ me.resetToDefault();
+ }
- if (picker) {
- picker.setSelectionModel(me.pickerSelectionModel);
- if (picker.getStore() !== store) {
- picker.bindStore(store);
- }
- }
- }
+ if (picker) {
+ picker.setSelectionModel(me.pickerSelectionModel);
+ if (picker.getStore() !== store) {
+ picker.bindStore(store);
+ }
+ }
+ }
},
// copied from ComboBox
createPicker: function() {
- var me = this;
- var picker;
+ let me = this;
+ let picker;
- var pickerCfg = Ext.apply({
+ let pickerCfg = Ext.apply({
// proxmox overrides: display a grid for selection
xtype: 'gridpanel',
id: me.pickerId,
@@ -273,10 +274,9 @@ Ext.define('Proxmox.form.ComboGrid', {
beforedeselect: me.onBeforeDeselect,
focuschange: me.onFocusChange,
selectionChange: function(sm, selectedRecords) {
- var me = this;
if (selectedRecords.length) {
- me.setValue(selectedRecords);
- me.fireEvent('select', me, selectedRecords);
+ this.setValue(selectedRecords);
+ this.fireEvent('select', me, selectedRecords);
}
},
scope: me,
@@ -312,7 +312,7 @@ Ext.define('Proxmox.form.ComboGrid', {
},
clearLocalFilter: function() {
- var me = this,
+ let me = this,
filter = me.queryFilter;
if (filter) {
@@ -324,9 +324,9 @@ Ext.define('Proxmox.form.ComboGrid', {
},
isValueInStore: function(value) {
- var me = this;
- var store = me.store;
- var found = false;
+ let me = this;
+ let store = me.store;
+ let found = false;
if (!store) {
return found;
@@ -345,6 +345,7 @@ Ext.define('Proxmox.form.ComboGrid', {
found = true;
return false; // break
}
+ return true;
});
} else {
found = !!store.findRecord(me.valueField, value);
@@ -354,7 +355,7 @@ Ext.define('Proxmox.form.ComboGrid', {
},
validator: function(value) {
- var me = this;
+ let me = this;
if (!value) {
return true; // handled later by allowEmpty in the getErrors call chain
@@ -366,8 +367,8 @@ Ext.define('Proxmox.form.ComboGrid', {
//
// we also have to get the 'real' value if the we have a mulitSelect
// Field but got a non array value
- if (me.valueField && me.valueField !== me.displayField ||
- me.multiSelect && !Ext.isArray(value)) {
+ if ((me.valueField && me.valueField !== me.displayField) ||
+ (me.multiSelect && !Ext.isArray(value))) {
value = me.getValue();
}
@@ -386,7 +387,7 @@ Ext.define('Proxmox.form.ComboGrid', {
},
initComponent: function() {
- var me = this;
+ let me = this;
Ext.apply(me, {
queryMode: 'local',
@@ -397,12 +398,12 @@ Ext.define('Proxmox.form.ComboGrid', {
Ext.applyIf(me.listConfig, { width: 400 });
- me.callParent();
+ me.callParent();
- // Create the picker at an early stage, so it is available to store the previous selection
- if (!me.picker) {
- me.createPicker();
- }
+ // Create the picker at an early stage, so it is available to store the previous selection
+ if (!me.picker) {
+ me.createPicker();
+ }
me.mon(me.store, 'beforeload', function() {
if (!me.isDisabled()) {
@@ -419,7 +420,7 @@ Ext.define('Proxmox.form.ComboGrid', {
delete me.enableLoadMask;
// if the picker exists,
- // we reset its minheight to the saved var/0
+ // we reset its minheight to the saved let/0
// we have to update the layout, otherwise the height
// gets not recalculated
if (me.picker) {
@@ -429,17 +430,17 @@ Ext.define('Proxmox.form.ComboGrid', {
}
}
- var def = me.getValue() || me.preferredValue;
+ let def = me.getValue() || me.preferredValue;
if (def) {
me.setValue(def, true); // sync with grid
}
- var found = false;
+ let found = false;
if (def) {
found = me.isValueInStore(def);
}
if (!found) {
- var rec = me.store.first();
+ let rec = me.store.first();
if (me.autoSelect && rec && rec.data) {
def = rec.data[me.valueField];
me.setValue(def, true);
diff --git a/form/DateTimeField.js b/form/DateTimeField.js
index c49ec55..a061e15 100644
--- a/form/DateTimeField.js
+++ b/form/DateTimeField.js
@@ -9,24 +9,24 @@ Ext.define('Proxmox.DateTimeField', {
submitFormat: 'U',
getValue: function() {
- var me = this;
- var d = me.lookupReference('dateentry').getValue();
+ let me = this;
+ let d = me.lookupReference('dateentry').getValue();
if (d === undefined || d === null) { return null; }
- var t = me.lookupReference('timeentry').getValue();
+ let t = me.lookupReference('timeentry').getValue();
if (t === undefined || t === null) { return null; }
- var offset = (t.getHours()*3600+t.getMinutes()*60)*1000;
+ let offset = (t.getHours() * 3600 + t.getMinutes() * 60) * 1000;
return new Date(d.getTime() + offset);
},
getSubmitValue: function() {
- var me = this;
- var format = me.submitFormat;
- var value = me.getValue();
+ let me = this;
+ let format = me.submitFormat;
+ let value = me.getValue();
return value ? Ext.Date.format(value, format) : null;
},
@@ -128,11 +128,11 @@ Ext.define('Proxmox.DateTimeField', {
},
initComponent: function() {
- var me = this;
+ let me = this;
me.callParent();
- var value = me.value || new Date();
+ let value = me.value || new Date();
me.lookupReference('dateentry').setValue(value);
me.lookupReference('timeentry').setValue(value);
diff --git a/form/IntegerField.js b/form/IntegerField.js
index 457c302..67dd215 100644
--- a/form/IntegerField.js
+++ b/form/IntegerField.js
@@ -11,7 +11,7 @@ Ext.define('Proxmox.form.field.Integer', {
step: 1,
getSubmitData: function() {
- var me = this,
+ let me = this,
data = null,
val;
if (!me.disabled && me.submitValue && !me.isFileUpload()) {
diff --git a/form/KVComboBox.js b/form/KVComboBox.js
index f14f934..361217e 100644
--- a/form/KVComboBox.js
+++ b/form/KVComboBox.js
@@ -20,7 +20,7 @@ Ext.define('Proxmox.form.KVComboBox', {
// overide framework function to implement deleteEmpty behaviour
getSubmitData: function() {
- var me = this,
+ let me = this,
data = null,
val;
if (!me.disabled && me.submitValue) {
@@ -37,15 +37,15 @@ Ext.define('Proxmox.form.KVComboBox', {
},
validator: function(val) {
- var me = this;
+ let me = this;
if (me.editable || val === null || val === '') {
return true;
}
if (me.store.getCount() > 0) {
- var values = me.multiSelect ? val.split(me.delimiter) : [val];
- var items = me.store.getData().collect('value', 'data');
+ let values = me.multiSelect ? val.split(me.delimiter) : [val];
+ let items = me.store.getData().collect('value', 'data');
if (Ext.Array.every(values, function(value) {
return Ext.Array.contains(items, value);
})) {
@@ -54,12 +54,11 @@ Ext.define('Proxmox.form.KVComboBox', {
}
// returns a boolean or string
- /*jslint confusion: true */
return "value '" + val + "' not allowed!";
},
initComponent: function() {
- var me = this;
+ let me = this;
me.store = Ext.create('Ext.data.ArrayStore', {
model: 'KeyValue',
@@ -74,7 +73,7 @@ Ext.define('Proxmox.form.KVComboBox', {
},
setComboItems: function(items) {
- var me = this;
+ let me = this;
me.getStore().setData(items);
},
diff --git a/form/NetworkSelector.js b/form/NetworkSelector.js
index 154ea3a..b87efc1 100644
--- a/form/NetworkSelector.js
+++ b/form/NetworkSelector.js
@@ -3,7 +3,7 @@ Ext.define('Proxmox.form.NetworkSelectorController', {
alias: 'controller.proxmoxNetworkSelectorController',
init: function(view) {
- var me = this;
+ let me = this;
if (!view.nodename) {
throw "missing custom view config: nodename";
@@ -36,7 +36,7 @@ Ext.define('Proxmox.form.NetworkSelector', {
nodename: 'localhost',
setNodename: function(nodename) {
this.nodename = nodename;
- var networkSelectorStore = this.getStore();
+ let networkSelectorStore = this.getStore();
networkSelectorStore.removeAll();
// because of manual local copy of data for ip4/6
this.getPicker().refresh();
diff --git a/form/RRDTypeSelector.js b/form/RRDTypeSelector.js
index f7f7f26..16cac20 100644
--- a/form/RRDTypeSelector.js
+++ b/form/RRDTypeSelector.js
@@ -38,10 +38,10 @@ Ext.define('Proxmox.form.RRDTypeSelector', {
},
// save current selection in the state Provider so RRDView can read it
getState: function() {
- var ind = this.getStore().findExact('id', this.getValue());
- var rec = this.getStore().getAt(ind);
+ let ind = this.getStore().findExact('id', this.getValue());
+ let rec = this.getStore().getAt(ind);
if (!rec) {
- return;
+ return undefined;
}
return {
id: rec.data.id,
diff --git a/form/RealmComboBox.js b/form/RealmComboBox.js
index e391fbf..309bf4f 100644
--- a/form/RealmComboBox.js
+++ b/form/RealmComboBox.js
@@ -13,10 +13,10 @@ Ext.define('Proxmox.form.RealmComboBox', {
if (!success) {
return;
}
- var me = this;
- var val = me.getValue();
+ let me = this;
+ let val = me.getValue();
if (!val || !me.store.findRecord('realm', val)) {
- var def = 'pam';
+ let def = 'pam';
Ext.each(records, function(rec) {
if (rec.data && rec.data.default) {
def = rec.data.realm;
diff --git a/form/TextField.js b/form/TextField.js
index 66f890f..56e5976 100644
--- a/form/TextField.js
+++ b/form/TextField.js
@@ -9,7 +9,7 @@ Ext.define('Proxmox.form.field.Textfield', {
},
getSubmitData: function() {
- var me = this,
+ let me = this,
data = null,
val;
if (!me.disabled && me.submitValue && !me.isFileUpload()) {
@@ -26,9 +26,9 @@ Ext.define('Proxmox.form.field.Textfield', {
},
getSubmitValue: function() {
- var me = this;
+ let me = this;
- var value = this.processRawValue(this.getRawValue());
+ let value = this.processRawValue(this.getRawValue());
if (value !== '') {
return value;
}
diff --git a/grid/ObjectGrid.js b/grid/ObjectGrid.js
index 4a722ac..541cf1d 100644
--- a/grid/ObjectGrid.js
+++ b/grid/ObjectGrid.js
@@ -2,7 +2,7 @@
mandatory config parameters:
rows: an object container where each propery is a key-value object we want to render
- var rows = {
+ let rows = {
keyboard: {
header: gettext('Keyboard Layout'),
editor: 'Your.KeyboardEdit',
@@ -25,7 +25,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
monStoreErrors: false,
add_combobox_row: function(name, text, opts) {
- var me = this;
+ let me = this;
opts = opts || {};
me.rows = me.rows || {};
@@ -58,7 +58,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
add_text_row: function(name, text, opts) {
- var me = this;
+ let me = this;
opts = opts || {};
me.rows = me.rows || {};
@@ -90,7 +90,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
add_boolean_row: function(name, text, opts) {
- var me = this;
+ let me = this;
opts = opts || {};
me.rows = me.rows || {};
@@ -123,7 +123,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
add_integer_row: function(name, text, opts) {
- var me = this;
+ let me = this;
opts = opts || {};
me.rows = me.rows || {};
@@ -159,22 +159,22 @@ Ext.define('Proxmox.grid.ObjectGrid', {
editorConfig: {}, // default config passed to editor
run_editor: function() {
- var me = this;
+ let me = this;
- var sm = me.getSelectionModel();
- var rec = sm.getSelection()[0];
+ let sm = me.getSelectionModel();
+ let rec = sm.getSelection()[0];
if (!rec) {
return;
}
- var rows = me.rows;
- var rowdef = rows[rec.data.key];
+ let rows = me.rows;
+ let rowdef = rows[rec.data.key];
if (!rowdef.editor) {
return;
}
- var win;
- var config;
+ let win;
+ let config;
if (Ext.isString(rowdef.editor)) {
config = Ext.apply({
confid: rec.data.key,
@@ -194,13 +194,13 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
reload: function() {
- var me = this;
+ let me = this;
me.rstore.load();
},
getObjectValue: function(key, defaultValue) {
- var me = this;
- var rec = me.store.getById(key);
+ let me = this;
+ let rec = me.store.getById(key);
if (rec) {
return rec.data.value;
}
@@ -208,19 +208,19 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
renderKey: function(key, metaData, record, rowIndex, colIndex, store) {
- var me = this;
- var rows = me.rows;
- var rowdef = rows && rows[key] ? rows[key] : {};
+ let me = this;
+ let rows = me.rows;
+ let rowdef = rows && rows[key] ? rows[key] : {};
return rowdef.header || key;
},
renderValue: function(value, metaData, record, rowIndex, colIndex, store) {
- var me = this;
- var rows = me.rows;
- var key = record.data.key;
- var rowdef = rows && rows[key] ? rows[key] : {};
+ let me = this;
+ let rows = me.rows;
+ let key = record.data.key;
+ let rowdef = rows && rows[key] ? rows[key] : {};
- var renderer = rowdef.renderer;
+ let renderer = rowdef.renderer;
if (renderer) {
return renderer(value, metaData, record, rowIndex, colIndex, store);
}
@@ -235,7 +235,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
}
},
itemkeyup: function(view, record, item, index, e) {
- if (e.getKey() === e.ENTER && index == this.pressedIndex) {
+ if (e.getKey() === e.ENTER && index === this.pressedIndex) {
this.run_editor();
}
@@ -244,9 +244,9 @@ Ext.define('Proxmox.grid.ObjectGrid', {
},
initComponent: function() {
- var me = this;
+ let me = this;
- var rows = me.rows;
+ let rows = me.rows;
if (!me.rstore) {
if (!me.url) {
@@ -287,7 +287,7 @@ Ext.define('Proxmox.grid.ObjectGrid', {
store.filters.add(Ext.create('Ext.util.Filter', {
filterFn: function(item) {
if (rows) {
- var rowdef = rows[item.data.key];
+ let rowdef = rows[item.data.key];
if (!rowdef || rowdef.visible === false) {
return false;
}
diff --git a/grid/PendingObjectGrid.js b/grid/PendingObjectGrid.js
index 0ab16d6..a5a640c 100644
--- a/grid/PendingObjectGrid.js
+++ b/grid/PendingObjectGrid.js
@@ -3,10 +3,10 @@ Ext.define('Proxmox.grid.PendingObjectGrid', {
alias: ['widget.proxmoxPendingObjectGrid'],
getObjectValue: function(key, defaultValue, pending) {
- var me = this;
- var rec = me.store.getById(key);
+ let me = this;
+ let rec = me.store.getById(key);
if (rec) {
- var value = rec.data.value;
+ let value = rec.data.value;
if (pending) {
if (Ext.isDefined(rec.data.pending) && rec.data.pending !== '') {
value = rec.data.pending;
@@ -25,42 +25,42 @@ Ext.define('Proxmox.grid.PendingObjectGrid', {
},
hasPendingChanges: function(key) {
- var me = this;
- var rows = me.rows;
- var rowdef = rows && rows[key] ? rows[key] : {};
- var keys = rowdef.multiKey || [key];
- var pending = false;
+ let me = this;
+ let rows = me.rows;
+ let rowdef = rows && rows[key] ? rows[key] : {};
+ let keys = rowdef.multiKey || [key];
+ let pending = false;
Ext.Array.each(keys, function(k) {
- var rec = me.store.getById(k);
+ let rec = me.store.getById(k);
if (rec && rec.data && (
- Ext.isDefined(rec.data.pending) && rec.data.pending !== '' ||
+ (Ext.isDefined(rec.data.pending) && rec.data.pending !== '') ||
rec.data.delete === 1
)) {
pending = true;
return false; // break
}
+ return true;
});
return pending;
},
renderValue: function(value, metaData, record, rowIndex, colIndex, store) {
- var me = this;
- var rows = me.rows;
- var key = record.data.key;
- var rowdef = rows && rows[key] ? rows[key] : {};
- var renderer = rowdef.renderer;
- var current = '';
- var pendingdelete = '';
- var pending = '';
+ let me = this;
+ let rows = me.rows;
+ let key = record.data.key;
+ let rowdef = rows && rows[key] ? rows[key] : {};
+ let renderer = rowdef.renderer;
+ let current = '';
+ let pending = '';
if (renderer) {
current = renderer(value, metaData, record, rowIndex, colIndex, store, false);
if (me.hasPendingChanges(key)) {
pending = renderer(record.data.pending, metaData, record, rowIndex, colIndex, store, true);
}
- if (pending == current) {
+ if (pending === current) {
pending = undefined;
}
} else {
@@ -69,14 +69,15 @@ Ext.define('Proxmox.grid.PendingObjectGrid', {
}
if (record.data.delete) {
- var delete_all = true;
+ let delete_all = true;
if (rowdef.multiKey) {
Ext.Array.each(rowdef.multiKey, function(k) {
- var rec = me.store.getById(k);
+ let rec = me.store.getById(k);
if (rec && rec.data && rec.data.delete !== 1) {
delete_all = false;
return false; // break
}
+ return true;
});
}
if (delete_all) {
@@ -92,9 +93,7 @@ Ext.define('Proxmox.grid.PendingObjectGrid', {
},
initComponent: function() {
- var me = this;
-
- var rows = me.rows;
+ let me = this;
if (!me.rstore) {
if (!me.url) {
diff --git a/mixin/CBind.js b/mixin/CBind.js
index 14710a5..afef53a 100644
--- a/mixin/CBind.js
+++ b/mixin/CBind.js
@@ -8,14 +8,14 @@ Ext.define('Proxmox.Mixin.CBind', {
},
cloneTemplates: function() {
- var me = this;
+ let me = this;
if (typeof me.cbindData === "function") {
me.cbindData = me.cbindData(me.initialConfig);
}
me.cbindData = me.cbindData || {};
- var getConfigValue = function(cname) {
+ let getConfigValue = function(cname) {
if (cname in me.initialConfig) {
return me.initialConfig[cname];
}
@@ -33,25 +33,26 @@ Ext.define('Proxmox.Mixin.CBind', {
throw "unable to get cbind data for '" + cname + "'";
};
- var applyCBind = function(obj) {
- var cbind = obj.cbind, prop, cdata, cvalue, match, found;
+ let applyCBind = function(obj) {
+ let cbind = obj.cbind, cdata;
if (!cbind) return;
- for (prop in cbind) {
+ for (const prop in cbind) { // eslint-disable-line guard-for-in
+ let match, found;
cdata = cbind[prop];
found = false;
if (typeof cdata === 'function') {
obj[prop] = cdata(getConfigValue, prop);
found = true;
- } else if (match = /^\{(!)?([a-z_][a-z0-9_]*)\}$/i.exec(cdata)) {
- var cvalue = getConfigValue(match[2]);
+ } else if ((match = /^\{(!)?([a-z_][a-z0-9_]*)\}$/i.exec(cdata))) {
+ let cvalue = getConfigValue(match[2]);
if (match[1]) cvalue = !cvalue;
obj[prop] = cvalue;
found = true;
- } else if (match = /^\{(!)?([a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)+)\}$/i.exec(cdata)) {
- var keys = match[2].split('.');
- var cvalue = getConfigValue(keys.shift());
+ } else if ((match = /^\{(!)?([a-z_][a-z0-9_]*(\.[a-z_][a-z0-9_]*)+)\}$/i.exec(cdata))) {
+ let keys = match[2].split('.');
+ let cvalue = getConfigValue(keys.shift());
keys.forEach(function(k) {
if (k in cvalue) {
cvalue = cvalue[k];
@@ -63,8 +64,8 @@ Ext.define('Proxmox.Mixin.CBind', {
obj[prop] = cvalue;
found = true;
} else {
- obj[prop] = cdata.replace(/{([a-z_][a-z0-9_]*)\}/ig, function(match, cname) {
- var cvalue = getConfigValue(cname);
+ obj[prop] = cdata.replace(/{([a-z_][a-z0-9_]*)\}/ig, (_match, cname) => {
+ let cvalue = getConfigValue(cname);
found = true;
return cvalue;
});
@@ -79,14 +80,15 @@ Ext.define('Proxmox.Mixin.CBind', {
applyCBind(me);
}
- var cloneTemplateArray = function(org) {
- var copy, i, found, el, elcopy, arrayLength;
+ let cloneTemplateObject;
+ let cloneTemplateArray = function(org) {
+ let copy, i, found, el, elcopy, arrayLength;
arrayLength = org.length;
found = false;
for (i = 0; i < arrayLength; i++) {
el = org[i];
- if (el.constructor == Object && el.xtype) {
+ if (el.constructor === Object && el.xtype) {
found = true;
break;
}
@@ -97,13 +99,13 @@ Ext.define('Proxmox.Mixin.CBind', {
copy = [];
for (i = 0; i < arrayLength; i++) {
el = org[i];
- if (el.constructor == Object && el.xtype) {
+ if (el.constructor === Object && el.xtype) {
elcopy = cloneTemplateObject(el);
if (elcopy.cbind) {
applyCBind(elcopy);
}
copy.push(elcopy);
- } else if (el.constructor == Array) {
+ } else if (el.constructor === Array) {
elcopy = cloneTemplateArray(el);
copy.push(elcopy);
} else {
@@ -113,21 +115,21 @@ Ext.define('Proxmox.Mixin.CBind', {
return copy;
};
- var cloneTemplateObject = function(org) {
- var res = {}, prop, el, copy;
- for (prop in org) {
+ cloneTemplateObject = function(org) {
+ let res = {}, prop, el, copy;
+ for (prop in org) { // eslint-disable-line guard-for-in
el = org[prop];
if (el === undefined || el === null) {
res[prop] = el;
continue;
}
- if (el.constructor == Object && el.xtype) {
+ if (el.constructor === Object && el.xtype) {
copy = cloneTemplateObject(el);
if (copy.cbind) {
applyCBind(copy);
}
res[prop] = copy;
- } else if (el.constructor == Array) {
+ } else if (el.constructor === Array) {
copy = cloneTemplateArray(el);
res[prop] = copy;
} else {
@@ -137,17 +139,17 @@ Ext.define('Proxmox.Mixin.CBind', {
return res;
};
- var condCloneProperties = function() {
- var prop, el, i, tmp;
+ let condCloneProperties = function() {
+ let prop, el, tmp;
- for (prop in me) {
+ for (prop in me) { // eslint-disable-line guard-for-in
el = me[prop];
if (el === undefined || el === null) continue;
- if (typeof el === 'object' && el.constructor == Object) {
- if (el.xtype && prop != 'config') {
+ if (typeof el === 'object' && el.constructor === Object) {
+ if (el.xtype && prop !== 'config') {
me[prop] = cloneTemplateObject(el);
}
- } else if (el.constructor == Array) {
+ } else if (el.constructor === Array) {
tmp = cloneTemplateArray(el);
me[prop] = tmp;
}
diff --git a/node/APT.js b/node/APT.js
index a2c5f1c..1b564ef 100644
--- a/node/APT.js
+++ b/node/APT.js
@@ -45,13 +45,13 @@ Ext.define('Proxmox.node.APT', {
],
initComponent: function() {
- var me = this;
+ let me = this;
if (!me.nodename) {
throw "no node name specified";
}
- var store = Ext.create('Ext.data.Store', {
+ let store = Ext.create('Ext.data.Store', {
model: 'apt-pkglist',
groupField: 'Origin',
proxy: {
@@ -66,15 +66,15 @@ Ext.define('Proxmox.node.APT', {
],
});
- var groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
+ let groupingFeature = Ext.create('Ext.grid.feature.Grouping', {
groupHeaderTpl: '{[ "Origin: " + values.name ]} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})',
enableGroupingMenu: false,
});
- var rowBodyFeature = Ext.create('Ext.grid.feature.RowBody', {
+ let rowBodyFeature = Ext.create('Ext.grid.feature.RowBody', {
getAdditionalData: function(data, rowIndex, record, orig) {
- var headerCt = this.view.headerCt;
- var colspan = headerCt.getColumnCount();
+ let headerCt = this.view.headerCt;
+ let colspan = headerCt.getColumnCount();
return {
rowBody: '