From 6ab77df3f50a9f910df512c3c405ed549c13a567 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 25 Sep 2020 18:40:03 +0200 Subject: [PATCH] ui: some more eslint auto-fixes Signed-off-by: Thomas Lamprecht --- www/ServerAdministration.js | 17 ++++++----- www/Subscription.js | 42 +++++++++++++--------------- www/SystemConfiguration.js | 30 ++++++++------------ www/Utils.js | 32 ++++++++------------- www/config/SyncView.js | 6 ++-- www/dashboard/DataStoreStatistics.js | 14 +++++----- www/dashboard/LongestTasks.js | 3 +- www/dashboard/RunningTasks.js | 2 +- www/dashboard/TaskSummary.js | 4 +-- www/window/FileBrowser.js | 20 ++++++------- 10 files changed, 74 insertions(+), 96 deletions(-) diff --git a/www/ServerAdministration.js b/www/ServerAdministration.js index 076d5543..936d8a07 100644 --- a/www/ServerAdministration.js +++ b/www/ServerAdministration.js @@ -1,4 +1,3 @@ -/*global Proxmox*/ Ext.define('PBS.ServerAdministration', { extend: 'Ext.tab.Panel', alias: 'widget.pbsServerAdministration', @@ -14,13 +13,13 @@ Ext.define('PBS.ServerAdministration', { init: function(view) { var upgradeBtn = view.lookupReference('upgradeBtn'); upgradeBtn.setDisabled(!(Proxmox.UserName && Proxmox.UserName === 'root@pam')); - } + }, }, items: [ { xtype: 'pbsServerStatus', - itemId: 'status' + itemId: 'status', }, { xtype: 'proxmoxNodeServiceView', @@ -32,7 +31,7 @@ Ext.define('PBS.ServerAdministration', { 'proxmox-backup': true, 'proxmox-backup-proxy': true, }, - nodename: 'localhost' + nodename: 'localhost', }, { xtype: 'proxmoxNodeAPT', @@ -44,10 +43,10 @@ Ext.define('PBS.ServerAdministration', { text: gettext('Upgrade'), handler: function() { Proxmox.Utils.openXtermJsViewer('upgrade', 0, 'localhost'); - } + }, }, itemId: 'updates', - nodename: 'localhost' + nodename: 'localhost', }, { xtype: 'proxmoxJournalView', @@ -60,9 +59,9 @@ Ext.define('PBS.ServerAdministration', { itemId: 'tasks', title: gettext('Tasks'), height: 'auto', - nodename: 'localhost' - } - ] + nodename: 'localhost', + }, + ], }); diff --git a/www/Subscription.js b/www/Subscription.js index 8746091f..9982c62c 100644 --- a/www/Subscription.js +++ b/www/Subscription.js @@ -1,4 +1,3 @@ -/*global Blob,Proxmox*/ Ext.define('PBS.SubscriptionKeyEdit', { extend: 'Proxmox.window.Edit', @@ -12,8 +11,8 @@ Ext.define('PBS.SubscriptionKeyEdit', { xtype: 'textfield', name: 'key', value: '', - fieldLabel: gettext('Subscription Key') - } + fieldLabel: gettext('Subscription Key'), + }, }); Ext.define('PBS.Subscription', { @@ -27,10 +26,10 @@ Ext.define('PBS.Subscription', { onlineHelp: 'getting_help', viewConfig: { - enableTextSelection: true + enableTextSelection: true, }, - initComponent : function() { + initComponent: function() { var me = this; var reload = function() { @@ -40,7 +39,6 @@ Ext.define('PBS.Subscription', { var baseurl = '/nodes/localhost/subscription'; var render_status = function(value) { - var message = me.getObjectValue('message'); if (message) { @@ -51,31 +49,31 @@ Ext.define('PBS.Subscription', { var rows = { productname: { - header: gettext('Type') + header: gettext('Type'), }, key: { - header: gettext('Subscription Key') + header: gettext('Subscription Key'), }, status: { header: gettext('Status'), - renderer: render_status + renderer: render_status, }, message: { - visible: false + visible: false, }, serverid: { - header: gettext('Server ID') + header: gettext('Server ID'), }, sockets: { - header: gettext('Sockets') + header: gettext('Sockets'), }, checktime: { header: gettext('Last checked'), - renderer: Proxmox.Utils.render_timestamp + renderer: Proxmox.Utils.render_timestamp, }, nextduedate: { - header: gettext('Next due date') - } + header: gettext('Next due date'), + }, }; Ext.apply(me, { @@ -86,11 +84,11 @@ Ext.define('PBS.Subscription', { text: gettext('Upload Subscription Key'), handler: function() { var win = Ext.create('PBS.SubscriptionKeyEdit', { - url: '/api2/extjs/' + baseurl + url: '/api2/extjs/' + baseurl, }); win.show(); win.on('destroy', reload); - } + }, }, { text: gettext('Check'), @@ -103,16 +101,16 @@ Ext.define('PBS.Subscription', { failure: function(response, opts) { Ext.Msg.alert(gettext('Error'), response.htmlStatus); }, - callback: reload + callback: reload, }); - } - } + }, + }, ], - rows: rows + rows: rows, }); me.callParent(); reload(); - } + }, }); diff --git a/www/SystemConfiguration.js b/www/SystemConfiguration.js index 7d3aa54f..b95d80ee 100644 --- a/www/SystemConfiguration.js +++ b/www/SystemConfiguration.js @@ -1,5 +1,3 @@ -/*global Proxmox*/ - Ext.define('PBS.SystemConfiguration', { extend: 'Ext.tab.Panel', xtype: 'pbsSystemConfiguration', @@ -16,23 +14,23 @@ Ext.define('PBS.SystemConfiguration', { layout: { type: 'vbox', align: 'stretch', - multi: true + multi: true, }, defaults: { collapsible: true, animCollapse: false, - margin: '10 10 0 10' + margin: '10 10 0 10', }, items: [ { title: gettext('Time'), xtype: 'proxmoxNodeTimeView', - nodename: 'localhost' + nodename: 'localhost', }, { title: gettext('DNS'), xtype: 'proxmoxNodeDNSView', - nodename: 'localhost' + nodename: 'localhost', }, { flex: 1, @@ -41,28 +39,22 @@ Ext.define('PBS.SystemConfiguration', { xtype: 'proxmoxNodeNetworkView', showApplyBtn: true, types: ['bond', 'bridge', 'vlan'], - nodename: 'localhost' + nodename: 'localhost', }, - ] -// }, -// { -// itemId: 'options', -// title: gettext('Options'), -// html: "TESWT" -// xtype: 'pbsSystemOptions' - } + ], + }, ], initComponent: function() { - var me = this; + let me = this; me.callParent(); - var networktime = me.getComponent('network'); + let networktime = me.getComponent('network'); Ext.Array.forEach(networktime.query(), function(item) { - item.relayEvents(networktime, [ 'activate', 'deactivate', 'destroy']); + item.relayEvents(networktime, ['activate', 'deactivate', 'destroy']); }); - } + }, }); diff --git a/www/Utils.js b/www/Utils.js index 7bcf1ba6..27e7a24c 100644 --- a/www/Utils.js +++ b/www/Utils.js @@ -1,4 +1,3 @@ -/*global Proxmox */ Ext.ns('PBS'); console.log("Starting Backup Server GUI"); @@ -7,7 +6,6 @@ Ext.define('PBS.Utils', { singleton: true, updateLoginData: function(data) { - Proxmox.Utils.setAuthData(data); }, @@ -74,13 +72,13 @@ Ext.define('PBS.Utils', { render_datastore_worker_id: function(id, what) { const res = id.match(/^(\S+?)_(\S+?)_(\S+?)(_(.+))?$/); if (res) { - let datastore = res[1], type = res[2], id = res[3]; + let datastore = res[1], backupGroup = `${res[2]}/${res[3]}`; if (res[4] !== undefined) { let datetime = Ext.Date.parse(parseInt(res[5], 16), 'U'); let utctime = PBS.Utils.render_datetime_utc(datetime); - return `Datastore ${datastore} ${what} ${type}/${id}/${utctime}`; + return `Datastore ${datastore} ${what} ${backupGroup}/${utctime}`; } else { - return `Datastore ${datastore} ${what} ${type}/${id}`; + return `Datastore ${datastore} ${what} ${backupGroup}`; } } return `Datastore ${what} ${id}`; @@ -91,21 +89,13 @@ Ext.define('PBS.Utils', { // do whatever you want here Proxmox.Utils.override_task_descriptions({ - garbage_collection: ['Datastore', gettext('Garbage collect') ], - sync: ['Datastore', gettext('Remote Sync') ], - syncjob: [gettext('Sync Job'), gettext('Remote Sync') ], - prune: (type, id) => { - return PBS.Utils.render_datastore_worker_id(id, gettext('Prune')); - }, - verify: (type, id) => { - return PBS.Utils.render_datastore_worker_id(id, gettext('Verify')); - }, - backup: (type, id) => { - return PBS.Utils.render_datastore_worker_id(id, gettext('Backup')); - }, - reader: (type, id) => { - return PBS.Utils.render_datastore_worker_id(id, gettext('Read objects')); - }, + garbage_collection: ['Datastore', gettext('Garbage collect')], + sync: ['Datastore', gettext('Remote Sync')], + syncjob: [gettext('Sync Job'), gettext('Remote Sync')], + prune: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Prune')), + verify: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Verify')), + backup: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Backup')), + reader: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Read objects')), }); - } + }, }); diff --git a/www/config/SyncView.js b/www/config/SyncView.js index 55a940da..679624a8 100644 --- a/www/config/SyncView.js +++ b/www/config/SyncView.js @@ -69,7 +69,7 @@ Ext.define('PBS.config.SyncJobView', { if (!upid) return; Ext.create('Proxmox.window.TaskViewer', { - upid + upid, }).show(); }, @@ -116,13 +116,13 @@ Ext.define('PBS.config.SyncJobView', { text = Proxmox.Utils.unknownText; break; case 'error': - icon = 'times critical'; + icon = 'times critical'; text = Proxmox.Utils.errorText + ': ' + value; break; case 'warning': icon = 'exclamation warning'; break; - case 'ok': + case 'ok': icon = 'check good'; text = gettext("OK"); } diff --git a/www/dashboard/DataStoreStatistics.js b/www/dashboard/DataStoreStatistics.js index c71f13c2..3aaa3c9b 100644 --- a/www/dashboard/DataStoreStatistics.js +++ b/www/dashboard/DataStoreStatistics.js @@ -13,7 +13,7 @@ Ext.define('pbs-datastore-statistics', { } return last; }); - } + }, }, { name: 'usage', @@ -25,13 +25,13 @@ Ext.define('pbs-datastore-statistics', { } else { return -1; } - } + }, }, ], proxy: { type: 'proxmox', - url: "/api2/json/status/datastore-usage" + url: "/api2/json/status/datastore-usage", }, idProperty: 'store', }); @@ -57,7 +57,7 @@ Ext.define('PBS.DatastoreStatistics', { let timespan = (estimate - now)/1000; - if (+estimate <= +now || isNaN(timespan)) { + if (Number(estimate) <= Number(now) || isNaN(timespan)) { return gettext('Never'); } @@ -131,8 +131,8 @@ Ext.define('PBS.DatastoreStatistics', { lineWidth: 0, chartRangeMin: 0, chartRangeMax: 1, - tipTpl: '{y:number("0.00")*100}%' - } + tipTpl: '{y:number("0.00")*100}%', + }, }, ], @@ -150,4 +150,4 @@ Ext.define('PBS.DatastoreStatistics', { }, }, -}) +}); diff --git a/www/dashboard/LongestTasks.js b/www/dashboard/LongestTasks.js index d076d5fa..f74e768e 100644 --- a/www/dashboard/LongestTasks.js +++ b/www/dashboard/LongestTasks.js @@ -14,7 +14,6 @@ Ext.define('PBS.LongestTasks', { openTask: function(record) { let me = this; - let view = me.getView(); Ext.create('Proxmox.window.TaskViewer', { upid: record.data.upid, endtime: record.data.endtime, @@ -72,7 +71,7 @@ Ext.define('PBS.LongestTasks', { model: 'proxmox-tasks', proxy: { type: 'memory', - } + }, }, }, diff --git a/www/dashboard/RunningTasks.js b/www/dashboard/RunningTasks.js index 4c1d4d12..fdf7122f 100644 --- a/www/dashboard/RunningTasks.js +++ b/www/dashboard/RunningTasks.js @@ -80,7 +80,7 @@ Ext.define('PBS.RunningTasks', { dataIndex: 'duration', renderer: function(value, md, record) { return Proxmox.Utils.format_duration_human((Date.now() - record.data.starttime)/1000); - } + }, }, { xtype: 'actioncolumn', diff --git a/www/dashboard/TaskSummary.js b/www/dashboard/TaskSummary.js index 2e24ba2b..5e2a4b13 100644 --- a/www/dashboard/TaskSummary.js +++ b/www/dashboard/TaskSummary.js @@ -69,7 +69,7 @@ Ext.define('PBS.TaskSummary', { disableSelection: true, store: { - data: [] + data: [], }, columns: [ @@ -90,7 +90,7 @@ Ext.define('PBS.TaskSummary', { renderer: 'render_count', }, ], - } + }, ], }); diff --git a/www/window/FileBrowser.js b/www/window/FileBrowser.js index ee29fdd8..2ac50e1a 100644 --- a/www/window/FileBrowser.js +++ b/www/window/FileBrowser.js @@ -1,7 +1,7 @@ Ext.define('pbs-file-tree', { extend: 'Ext.data.Model', - fields: [ 'filepath', 'text', 'type', 'size', + fields: ['filepath', 'text', 'type', 'size', { name: 'mtime', type: 'date', @@ -43,7 +43,7 @@ Ext.define('pbs-file-tree', { return `fa fa-${icon}`; }, - } + }, ], idProperty: 'filepath', }); @@ -85,15 +85,15 @@ Ext.define("PBS.window.FileBrowser", { 'backup-type': view['backup-type'], 'backup-time': view['backup-time'], }; - params['filepath'] = data.filepath; + params.filepath = data.filepath; atag.download = data.text; - atag.href = me.buildUrl(`/api2/json/admin/datastore/${view.datastore}/pxar-file-download`, params); + atag.href = me + .buildUrl(`/api2/json/admin/datastore/${view.datastore}/pxar-file-download`, params); atag.click(); }, fileChanged: function() { let me = this; - let view = me.getView(); let tree = me.lookup('tree'); let selection = tree.getSelection(); if (!selection || selection.length < 1) return; @@ -204,7 +204,7 @@ Ext.define("PBS.window.FileBrowser", { return asize - bsize; }, - } + }, }, { text: gettext('Modified'), @@ -226,10 +226,10 @@ Ext.define("PBS.window.FileBrowser", { case 's': return gettext('Socket'); default: return Proxmox.Utils.unknownText; } - } + }, }, - ] - } + ], + }, ], buttons: [ @@ -238,6 +238,6 @@ Ext.define("PBS.window.FileBrowser", { handler: 'downloadFile', reference: 'downloadBtn', disabled: true, - } + }, ], });