ui: some more eslint auto-fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
		| @ -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', | ||||
| 	}, | ||||
|     ], | ||||
| }); | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -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(); | ||||
|     } | ||||
|     }, | ||||
| }); | ||||
|  | ||||
| @ -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']); | ||||
| 	}); | ||||
|     } | ||||
|     }, | ||||
| }); | ||||
|  | ||||
|  | ||||
|  | ||||
							
								
								
									
										32
									
								
								www/Utils.js
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								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')), | ||||
| 	}); | ||||
|     } | ||||
|     }, | ||||
| }); | ||||
|  | ||||
| @ -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"); | ||||
| 	    } | ||||
|  | ||||
| @ -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', { | ||||
| 	}, | ||||
|     }, | ||||
|  | ||||
| }) | ||||
| }); | ||||
|  | ||||
| @ -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', | ||||
| 	    } | ||||
| 	    }, | ||||
| 	}, | ||||
|     }, | ||||
|  | ||||
|  | ||||
| @ -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', | ||||
|  | ||||
| @ -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', | ||||
| 		}, | ||||
| 	    ], | ||||
| 	} | ||||
| 	}, | ||||
|     ], | ||||
|  | ||||
| }); | ||||
|  | ||||
| @ -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, | ||||
| 	} | ||||
| 	}, | ||||
|     ], | ||||
| }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user