ui: some more eslint auto-fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-09-25 18:34:54 +02:00
parent 65b0cea6bd
commit 8acd4d9afc
5 changed files with 103 additions and 106 deletions

View File

@ -7,7 +7,6 @@ Ext.define('PBS.LoginView', {
submitForm: function() { submitForm: function() {
var me = this; var me = this;
var view = me.getView();
var loginForm = me.lookupReference('loginForm'); var loginForm = me.lookupReference('loginForm');
var unField = me.lookupReference('usernameField'); var unField = me.lookupReference('usernameField');
var saveunField = me.lookupReference('saveunField'); var saveunField = me.lookupReference('saveunField');
@ -19,7 +18,7 @@ Ext.define('PBS.LoginView', {
let params = loginForm.getValues(); let params = loginForm.getValues();
params.username = params.username + '@' + params.realm; params.username = params.username + '@' + params.realm;
delete(params.realm); delete params.realm;
if (loginForm.isVisible()) { if (loginForm.isVisible()) {
loginForm.mask(gettext('Please wait...'), 'x-mask-loading'); loginForm.mask(gettext('Please wait...'), 'x-mask-loading');
@ -48,9 +47,9 @@ Ext.define('PBS.LoginView', {
loginForm.unmask(); loginForm.unmask();
Ext.MessageBox.alert( Ext.MessageBox.alert(
gettext('Error'), gettext('Error'),
gettext('Login failed. Please try again') gettext('Login failed. Please try again'),
); );
} },
}); });
}, },
@ -63,7 +62,7 @@ Ext.define('PBS.LoginView', {
pf.focus(false); pf.focus(false);
} }
} }
} },
}, },
'field[name=lang]': { 'field[name=lang]': {
change: function(f, value) { change: function(f, value) {
@ -71,10 +70,10 @@ Ext.define('PBS.LoginView', {
Ext.util.Cookies.set('PBSLangCookie', value, dt); Ext.util.Cookies.set('PBSLangCookie', value, dt);
this.getView().mask(gettext('Please wait...'), 'x-mask-loading'); this.getView().mask(gettext('Please wait...'), 'x-mask-loading');
window.location.reload(); window.location.reload();
} },
}, },
'button[reference=loginButton]': { 'button[reference=loginButton]': {
click: 'submitForm' click: 'submitForm',
}, },
'window[reference=loginwindow]': { 'window[reference=loginwindow]': {
show: function() { show: function() {
@ -91,15 +90,15 @@ Ext.define('PBS.LoginView', {
var pwField = this.lookupReference('passwordField'); var pwField = this.lookupReference('passwordField');
pwField.focus(); pwField.focus();
} }
} },
} },
} },
}, },
plugins: 'viewport', plugins: 'viewport',
layout: { layout: {
type: 'border' type: 'border',
}, },
items: [ items: [
@ -108,7 +107,7 @@ Ext.define('PBS.LoginView', {
xtype: 'container', xtype: 'container',
layout: { layout: {
type: 'hbox', type: 'hbox',
align: 'middle' align: 'middle',
}, },
margin: '2 5 2 5', margin: '2 5 2 5',
height: 38, height: 38,
@ -119,12 +118,12 @@ Ext.define('PBS.LoginView', {
}, },
{ {
xtype: 'versioninfo', xtype: 'versioninfo',
makeApiCall: false makeApiCall: false,
} },
] ],
}, },
{ {
region: 'center' region: 'center',
}, },
{ {
xtype: 'window', xtype: 'window',
@ -138,7 +137,7 @@ Ext.define('PBS.LoginView', {
defaultFocus: 'usernameField', defaultFocus: 'usernameField',
layout: { layout: {
type: 'auto' type: 'auto',
}, },
title: gettext('Proxmox Backup Server Login'), title: gettext('Proxmox Backup Server Login'),
@ -147,7 +146,7 @@ Ext.define('PBS.LoginView', {
{ {
xtype: 'form', xtype: 'form',
layout: { layout: {
type: 'form' type: 'form',
}, },
defaultButton: 'loginButton', defaultButton: 'loginButton',
url: '/api2/extjs/access/ticket', url: '/api2/extjs/access/ticket',
@ -155,7 +154,7 @@ Ext.define('PBS.LoginView', {
fieldDefaults: { fieldDefaults: {
labelAlign: 'right', labelAlign: 'right',
allowBlank: false allowBlank: false,
}, },
items: [ items: [
@ -165,7 +164,7 @@ Ext.define('PBS.LoginView', {
name: 'username', name: 'username',
itemId: 'usernameField', itemId: 'usernameField',
reference: 'usernameField', reference: 'usernameField',
stateId: 'login-username' stateId: 'login-username',
}, },
{ {
xtype: 'textfield', xtype: 'textfield',
@ -177,7 +176,7 @@ Ext.define('PBS.LoginView', {
}, },
{ {
xtype: 'pmxRealmComboBox', xtype: 'pmxRealmComboBox',
name: 'realm' name: 'realm',
}, },
{ {
xtype: 'proxmoxLanguageSelector', xtype: 'proxmoxLanguageSelector',
@ -185,8 +184,8 @@ Ext.define('PBS.LoginView', {
value: Ext.util.Cookies.get('PBSLangCookie') || Proxmox.defaultLang || 'en', value: Ext.util.Cookies.get('PBSLangCookie') || Proxmox.defaultLang || 'en',
name: 'lang', name: 'lang',
reference: 'langField', reference: 'langField',
submitValue: false submitValue: false,
} },
], ],
buttons: [ buttons: [
{ {
@ -197,16 +196,16 @@ Ext.define('PBS.LoginView', {
stateId: 'login-saveusername', stateId: 'login-saveusername',
labelWidth: 250, labelWidth: 250,
labelAlign: 'right', labelAlign: 'right',
submitValue: false submitValue: false,
}, },
{ {
text: gettext('Login'), text: gettext('Login'),
reference: 'loginButton', reference: 'loginButton',
formBind: true formBind: true,
} },
] ],
} },
] ],
} },
] ],
}); });

View File

@ -11,10 +11,10 @@ Ext.define('PBS.MainView', {
action: 'changePath', action: 'changePath',
before: 'beforeChangePath', before: 'beforeChangePath',
conditions: { conditions: {
':path' : '(?:([%a-zA-Z0-9\\-\\_\\s,\.]+))', ':path': '(?:([%a-zA-Z0-9\\-\\_\\s,.]+))',
':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?' ':subpath': '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?',
} },
} },
}, },
beforeChangePath: function(path, subpath, action) { beforeChangePath: function(path, subpath, action) {
@ -79,7 +79,7 @@ Ext.define('PBS.MainView', {
obj = contentpanel.add({ obj = contentpanel.add({
xtype: path, xtype: path,
nodename: 'localhost', nodename: 'localhost',
border: false border: false,
}); });
} }
@ -113,7 +113,6 @@ Ext.define('PBS.MainView', {
if (lastpanel) { if (lastpanel) {
contentpanel.remove(lastpanel, { destroy: true }); contentpanel.remove(lastpanel, { destroy: true });
} }
}, },
logout: function() { logout: function() {
@ -126,8 +125,8 @@ Ext.define('PBS.MainView', {
control: { control: {
'[reference=logoutButton]': { '[reference=logoutButton]': {
click: 'logout' click: 'logout',
} },
}, },
init: function(view) { init: function(view) {
@ -139,7 +138,7 @@ Ext.define('PBS.MainView', {
// show login on requestexception // show login on requestexception
// fixme: what about other errors // fixme: what about other errors
Ext.Ajax.on('requestexception', function(conn, response, options) { Ext.Ajax.on('requestexception', function(conn, response, options) {
if (response.status == 401) { // auth failure if (response.status === 401 || response.status === '401') { // auth failure
me.logout(); me.logout();
} }
}); });
@ -155,7 +154,7 @@ Ext.define('PBS.MainView', {
Ext.Ajax.request({ Ext.Ajax.request({
params: { params: {
username: Proxmox.UserName, username: Proxmox.UserName,
password: ticket password: ticket,
}, },
url: '/api2/json/access/ticket', url: '/api2/json/access/ticket',
method: 'POST', method: 'POST',
@ -165,17 +164,17 @@ Ext.define('PBS.MainView', {
success: function(response, opts) { success: function(response, opts) {
var obj = Ext.decode(response.responseText); var obj = Ext.decode(response.responseText);
PBS.Utils.updateLoginData(obj.data); PBS.Utils.updateLoginData(obj.data);
} },
}); });
}, },
interval: 15*60*1000 interval: 15*60*1000,
}); });
// select treeitem and load page from url fragment, if set // select treeitem and load page from url fragment, if set
let token = Ext.util.History.getToken() || 'pbsDashboard'; let token = Ext.util.History.getToken() || 'pbsDashboard';
this.redirectTo(token, true); this.redirectTo(token, true);
} },
}, },
plugins: 'viewport', plugins: 'viewport',
@ -188,7 +187,7 @@ Ext.define('PBS.MainView', {
xtype: 'container', xtype: 'container',
layout: { layout: {
type: 'hbox', type: 'hbox',
align: 'middle' align: 'middle',
}, },
margin: '2 0 2 5', margin: '2 0 2 5',
height: 38, height: 38,
@ -229,7 +228,7 @@ Ext.define('PBS.MainView', {
style: { style: {
// proxmox dark grey p light grey as border // proxmox dark grey p light grey as border
backgroundColor: '#464d4d', backgroundColor: '#464d4d',
borderColor: '#ABBABA' borderColor: '#ABBABA',
}, },
margin: '0 5 0 0', margin: '0 5 0 0',
iconCls: 'fa fa-user', iconCls: 'fa fa-user',
@ -241,7 +240,7 @@ Ext.define('PBS.MainView', {
}, },
], ],
}, },
] ],
}, },
{ {
xtype: 'panel', xtype: 'panel',
@ -250,7 +249,7 @@ Ext.define('PBS.MainView', {
region: 'west', region: 'west',
layout: { layout: {
type: 'vbox', type: 'vbox',
align: 'stretch' align: 'stretch',
}, },
items: [{ items: [{
xtype: 'navigationtree', xtype: 'navigationtree',
@ -260,20 +259,20 @@ Ext.define('PBS.MainView', {
// because of a bug where a viewcontroller does not detect // because of a bug where a viewcontroller does not detect
// the selectionchange event of a treelist // the selectionchange event of a treelist
listeners: { listeners: {
selectionchange: 'navigate' selectionchange: 'navigate',
} },
}, { }, {
xtype: 'box', xtype: 'box',
cls: 'x-treelist-nav', cls: 'x-treelist-nav',
flex: 1 flex: 1,
}] }],
}, },
{ {
xtype: 'panel', xtype: 'panel',
layout: { type: 'card' }, layout: { type: 'card' },
region: 'center', region: 'center',
border: false, border: false,
reference: 'contentpanel' reference: 'contentpanel',
} },
] ],
}); });

View File

@ -6,14 +6,14 @@ Ext.define('pve-rrd-node', {
// percentage // percentage
convert: function(value) { convert: function(value) {
return value*100; return value*100;
} },
}, },
{ {
name: 'iowait', name: 'iowait',
// percentage // percentage
convert: function(value) { convert: function(value) {
return value*100; return value*100;
} },
}, },
'netin', 'netin',
'netout', 'netout',
@ -33,15 +33,15 @@ Ext.define('pve-rrd-node', {
let ios = 0; let ios = 0;
if (data.read_ios !== undefined) { ios += data.read_ios; } if (data.read_ios !== undefined) { ios += data.read_ios; }
if (data.write_ios !== undefined) { ios += data.write_ios; } if (data.write_ios !== undefined) { ios += data.write_ios; }
if (ios == 0 || data.io_ticks === undefined) { if (ios === 0 || data.io_ticks === undefined) {
return undefined; return undefined;
} }
return (data.io_ticks*1000.0)/ios; return (data.io_ticks*1000.0)/ios;
} },
}, },
'loadavg', 'loadavg',
{ type: 'date', dateFormat: 'timestamp', name: 'time' } { type: 'date', dateFormat: 'timestamp', name: 'time' },
] ],
}); });
Ext.define('PBS.ServerStatus', { Ext.define('PBS.ServerStatus', {
extend: 'Ext.panel.Panel', extend: 'Ext.panel.Panel',
@ -62,7 +62,7 @@ Ext.define('PBS.ServerStatus', {
waitMsgTarget: me, waitMsgTarget: me,
failure: function(response, opts) { failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus); Ext.Msg.alert(gettext('Error'), response.htmlStatus);
} },
}); });
}; };
@ -73,7 +73,7 @@ Ext.define('PBS.ServerStatus', {
handler: function() { handler: function() {
node_command('reboot'); node_command('reboot');
}, },
iconCls: 'fa fa-undo' iconCls: 'fa fa-undo',
}); });
var shutdownBtn = Ext.create('Proxmox.button.Button', { var shutdownBtn = Ext.create('Proxmox.button.Button', {
@ -83,7 +83,7 @@ Ext.define('PBS.ServerStatus', {
handler: function() { handler: function() {
node_command('shutdown'); node_command('shutdown');
}, },
iconCls: 'fa fa-power-off' iconCls: 'fa fa-power-off',
}); });
var consoleBtn = Ext.create('Proxmox.button.Button', { var consoleBtn = Ext.create('Proxmox.button.Button', {
@ -91,14 +91,14 @@ Ext.define('PBS.ServerStatus', {
iconCls: 'fa fa-terminal', iconCls: 'fa fa-terminal',
handler: function() { handler: function() {
Proxmox.Utils.openXtermJsViewer('shell', 0, Proxmox.NodeName); Proxmox.Utils.openXtermJsViewer('shell', 0, Proxmox.NodeName);
} },
}); });
me.tbar = [consoleBtn, restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' }]; me.tbar = [consoleBtn, restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' }];
var rrdstore = Ext.create('Proxmox.data.RRDStore', { var rrdstore = Ext.create('Proxmox.data.RRDStore', {
rrdurl: "/api2/json/nodes/localhost/rrd", rrdurl: "/api2/json/nodes/localhost/rrd",
model: 'pve-rrd-node' model: 'pve-rrd-node',
}); });
me.items = { me.items = {
@ -109,7 +109,7 @@ Ext.define('PBS.ServerStatus', {
defaults: { defaults: {
minHeight: 320, minHeight: 320,
padding: 5, padding: 5,
columnWidth: 1 columnWidth: 1,
}, },
items: [ items: [
{ {
@ -117,64 +117,64 @@ Ext.define('PBS.ServerStatus', {
title: gettext('CPU usage'), title: gettext('CPU usage'),
fields: ['cpu', 'iowait'], fields: ['cpu', 'iowait'],
fieldTitles: [gettext('CPU usage'), gettext('IO wait')], fieldTitles: [gettext('CPU usage'), gettext('IO wait')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Server load'), title: gettext('Server load'),
fields: ['loadavg'], fields: ['loadavg'],
fieldTitles: [gettext('Load average')], fieldTitles: [gettext('Load average')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Memory usage'), title: gettext('Memory usage'),
fields: ['memtotal', 'memused'], fields: ['memtotal', 'memused'],
fieldTitles: [gettext('Total'), gettext('RAM usage')], fieldTitles: [gettext('Total'), gettext('RAM usage')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Swap usage'), title: gettext('Swap usage'),
fields: ['swaptotal', 'swapused'], fields: ['swaptotal', 'swapused'],
fieldTitles: [gettext('Total'), gettext('Swap usage')], fieldTitles: [gettext('Total'), gettext('Swap usage')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Network traffic'), title: gettext('Network traffic'),
fields: ['netin', 'netout'], fields: ['netin', 'netout'],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Root Disk usage'), title: gettext('Root Disk usage'),
fields: ['total', 'used'], fields: ['total', 'used'],
fieldTitles: [gettext('Total'), gettext('Disk usage')], fieldTitles: [gettext('Total'), gettext('Disk usage')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Root Disk Transfer Rate (bytes/second)'), title: gettext('Root Disk Transfer Rate (bytes/second)'),
fields: ['read_bytes', 'write_bytes'], fields: ['read_bytes', 'write_bytes'],
fieldTitles: [gettext('Read'), gettext('Write')], fieldTitles: [gettext('Read'), gettext('Write')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Root Disk Input/Output Operations per Second (IOPS)'), title: gettext('Root Disk Input/Output Operations per Second (IOPS)'),
fields: ['read_ios', 'write_ios'], fields: ['read_ios', 'write_ios'],
fieldTitles: [gettext('Read'), gettext('Write')], fieldTitles: [gettext('Read'), gettext('Write')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Root Disk IO Delay (ms)'), title: gettext('Root Disk IO Delay (ms)'),
fields: ['io_delay'], fields: ['io_delay'],
fieldTitles: [gettext('IO Delay')], fieldTitles: [gettext('IO Delay')],
store: rrdstore store: rrdstore,
}, },
] ],
}; };
me.listeners = { me.listeners = {
@ -187,6 +187,6 @@ Ext.define('PBS.ServerStatus', {
}; };
me.callParent(); me.callParent();
} },
}); });

View File

@ -1,4 +1,3 @@
/*global Proxmox*/
Ext.define('PBS.view.main.VersionInfo', { Ext.define('PBS.view.main.VersionInfo', {
extend: 'Ext.Component', extend: 'Ext.Component',
xtype: 'versioninfo', xtype: 'versioninfo',
@ -6,14 +5,14 @@ Ext.define('PBS.view.main.VersionInfo',{
makeApiCall: true, makeApiCall: true,
data: { data: {
version: false version: false,
}, },
tpl: [ tpl: [
'Backup Server', 'Backup Server',
'<tpl if="version">', '<tpl if="version">',
' {version}-{release}', ' {version}-{release}',
'</tpl>' '</tpl>',
], ],
initComponent: function() { initComponent: function() {
@ -26,8 +25,8 @@ Ext.define('PBS.view.main.VersionInfo',{
method: 'GET', method: 'GET',
success: function(response) { success: function(response) {
me.update(response.result.data); me.update(response.result.data);
} },
}); });
} }
} },
}); });

View File

@ -14,7 +14,7 @@ Ext.define('PBS.admin.ZFSList', {
nodename: me.nodename, nodename: me.nodename,
listeners: { listeners: {
destroy: function() { me.reload(); }, destroy: function() { me.reload(); },
} },
}).show(); }).show();
}, },
@ -49,7 +49,7 @@ Ext.define('PBS.admin.ZFSList', {
} }
let url = `/api2/json/nodes/${view.nodename}/disks/zfs`; let url = `/api2/json/nodes/${view.nodename}/disks/zfs`;
view.getStore().getProxy().setUrl(url) view.getStore().getProxy().setUrl(url);
Proxmox.Utils.monStoreErrors(view, view.getStore(), true); Proxmox.Utils.monStoreErrors(view, view.getStore(), true);
@ -61,34 +61,34 @@ Ext.define('PBS.admin.ZFSList', {
{ {
text: gettext('Name'), text: gettext('Name'),
dataIndex: 'name', dataIndex: 'name',
flex: 1 flex: 1,
}, },
{ {
header: gettext('Size'), header: gettext('Size'),
renderer: Proxmox.Utils.format_size, renderer: Proxmox.Utils.format_size,
dataIndex: 'size' dataIndex: 'size',
}, },
{ {
header: gettext('Free'), header: gettext('Free'),
renderer: Proxmox.Utils.format_size, renderer: Proxmox.Utils.format_size,
dataIndex: 'free' dataIndex: 'free',
}, },
{ {
header: gettext('Allocated'), header: gettext('Allocated'),
renderer: Proxmox.Utils.format_size, renderer: Proxmox.Utils.format_size,
dataIndex: 'alloc' dataIndex: 'alloc',
}, },
{ {
header: gettext('Fragmentation'), header: gettext('Fragmentation'),
renderer: function(value) { renderer: function(value) {
return value.toString() + '%'; return value.toString() + '%';
}, },
dataIndex: 'frag' dataIndex: 'frag',
}, },
{ {
header: gettext('Health'), header: gettext('Health'),
renderer: Proxmox.Utils.render_zfs_health, renderer: Proxmox.Utils.render_zfs_health,
dataIndex: 'health' dataIndex: 'health',
}, },
{ {
header: gettext('Deduplication'), header: gettext('Deduplication'),
@ -96,8 +96,8 @@ Ext.define('PBS.admin.ZFSList', {
renderer: function(value) { renderer: function(value) {
return value.toFixed(2).toString() + 'x'; return value.toFixed(2).toString() + 'x';
}, },
dataIndex: 'dedup' dataIndex: 'dedup',
} },
], ],
rootVisible: false, rootVisible: false,
@ -118,7 +118,7 @@ Ext.define('PBS.admin.ZFSList', {
xtype: 'proxmoxButton', xtype: 'proxmoxButton',
disabled: true, disabled: true,
handler: 'openDetailWindow', handler: 'openDetailWindow',
} },
], ],
listeners: { listeners: {
@ -130,7 +130,7 @@ Ext.define('PBS.admin.ZFSList', {
proxy: { proxy: {
type: 'proxmox', type: 'proxmox',
}, },
sorters: 'name' sorters: 'name',
}, },
}); });