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:40:03 +02:00
parent 264c19582b
commit 6ab77df3f5
10 changed files with 74 additions and 96 deletions

View File

@ -1,4 +1,3 @@
/*global Proxmox*/
Ext.define('PBS.ServerAdministration', { Ext.define('PBS.ServerAdministration', {
extend: 'Ext.tab.Panel', extend: 'Ext.tab.Panel',
alias: 'widget.pbsServerAdministration', alias: 'widget.pbsServerAdministration',
@ -14,13 +13,13 @@ Ext.define('PBS.ServerAdministration', {
init: function(view) { init: function(view) {
var upgradeBtn = view.lookupReference('upgradeBtn'); var upgradeBtn = view.lookupReference('upgradeBtn');
upgradeBtn.setDisabled(!(Proxmox.UserName && Proxmox.UserName === 'root@pam')); upgradeBtn.setDisabled(!(Proxmox.UserName && Proxmox.UserName === 'root@pam'));
} },
}, },
items: [ items: [
{ {
xtype: 'pbsServerStatus', xtype: 'pbsServerStatus',
itemId: 'status' itemId: 'status',
}, },
{ {
xtype: 'proxmoxNodeServiceView', xtype: 'proxmoxNodeServiceView',
@ -32,7 +31,7 @@ Ext.define('PBS.ServerAdministration', {
'proxmox-backup': true, 'proxmox-backup': true,
'proxmox-backup-proxy': true, 'proxmox-backup-proxy': true,
}, },
nodename: 'localhost' nodename: 'localhost',
}, },
{ {
xtype: 'proxmoxNodeAPT', xtype: 'proxmoxNodeAPT',
@ -44,10 +43,10 @@ Ext.define('PBS.ServerAdministration', {
text: gettext('Upgrade'), text: gettext('Upgrade'),
handler: function() { handler: function() {
Proxmox.Utils.openXtermJsViewer('upgrade', 0, 'localhost'); Proxmox.Utils.openXtermJsViewer('upgrade', 0, 'localhost');
} },
}, },
itemId: 'updates', itemId: 'updates',
nodename: 'localhost' nodename: 'localhost',
}, },
{ {
xtype: 'proxmoxJournalView', xtype: 'proxmoxJournalView',
@ -60,9 +59,9 @@ Ext.define('PBS.ServerAdministration', {
itemId: 'tasks', itemId: 'tasks',
title: gettext('Tasks'), title: gettext('Tasks'),
height: 'auto', height: 'auto',
nodename: 'localhost' nodename: 'localhost',
} },
] ],
}); });

View File

@ -1,4 +1,3 @@
/*global Blob,Proxmox*/
Ext.define('PBS.SubscriptionKeyEdit', { Ext.define('PBS.SubscriptionKeyEdit', {
extend: 'Proxmox.window.Edit', extend: 'Proxmox.window.Edit',
@ -12,8 +11,8 @@ Ext.define('PBS.SubscriptionKeyEdit', {
xtype: 'textfield', xtype: 'textfield',
name: 'key', name: 'key',
value: '', value: '',
fieldLabel: gettext('Subscription Key') fieldLabel: gettext('Subscription Key'),
} },
}); });
Ext.define('PBS.Subscription', { Ext.define('PBS.Subscription', {
@ -27,7 +26,7 @@ Ext.define('PBS.Subscription', {
onlineHelp: 'getting_help', onlineHelp: 'getting_help',
viewConfig: { viewConfig: {
enableTextSelection: true enableTextSelection: true,
}, },
initComponent: function() { initComponent: function() {
@ -40,7 +39,6 @@ Ext.define('PBS.Subscription', {
var baseurl = '/nodes/localhost/subscription'; var baseurl = '/nodes/localhost/subscription';
var render_status = function(value) { var render_status = function(value) {
var message = me.getObjectValue('message'); var message = me.getObjectValue('message');
if (message) { if (message) {
@ -51,31 +49,31 @@ Ext.define('PBS.Subscription', {
var rows = { var rows = {
productname: { productname: {
header: gettext('Type') header: gettext('Type'),
}, },
key: { key: {
header: gettext('Subscription Key') header: gettext('Subscription Key'),
}, },
status: { status: {
header: gettext('Status'), header: gettext('Status'),
renderer: render_status renderer: render_status,
}, },
message: { message: {
visible: false visible: false,
}, },
serverid: { serverid: {
header: gettext('Server ID') header: gettext('Server ID'),
}, },
sockets: { sockets: {
header: gettext('Sockets') header: gettext('Sockets'),
}, },
checktime: { checktime: {
header: gettext('Last checked'), header: gettext('Last checked'),
renderer: Proxmox.Utils.render_timestamp renderer: Proxmox.Utils.render_timestamp,
}, },
nextduedate: { nextduedate: {
header: gettext('Next due date') header: gettext('Next due date'),
} },
}; };
Ext.apply(me, { Ext.apply(me, {
@ -86,11 +84,11 @@ Ext.define('PBS.Subscription', {
text: gettext('Upload Subscription Key'), text: gettext('Upload Subscription Key'),
handler: function() { handler: function() {
var win = Ext.create('PBS.SubscriptionKeyEdit', { var win = Ext.create('PBS.SubscriptionKeyEdit', {
url: '/api2/extjs/' + baseurl url: '/api2/extjs/' + baseurl,
}); });
win.show(); win.show();
win.on('destroy', reload); win.on('destroy', reload);
} },
}, },
{ {
text: gettext('Check'), text: gettext('Check'),
@ -103,16 +101,16 @@ Ext.define('PBS.Subscription', {
failure: function(response, opts) { failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus); Ext.Msg.alert(gettext('Error'), response.htmlStatus);
}, },
callback: reload callback: reload,
}); });
} },
} },
], ],
rows: rows rows: rows,
}); });
me.callParent(); me.callParent();
reload(); reload();
} },
}); });

View File

@ -1,5 +1,3 @@
/*global Proxmox*/
Ext.define('PBS.SystemConfiguration', { Ext.define('PBS.SystemConfiguration', {
extend: 'Ext.tab.Panel', extend: 'Ext.tab.Panel',
xtype: 'pbsSystemConfiguration', xtype: 'pbsSystemConfiguration',
@ -16,23 +14,23 @@ Ext.define('PBS.SystemConfiguration', {
layout: { layout: {
type: 'vbox', type: 'vbox',
align: 'stretch', align: 'stretch',
multi: true multi: true,
}, },
defaults: { defaults: {
collapsible: true, collapsible: true,
animCollapse: false, animCollapse: false,
margin: '10 10 0 10' margin: '10 10 0 10',
}, },
items: [ items: [
{ {
title: gettext('Time'), title: gettext('Time'),
xtype: 'proxmoxNodeTimeView', xtype: 'proxmoxNodeTimeView',
nodename: 'localhost' nodename: 'localhost',
}, },
{ {
title: gettext('DNS'), title: gettext('DNS'),
xtype: 'proxmoxNodeDNSView', xtype: 'proxmoxNodeDNSView',
nodename: 'localhost' nodename: 'localhost',
}, },
{ {
flex: 1, flex: 1,
@ -41,28 +39,22 @@ Ext.define('PBS.SystemConfiguration', {
xtype: 'proxmoxNodeNetworkView', xtype: 'proxmoxNodeNetworkView',
showApplyBtn: true, showApplyBtn: true,
types: ['bond', 'bridge', 'vlan'], types: ['bond', 'bridge', 'vlan'],
nodename: 'localhost' nodename: 'localhost',
},
],
}, },
]
// },
// {
// itemId: 'options',
// title: gettext('Options'),
// html: "TESWT"
// xtype: 'pbsSystemOptions'
}
], ],
initComponent: function() { initComponent: function() {
var me = this; let me = this;
me.callParent(); me.callParent();
var networktime = me.getComponent('network'); let networktime = me.getComponent('network');
Ext.Array.forEach(networktime.query(), function(item) { Ext.Array.forEach(networktime.query(), function(item) {
item.relayEvents(networktime, ['activate', 'deactivate', 'destroy']); item.relayEvents(networktime, ['activate', 'deactivate', 'destroy']);
}); });
} },
}); });

View File

@ -1,4 +1,3 @@
/*global Proxmox */
Ext.ns('PBS'); Ext.ns('PBS');
console.log("Starting Backup Server GUI"); console.log("Starting Backup Server GUI");
@ -7,7 +6,6 @@ Ext.define('PBS.Utils', {
singleton: true, singleton: true,
updateLoginData: function(data) { updateLoginData: function(data) {
Proxmox.Utils.setAuthData(data); Proxmox.Utils.setAuthData(data);
}, },
@ -74,13 +72,13 @@ Ext.define('PBS.Utils', {
render_datastore_worker_id: function(id, what) { render_datastore_worker_id: function(id, what) {
const res = id.match(/^(\S+?)_(\S+?)_(\S+?)(_(.+))?$/); const res = id.match(/^(\S+?)_(\S+?)_(\S+?)(_(.+))?$/);
if (res) { 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) { if (res[4] !== undefined) {
let datetime = Ext.Date.parse(parseInt(res[5], 16), 'U'); let datetime = Ext.Date.parse(parseInt(res[5], 16), 'U');
let utctime = PBS.Utils.render_datetime_utc(datetime); let utctime = PBS.Utils.render_datetime_utc(datetime);
return `Datastore ${datastore} ${what} ${type}/${id}/${utctime}`; return `Datastore ${datastore} ${what} ${backupGroup}/${utctime}`;
} else { } else {
return `Datastore ${datastore} ${what} ${type}/${id}`; return `Datastore ${datastore} ${what} ${backupGroup}`;
} }
} }
return `Datastore ${what} ${id}`; return `Datastore ${what} ${id}`;
@ -94,18 +92,10 @@ Ext.define('PBS.Utils', {
garbage_collection: ['Datastore', gettext('Garbage collect')], garbage_collection: ['Datastore', gettext('Garbage collect')],
sync: ['Datastore', gettext('Remote Sync')], sync: ['Datastore', gettext('Remote Sync')],
syncjob: [gettext('Sync Job'), gettext('Remote Sync')], syncjob: [gettext('Sync Job'), gettext('Remote Sync')],
prune: (type, id) => { prune: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Prune')),
return 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')),
verify: (type, id) => { reader: (type, id) => PBS.Utils.render_datastore_worker_id(id, gettext('Read objects')),
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'));
}, },
}); });
}
});

View File

@ -69,7 +69,7 @@ Ext.define('PBS.config.SyncJobView', {
if (!upid) return; if (!upid) return;
Ext.create('Proxmox.window.TaskViewer', { Ext.create('Proxmox.window.TaskViewer', {
upid upid,
}).show(); }).show();
}, },

View File

@ -13,7 +13,7 @@ Ext.define('pbs-datastore-statistics', {
} }
return last; return last;
}); });
} },
}, },
{ {
name: 'usage', name: 'usage',
@ -25,13 +25,13 @@ Ext.define('pbs-datastore-statistics', {
} else { } else {
return -1; return -1;
} }
} },
}, },
], ],
proxy: { proxy: {
type: 'proxmox', type: 'proxmox',
url: "/api2/json/status/datastore-usage" url: "/api2/json/status/datastore-usage",
}, },
idProperty: 'store', idProperty: 'store',
}); });
@ -57,7 +57,7 @@ Ext.define('PBS.DatastoreStatistics', {
let timespan = (estimate - now)/1000; let timespan = (estimate - now)/1000;
if (+estimate <= +now || isNaN(timespan)) { if (Number(estimate) <= Number(now) || isNaN(timespan)) {
return gettext('Never'); return gettext('Never');
} }
@ -131,8 +131,8 @@ Ext.define('PBS.DatastoreStatistics', {
lineWidth: 0, lineWidth: 0,
chartRangeMin: 0, chartRangeMin: 0,
chartRangeMax: 1, chartRangeMax: 1,
tipTpl: '{y:number("0.00")*100}%' tipTpl: '{y:number("0.00")*100}%',
} },
}, },
], ],
@ -150,4 +150,4 @@ Ext.define('PBS.DatastoreStatistics', {
}, },
}, },
}) });

View File

@ -14,7 +14,6 @@ Ext.define('PBS.LongestTasks', {
openTask: function(record) { openTask: function(record) {
let me = this; let me = this;
let view = me.getView();
Ext.create('Proxmox.window.TaskViewer', { Ext.create('Proxmox.window.TaskViewer', {
upid: record.data.upid, upid: record.data.upid,
endtime: record.data.endtime, endtime: record.data.endtime,
@ -72,7 +71,7 @@ Ext.define('PBS.LongestTasks', {
model: 'proxmox-tasks', model: 'proxmox-tasks',
proxy: { proxy: {
type: 'memory', type: 'memory',
} },
}, },
}, },

View File

@ -80,7 +80,7 @@ Ext.define('PBS.RunningTasks', {
dataIndex: 'duration', dataIndex: 'duration',
renderer: function(value, md, record) { renderer: function(value, md, record) {
return Proxmox.Utils.format_duration_human((Date.now() - record.data.starttime)/1000); return Proxmox.Utils.format_duration_human((Date.now() - record.data.starttime)/1000);
} },
}, },
{ {
xtype: 'actioncolumn', xtype: 'actioncolumn',

View File

@ -69,7 +69,7 @@ Ext.define('PBS.TaskSummary', {
disableSelection: true, disableSelection: true,
store: { store: {
data: [] data: [],
}, },
columns: [ columns: [
@ -90,7 +90,7 @@ Ext.define('PBS.TaskSummary', {
renderer: 'render_count', renderer: 'render_count',
}, },
], ],
} },
], ],
}); });

View File

@ -43,7 +43,7 @@ Ext.define('pbs-file-tree', {
return `fa fa-${icon}`; return `fa fa-${icon}`;
}, },
} },
], ],
idProperty: 'filepath', idProperty: 'filepath',
}); });
@ -85,15 +85,15 @@ Ext.define("PBS.window.FileBrowser", {
'backup-type': view['backup-type'], 'backup-type': view['backup-type'],
'backup-time': view['backup-time'], 'backup-time': view['backup-time'],
}; };
params['filepath'] = data.filepath; params.filepath = data.filepath;
atag.download = data.text; 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(); atag.click();
}, },
fileChanged: function() { fileChanged: function() {
let me = this; let me = this;
let view = me.getView();
let tree = me.lookup('tree'); let tree = me.lookup('tree');
let selection = tree.getSelection(); let selection = tree.getSelection();
if (!selection || selection.length < 1) return; if (!selection || selection.length < 1) return;
@ -204,7 +204,7 @@ Ext.define("PBS.window.FileBrowser", {
return asize - bsize; return asize - bsize;
}, },
} },
}, },
{ {
text: gettext('Modified'), text: gettext('Modified'),
@ -226,10 +226,10 @@ Ext.define("PBS.window.FileBrowser", {
case 's': return gettext('Socket'); case 's': return gettext('Socket');
default: return Proxmox.Utils.unknownText; default: return Proxmox.Utils.unknownText;
} }
}
}, },
] },
} ],
},
], ],
buttons: [ buttons: [
@ -238,6 +238,6 @@ Ext.define("PBS.window.FileBrowser", {
handler: 'downloadFile', handler: 'downloadFile',
reference: 'downloadBtn', reference: 'downloadBtn',
disabled: true, disabled: true,
} },
], ],
}); });