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:36:58 +02:00
parent 8acd4d9afc
commit 264c19582b
4 changed files with 56 additions and 59 deletions

View File

@ -1,4 +1,3 @@
/*global Proxmox*/
Ext.define('PBS.Application', { Ext.define('PBS.Application', {
extend: 'Ext.app.Application', extend: 'Ext.app.Application',
@ -6,7 +5,7 @@ Ext.define('PBS.Application', {
appProperty: 'app', appProperty: 'app',
stores: [ stores: [
'NavigationStore' 'NavigationStore',
], ],
layout: 'fit', layout: 'fit',
@ -29,7 +28,7 @@ Ext.define('PBS.Application', {
PBS.view = view; PBS.view = view;
me.view = view; me.view = view;
if (me.currentView != undefined) { if (me.currentView !== undefined) {
me.currentView.destroy(); me.currentView.destroy();
} }
@ -58,7 +57,7 @@ Ext.define('PBS.Application', {
} else { } else {
me.changeView('mainview', true); me.changeView('mainview', true);
} }
} },
}); });
Ext.application('PBS.Application'); Ext.application('PBS.Application');

View File

@ -6,9 +6,9 @@ Ext.define('pbs-prune-list', {
{ {
name: 'backup-time', name: 'backup-time',
type: 'date', type: 'date',
dateFormat: 'timestamp' dateFormat: 'timestamp',
}, },
] ],
}); });
Ext.define('PBS.DataStorePruneInputPanel', { Ext.define('PBS.DataStorePruneInputPanel', {
@ -52,21 +52,21 @@ Ext.define('PBS.DataStorePruneInputPanel', {
method: "POST", method: "POST",
params: params, params: params,
callback: function() { callback: function() {
return; // for easy breakpoint setting // for easy breakpoint setting
}, },
failure: function (response, opts) { failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus); Ext.Msg.alert(gettext('Error'), response.htmlStatus);
}, },
success: function(response, options) { success: function(response, options) {
var data = response.result.data; var data = response.result.data;
view.prune_store.setData(data); view.prune_store.setData(data);
} },
}); });
}, },
control: { control: {
field: { change: 'reload' } field: { change: 'reload' },
} },
}, },
column1: [ column1: [
@ -111,16 +111,16 @@ Ext.define('PBS.DataStorePruneInputPanel', {
allowBlank: true, allowBlank: true,
fieldLabel: gettext('keep-yearly'), fieldLabel: gettext('keep-yearly'),
minValue: 1, minValue: 1,
} },
], ],
initComponent : function() { initComponent: function() {
var me = this; var me = this;
me.prune_store = Ext.create('Ext.data.Store', { me.prune_store = Ext.create('Ext.data.Store', {
model: 'pbs-prune-list', model: 'pbs-prune-list',
sorters: { property: 'backup-time', direction: 'DESC' } sorters: { property: 'backup-time', direction: 'DESC' },
}); });
me.column2 = [ me.column2 = [
@ -145,14 +145,14 @@ Ext.define('PBS.DataStorePruneInputPanel', {
}, },
{ {
text: "keep", text: "keep",
dataIndex: 'keep' dataIndex: 'keep',
} },
] ],
} },
]; ];
me.callParent(); me.callParent();
} },
}); });
Ext.define('PBS.DataStorePrune', { Ext.define('PBS.DataStorePrune', {
@ -163,7 +163,7 @@ Ext.define('PBS.DataStorePrune', {
isCreate: true, isCreate: true,
initComponent : function() { initComponent: function() {
var me = this; var me = this;
if (!me.datastore) { if (!me.datastore) {
@ -183,10 +183,10 @@ Ext.define('PBS.DataStorePrune', {
xtype: 'pbsDataStorePruneInputPanel', xtype: 'pbsDataStorePruneInputPanel',
url: '/api2/extjs/admin/datastore/' + me.datastore + "/prune", url: '/api2/extjs/admin/datastore/' + me.datastore + "/prune",
backup_type: me.backup_type, backup_type: me.backup_type,
backup_id: me.backup_id backup_id: me.backup_id,
}] }],
}); });
me.callParent(); me.callParent();
} },
}); });

View File

@ -19,10 +19,10 @@ Ext.define('pve-rrd-datastore', {
return 0; return 0;
} }
return (data.io_ticks*1000.0)/ios; return (data.io_ticks*1000.0)/ios;
} },
}, },
{ type: 'date', dateFormat: 'timestamp', name: 'time' } { type: 'date', dateFormat: 'timestamp', name: 'time' },
] ],
}); });
Ext.define('PBS.DataStoreStatistic', { Ext.define('PBS.DataStoreStatistic', {
@ -40,11 +40,11 @@ Ext.define('PBS.DataStoreStatistic', {
throw "no datastore specified"; throw "no datastore specified";
} }
me.tbar = [ '->', { xtype: 'proxmoxRRDTypeSelector' } ]; me.tbar = ['->', { xtype: 'proxmoxRRDTypeSelector' }];
var rrdstore = Ext.create('Proxmox.data.RRDStore', { var rrdstore = Ext.create('Proxmox.data.RRDStore', {
rrdurl: "/api2/json/admin/datastore/" + me.datastore + "/rrd", rrdurl: "/api2/json/admin/datastore/" + me.datastore + "/rrd",
model: 'pve-rrd-datastore' model: 'pve-rrd-datastore',
}); });
me.items = { me.items = {
@ -55,38 +55,38 @@ Ext.define('PBS.DataStoreStatistic', {
defaults: { defaults: {
minHeight: 320, minHeight: 320,
padding: 5, padding: 5,
columnWidth: 1 columnWidth: 1,
}, },
items: [ items: [
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Storage usage (bytes)'), title: gettext('Storage usage (bytes)'),
fields: ['total','used'], fields: ['total', 'used'],
fieldTitles: [gettext('Total'), gettext('Storage usage')], fieldTitles: [gettext('Total'), gettext('Storage usage')],
store: rrdstore store: rrdstore,
}, },
{ {
xtype: 'proxmoxRRDChart', xtype: 'proxmoxRRDChart',
title: gettext('Transfer Rate (bytes/second)'), title: gettext('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('Input/Output Operations per Second (IOPS)'), title: gettext('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('IO Delay (ms)'), title: gettext('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 = {
@ -99,6 +99,6 @@ Ext.define('PBS.DataStoreStatistic', {
}; };
me.callParent(); me.callParent();
} },
}); });

View File

@ -10,7 +10,7 @@ Ext.define('PBS.store.NavigationStore', {
text: gettext('Dashboard'), text: gettext('Dashboard'),
iconCls: 'fa fa-tachometer', iconCls: 'fa fa-tachometer',
path: 'pbsDashboard', path: 'pbsDashboard',
leaf: true leaf: true,
}, },
{ {
text: gettext('Configuration'), text: gettext('Configuration'),
@ -22,13 +22,13 @@ Ext.define('PBS.store.NavigationStore', {
text: gettext('User Management'), text: gettext('User Management'),
iconCls: 'fa fa-user', iconCls: 'fa fa-user',
path: 'pbsUserView', path: 'pbsUserView',
leaf: true leaf: true,
}, },
{ {
text: gettext('Permissions'), text: gettext('Permissions'),
iconCls: 'fa fa-unlock', iconCls: 'fa fa-unlock',
path: 'pbsACLView', path: 'pbsACLView',
leaf: true leaf: true,
}, },
{ {
text: gettext('Remotes'), text: gettext('Remotes'),
@ -46,9 +46,9 @@ Ext.define('PBS.store.NavigationStore', {
text: gettext('Subscription'), text: gettext('Subscription'),
iconCls: 'fa fa-support', iconCls: 'fa fa-support',
path: 'pbsSubscription', path: 'pbsSubscription',
leaf: true leaf: true,
} },
] ],
}, },
{ {
text: gettext('Administration'), text: gettext('Administration'),
@ -75,19 +75,19 @@ Ext.define('PBS.store.NavigationStore', {
path: 'pbsZFSList', path: 'pbsZFSList',
leaf: true, leaf: true,
}, },
] ],
} },
] ],
}, },
{ {
text: gettext('Datastore'), text: gettext('Datastore'),
iconCls: 'fa fa-archive', iconCls: 'fa fa-archive',
path: 'pbsDataStoreConfig', path: 'pbsDataStoreConfig',
expanded: true, expanded: true,
leaf: false leaf: false,
}, },
] ],
} },
}); });
Ext.define('PBS.view.main.NavigationTree', { Ext.define('PBS.view.main.NavigationTree', {
@ -98,13 +98,12 @@ Ext.define('PBS.view.main.NavigationTree', {
xclass: 'Ext.app.ViewController', xclass: 'Ext.app.ViewController',
init: function(view) { init: function(view) {
view.rstore = Ext.create('Proxmox.data.UpdateStore', { view.rstore = Ext.create('Proxmox.data.UpdateStore', {
autoStart: true, autoStart: true,
interval: 15 * 1000, interval: 15 * 1000,
storeId: 'pbs-datastore-list', storeId: 'pbs-datastore-list',
storeid: 'pbs-datastore-list', storeid: 'pbs-datastore-list',
model: 'pbs-datastore-list' model: 'pbs-datastore-list',
}); });
view.rstore.on('load', this.onLoad, this); view.rstore.on('load', this.onLoad, this);
@ -119,7 +118,7 @@ Ext.define('PBS.view.main.NavigationTree', {
// FIXME: newly added always get appended to the end.. // FIXME: newly added always get appended to the end..
records.sort((a, b) => { records.sort((a, b) => {
if (a.id > b.id) return 1; if (a.id > b.id) return 1;
if (a.id < b.id) return -1; if (a.id < b.id) return -1;
return 0; return 0;
}); });
@ -128,29 +127,28 @@ Ext.define('PBS.view.main.NavigationTree', {
var length = records.length; var length = records.length;
var lookup_hash = {}; var lookup_hash = {};
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
var name = records[i].id; let name = records[i].id;
lookup_hash[name] = true; lookup_hash[name] = true;
if (!list.findChild('text', name, false)) { if (!list.findChild('text', name, false)) {
list.appendChild({ list.appendChild({
text: name, text: name,
path: `DataStore-${name}`, path: `DataStore-${name}`,
iconCls: 'fa fa-database', iconCls: 'fa fa-database',
leaf: true leaf: true,
}); });
} }
} }
var erase_list = []; var erase_list = [];
list.eachChild(function(node) { list.eachChild(function(node) {
var name = node.data.text; let name = node.data.text;
if (!lookup_hash[name]) { if (!lookup_hash[name]) {
erase_list.push(node); erase_list.push(node);
} }
}); });
Ext.Array.forEach(erase_list, function(node) { node.erase(); }); Ext.Array.forEach(erase_list, function(node) { node.erase(); });
},
}
}, },
select: function(path) { select: function(path) {
@ -163,5 +161,5 @@ Ext.define('PBS.view.main.NavigationTree', {
expanderOnly: true, expanderOnly: true,
expanderFirst: false, expanderFirst: false,
store: 'NavigationStore', store: 'NavigationStore',
ui: 'nav' ui: 'nav',
}); });