submitForm: function() {
var me = this;
- var view = me.getView();
var loginForm = me.lookupReference('loginForm');
var unField = me.lookupReference('usernameField');
var saveunField = me.lookupReference('saveunField');
let params = loginForm.getValues();
params.username = params.username + '@' + params.realm;
- delete(params.realm);
+ delete params.realm;
if (loginForm.isVisible()) {
loginForm.mask(gettext('Please wait...'), 'x-mask-loading');
loginForm.unmask();
Ext.MessageBox.alert(
gettext('Error'),
- gettext('Login failed. Please try again')
+ gettext('Login failed. Please try again'),
);
- }
+ },
});
},
pf.focus(false);
}
}
- }
+ },
},
'field[name=lang]': {
change: function(f, value) {
Ext.util.Cookies.set('PBSLangCookie', value, dt);
this.getView().mask(gettext('Please wait...'), 'x-mask-loading');
window.location.reload();
- }
+ },
},
'button[reference=loginButton]': {
- click: 'submitForm'
+ click: 'submitForm',
},
'window[reference=loginwindow]': {
show: function() {
var checked = sp.get(checkboxField.getStateId());
checkboxField.setValue(checked);
- if(checked === true) {
+ if (checked === true) {
var username = sp.get(unField.getStateId());
unField.setValue(username);
var pwField = this.lookupReference('passwordField');
pwField.focus();
}
- }
- }
- }
+ },
+ },
+ },
},
plugins: 'viewport',
layout: {
- type: 'border'
+ type: 'border',
},
items: [
xtype: 'container',
layout: {
type: 'hbox',
- align: 'middle'
+ align: 'middle',
},
margin: '2 5 2 5',
height: 38,
},
{
xtype: 'versioninfo',
- makeApiCall: false
- }
- ]
+ makeApiCall: false,
+ },
+ ],
},
{
- region: 'center'
+ region: 'center',
},
{
xtype: 'window',
defaultFocus: 'usernameField',
layout: {
- type: 'auto'
+ type: 'auto',
},
title: gettext('Proxmox Backup Server Login'),
{
xtype: 'form',
layout: {
- type: 'form'
+ type: 'form',
},
defaultButton: 'loginButton',
url: '/api2/extjs/access/ticket',
fieldDefaults: {
labelAlign: 'right',
- allowBlank: false
+ allowBlank: false,
},
items: [
name: 'username',
itemId: 'usernameField',
reference: 'usernameField',
- stateId: 'login-username'
+ stateId: 'login-username',
},
{
xtype: 'textfield',
},
{
xtype: 'pmxRealmComboBox',
- name: 'realm'
+ name: 'realm',
},
{
xtype: 'proxmoxLanguageSelector',
value: Ext.util.Cookies.get('PBSLangCookie') || Proxmox.defaultLang || 'en',
name: 'lang',
reference: 'langField',
- submitValue: false
- }
+ submitValue: false,
+ },
],
buttons: [
{
stateId: 'login-saveusername',
labelWidth: 250,
labelAlign: 'right',
- submitValue: false
+ submitValue: false,
},
{
text: gettext('Login'),
reference: 'loginButton',
- formBind: true
- }
- ]
- }
- ]
- }
- ]
+ formBind: true,
+ },
+ ],
+ },
+ ],
+ },
+ ],
});
':path:subpath': {
action: 'changePath',
before: 'beforeChangePath',
- conditions : {
- ':path' : '(?:([%a-zA-Z0-9\\-\\_\\s,\.]+))',
- ':subpath' : '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?'
- }
- }
+ conditions: {
+ ':path': '(?:([%a-zA-Z0-9\\-\\_\\s,.]+))',
+ ':subpath': '(?:(?::)([%a-zA-Z0-9\\-\\_\\s,]+))?',
+ },
+ },
},
beforeChangePath: function(path, subpath, action) {
obj = contentpanel.add({
xtype: path,
nodename: 'localhost',
- border: false
+ border: false,
});
}
if (lastpanel) {
contentpanel.remove(lastpanel, { destroy: true });
}
-
},
logout: function() {
control: {
'[reference=logoutButton]': {
- click: 'logout'
- }
+ click: 'logout',
+ },
},
init: function(view) {
// show login on requestexception
// fixme: what about other errors
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();
}
});
Ext.Ajax.request({
params: {
username: Proxmox.UserName,
- password: ticket
+ password: ticket,
},
url: '/api2/json/access/ticket',
method: 'POST',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
PBS.Utils.updateLoginData(obj.data);
- }
+ },
});
},
- interval: 15*60*1000
+ interval: 15*60*1000,
});
// select treeitem and load page from url fragment, if set
let token = Ext.util.History.getToken() || 'pbsDashboard';
this.redirectTo(token, true);
- }
+ },
},
plugins: 'viewport',
xtype: 'container',
layout: {
type: 'hbox',
- align: 'middle'
+ align: 'middle',
},
margin: '2 0 2 5',
height: 38,
style: {
// proxmox dark grey p light grey as border
backgroundColor: '#464d4d',
- borderColor: '#ABBABA'
+ borderColor: '#ABBABA',
},
margin: '0 5 0 0',
iconCls: 'fa fa-user',
},
],
},
- ]
+ ],
},
{
xtype: 'panel',
region: 'west',
layout: {
type: 'vbox',
- align: 'stretch'
+ align: 'stretch',
},
items: [{
xtype: 'navigationtree',
// because of a bug where a viewcontroller does not detect
// the selectionchange event of a treelist
listeners: {
- selectionchange: 'navigate'
- }
+ selectionchange: 'navigate',
+ },
}, {
xtype: 'box',
cls: 'x-treelist-nav',
- flex: 1
- }]
+ flex: 1,
+ }],
},
{
xtype: 'panel',
layout: { type: 'card' },
region: 'center',
border: false,
- reference: 'contentpanel'
- }
- ]
+ reference: 'contentpanel',
+ },
+ ],
});
// percentage
convert: function(value) {
return value*100;
- }
+ },
},
{
name: 'iowait',
// percentage
convert: function(value) {
return value*100;
- }
+ },
},
'netin',
'netout',
let ios = 0;
if (data.read_ios !== undefined) { ios += data.read_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 (data.io_ticks*1000.0)/ios;
- }
+ },
},
'loadavg',
- { type: 'date', dateFormat: 'timestamp', name: 'time' }
- ]
+ { type: 'date', dateFormat: 'timestamp', name: 'time' },
+ ],
});
Ext.define('PBS.ServerStatus', {
extend: 'Ext.panel.Panel',
waitMsgTarget: me,
failure: function(response, opts) {
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- }
+ },
});
};
handler: function() {
node_command('reboot');
},
- iconCls: 'fa fa-undo'
+ iconCls: 'fa fa-undo',
});
var shutdownBtn = Ext.create('Proxmox.button.Button', {
handler: function() {
node_command('shutdown');
},
- iconCls: 'fa fa-power-off'
+ iconCls: 'fa fa-power-off',
});
var consoleBtn = Ext.create('Proxmox.button.Button', {
iconCls: 'fa fa-terminal',
handler: function() {
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', {
rrdurl: "/api2/json/nodes/localhost/rrd",
- model: 'pve-rrd-node'
+ model: 'pve-rrd-node',
});
me.items = {
defaults: {
minHeight: 320,
padding: 5,
- columnWidth: 1
+ columnWidth: 1,
},
items: [
{
xtype: 'proxmoxRRDChart',
title: gettext('CPU usage'),
- fields: ['cpu','iowait'],
+ fields: ['cpu', 'iowait'],
fieldTitles: [gettext('CPU usage'), gettext('IO wait')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Server load'),
fields: ['loadavg'],
fieldTitles: [gettext('Load average')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Memory usage'),
- fields: ['memtotal','memused'],
+ fields: ['memtotal', 'memused'],
fieldTitles: [gettext('Total'), gettext('RAM usage')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Swap usage'),
- fields: ['swaptotal','swapused'],
+ fields: ['swaptotal', 'swapused'],
fieldTitles: [gettext('Total'), gettext('Swap usage')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Network traffic'),
- fields: ['netin','netout'],
- store: rrdstore
+ fields: ['netin', 'netout'],
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Root Disk usage'),
- fields: ['total','used'],
+ fields: ['total', 'used'],
fieldTitles: [gettext('Total'), gettext('Disk usage')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Root Disk Transfer Rate (bytes/second)'),
- fields: ['read_bytes','write_bytes'],
+ fields: ['read_bytes', 'write_bytes'],
fieldTitles: [gettext('Read'), gettext('Write')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
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')],
- store: rrdstore
+ store: rrdstore,
},
{
xtype: 'proxmoxRRDChart',
title: gettext('Root Disk IO Delay (ms)'),
fields: ['io_delay'],
fieldTitles: [gettext('IO Delay')],
- store: rrdstore
+ store: rrdstore,
},
- ]
+ ],
};
me.listeners = {
};
me.callParent();
- }
+ },
});
-/*global Proxmox*/
-Ext.define('PBS.view.main.VersionInfo',{
+Ext.define('PBS.view.main.VersionInfo', {
extend: 'Ext.Component',
xtype: 'versioninfo',
makeApiCall: true,
data: {
- version: false
+ version: false,
},
tpl: [
'Backup Server',
'<tpl if="version">',
' {version}-{release}',
- '</tpl>'
+ '</tpl>',
],
initComponent: function() {
method: 'GET',
success: function(response) {
me.update(response.result.data);
- }
+ },
});
}
- }
+ },
});
nodename: me.nodename,
listeners: {
destroy: function() { me.reload(); },
- }
+ },
}).show();
},
}
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);
{
text: gettext('Name'),
dataIndex: 'name',
- flex: 1
+ flex: 1,
},
{
header: gettext('Size'),
renderer: Proxmox.Utils.format_size,
- dataIndex: 'size'
+ dataIndex: 'size',
},
{
header: gettext('Free'),
renderer: Proxmox.Utils.format_size,
- dataIndex: 'free'
+ dataIndex: 'free',
},
{
header: gettext('Allocated'),
renderer: Proxmox.Utils.format_size,
- dataIndex: 'alloc'
+ dataIndex: 'alloc',
},
{
header: gettext('Fragmentation'),
renderer: function(value) {
return value.toString() + '%';
},
- dataIndex: 'frag'
+ dataIndex: 'frag',
},
{
header: gettext('Health'),
renderer: Proxmox.Utils.render_zfs_health,
- dataIndex: 'health'
+ dataIndex: 'health',
},
{
header: gettext('Deduplication'),
renderer: function(value) {
return value.toFixed(2).toString() + 'x';
},
- dataIndex: 'dedup'
- }
+ dataIndex: 'dedup',
+ },
],
rootVisible: false,
xtype: 'proxmoxButton',
disabled: true,
handler: 'openDetailWindow',
- }
+ },
],
listeners: {
proxy: {
type: 'proxmox',
},
- sorters: 'name'
+ sorters: 'name',
},
});