-/**\r
- * Utility class for setting/reading values from browser cookies.\r
- * Values can be written using the {@link #set} method.\r
- * Values can be read using the {@link #get} method.\r
- * A cookie can be invalidated on the client machine using the {@link #clear} method.\r
- */\r
-Ext.define('Ext.util.Cookies', {\r
- singleton: true,\r
- \r
- /**\r
- * Creates a cookie with the specified name and value. Additional settings for the cookie may be optionally specified\r
- * (for example: expiration, access restriction, SSL).\r
- * @param {String} name The name of the cookie to set.\r
- * @param {Object} value The value to set for the cookie.\r
- * @param {Object} [expires] Specify an expiration date the cookie is to persist until. Note that the specified Date\r
- * object will be converted to Greenwich Mean Time (GMT).\r
- * @param {String} [path] Setting a path on the cookie restricts access to pages that match that path. Defaults to all\r
- * pages ('/').\r
- * @param {String} [domain] Setting a domain restricts access to pages on a given domain (typically used to allow\r
- * cookie access across subdomains). For example, "sencha.com" will create a cookie that can be accessed from any\r
- * subdomain of sencha.com, including www.sencha.com, support.sencha.com, etc.\r
- * @param {Boolean} [secure] Specify true to indicate that the cookie should only be accessible via SSL on a page\r
- * using the HTTPS protocol. Defaults to false. Note that this will only work if the page calling this code uses the\r
- * HTTPS protocol, otherwise the cookie will be created with default options.\r
- */\r
- set : function(name, value){\r
- var argv = arguments,\r
- argc = arguments.length,\r
- expires = (argc > 2) ? argv[2] : null,\r
- path = (argc > 3) ? argv[3] : '/',\r
- domain = (argc > 4) ? argv[4] : null,\r
- secure = (argc > 5) ? argv[5] : false;\r
- \r
- document.cookie = name + "=" +\r
- escape(value) +\r
- ((expires === null) ? "" : ("; expires=" + expires.toUTCString())) +\r
- ((path === null) ? "" : ("; path=" + path)) +\r
- ((domain === null) ? "" : ("; domain=" + domain)) +\r
- ((secure === true) ? "; secure" : "");\r
- },\r
-\r
- /**\r
- * Retrieves cookies that are accessible by the current page. If a cookie does not exist, `get()` returns null. The\r
- * following example retrieves the cookie called "valid" and stores the String value in the variable validStatus.\r
- *\r
- * var validStatus = Ext.util.Cookies.get("valid");\r
- *\r
- * @param {String} name The name of the cookie to get\r
- * @return {Object} Returns the cookie value for the specified name;\r
- * null if the cookie name does not exist.\r
- */\r
- get : function(name) {\r
- var parts = document.cookie.split('; '),\r
- len = parts.length,\r
- item, i, ret;\r
-\r
- // In modern browsers, a cookie with an empty string will be stored:\r
- // MyName=\r
- // In older versions of IE, it will be stored as:\r
- // MyName\r
- // So here we iterate over all the parts in an attempt to match the key.\r
- for (i = 0; i < len; ++i) {\r
- item = parts[i].split('=');\r
- if (item[0] === name) {\r
- ret = item[1];\r
- return ret ? unescape(ret) : '';\r
- }\r
- }\r
- return null;\r
- },\r
-\r
- /**\r
- * Removes a cookie with the provided name from the browser\r
- * if found by setting its expiration date to sometime in the past.\r
- * @param {String} name The name of the cookie to remove\r
- * @param {String} [path] The path for the cookie.\r
- * This must be included if you included a path while setting the cookie.\r
- */\r
- clear : function(name, path){\r
- if (this.get(name)) {\r
- path = path || '/';\r
- document.cookie = name + '=' + '; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=' + path;\r
- }\r
- }\r
-});\r
+/**
+ * Utility class for setting/reading values from browser cookies.
+ * Values can be written using the {@link #set} method.
+ * Values can be read using the {@link #get} method.
+ * A cookie can be invalidated on the client machine using the {@link #clear} method.
+ */
+Ext.define('Ext.util.Cookies', {
+ singleton: true,
+
+ /**
+ * Creates a cookie with the specified name and value. Additional settings for the cookie may be optionally specified
+ * (for example: expiration, access restriction, SSL).
+ * @param {String} name The name of the cookie to set.
+ * @param {Object} value The value to set for the cookie.
+ * @param {Object} [expires] Specify an expiration date the cookie is to persist until. Note that the specified Date
+ * object will be converted to Greenwich Mean Time (GMT).
+ * @param {String} [path] Setting a path on the cookie restricts access to pages that match that path. Defaults to all
+ * pages ('/').
+ * @param {String} [domain] Setting a domain restricts access to pages on a given domain (typically used to allow
+ * cookie access across subdomains). For example, "sencha.com" will create a cookie that can be accessed from any
+ * subdomain of sencha.com, including www.sencha.com, support.sencha.com, etc.
+ * @param {Boolean} [secure] Specify true to indicate that the cookie should only be accessible via SSL on a page
+ * using the HTTPS protocol. Defaults to false. Note that this will only work if the page calling this code uses the
+ * HTTPS protocol, otherwise the cookie will be created with default options.
+ */
+ set: function(name, value) {
+ var argv = arguments,
+ argc = arguments.length,
+ expires = argc > 2 ? argv[2] : null,
+ path = argc > 3 ? argv[3] : '/',
+ domain = argc > 4 ? argv[4] : null,
+ secure = argc > 5 ? argv[5] : false;
+
+ document.cookie = name + "=" +
+ escape(value) +
+ (expires === null ? "" : "; expires=" + expires.toUTCString()) +
+ (path === null ? "" : "; path=" + path) +
+ (domain === null ? "" : "; domain=" + domain) +
+ (secure === true ? "; secure" : "");
+ },
+
+ /**
+ * Retrieves cookies that are accessible by the current page. If a cookie does not exist, `get()` returns null. The
+ * following example retrieves the cookie called "valid" and stores the String value in the variable validStatus.
+ *
+ * var validStatus = Ext.util.Cookies.get("valid");
+ *
+ * @param {String} name The name of the cookie to get
+ * @return {Object} Returns the cookie value for the specified name;
+ * null if the cookie name does not exist.
+ */
+ get: function(name) {
+ var parts = document.cookie.split('; '),
+ len = parts.length,
+ item, i, ret;
+
+ // In modern browsers, a cookie with an empty string will be stored:
+ // MyName=
+ // In older versions of IE, it will be stored as:
+ // MyName
+ // So here we iterate over all the parts in an attempt to match the key.
+ for (i = 0; i < len; ++i) {
+ item = parts[i].split('=');
+ if (item[0] === name) {
+ ret = item[1];
+ return ret ? unescape(ret) : '';
+ }
+ }
+ return null;
+ },
+
+ /**
+ * Removes a cookie with the provided name from the browser
+ * if found by setting its expiration date to sometime in the past.
+ * @param {String} name The name of the cookie to remove
+ * @param {String} [path] The path for the cookie.
+ * This must be included if you included a path while setting the cookie.
+ */
+ clear: function(name, path) {
+ if (this.get(name)) {
+ path = path || '/';
+ document.cookie = name + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=' + path;
+ }
+ },
+});
'</tpl>',
'<tr><td>Version:</td><td>{version}</td></tr>',
'</table>',
- ]
+ ],
},
});
if (loc === '') {
return [''];
}
- }
+ },
},
config: {
{
xtype: 'pveTitleBar',
title: gettext('Datacenter'),
- pveBackButton: false
+ pveBackButton: false,
},
{
- xtype: 'pveClusterInfo'
+ xtype: 'pveClusterInfo',
},
{
xtype: 'component',
cls: 'dark',
padding: 5,
- html: gettext('Nodes')
+ html: gettext('Nodes'),
},
{
xtype: 'list',
listeners: {
itemsingletap: function(list, index, target, record) {
PVE.Workspace.gotoPage('nodes/' + record.get('name'));
- }
+ },
},
itemTpl: '{name}' +
'<br><small>Online: {[Proxmox.Utils.format_boolean(values.online)]}</small>' +
- '<br><small>Support: {[PVE.Utils.render_support_level(values.level)]}</small>'
- }
- ]
+ '<br><small>Support: {[PVE.Utils.render_support_level(values.level)]}</small>',
+ },
+ ],
},
reload: function() {
var d = response.result.data;
me.summary.version = d.version;
ci.setData(me.summary);
- }
+ },
});
var list = me.down('list');
method: 'GET',
success: function(response) {
var d = response.result.data;
- list.setData(d.filter(function(el) { return (el.type === "node"); }));
+ list.setData(d.filter(function(el) { return el.type === "node"; }));
d.forEach(function(el) {
if (el.type === "node") {
ci.setData(me.summary);
},
failure: function(response) {
- me.setMasked({ xtype: 'loadmask', message: response.htmlStatus} );
- }
+ me.setMasked({ xtype: 'loadmask', message: response.htmlStatus });
+ },
});
},
text: gettext('Tasks'),
handler: function() {
PVE.Workspace.gotoPage('tasks');
- }
- }
+ },
+ },
]);
me.reload();
- }
+ },
});
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/lxc\/(\d+)$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/lxc\/(\d+)$/);
+ },
},
vmtype: 'lxc',
config_keys: [
- 'hostname','ostype', , 'memory', 'swap', 'cpulimit', 'cpuunits',
- /^net\d+/, 'rootfs', /^mp\d+/, 'nameserver', 'searchdomain','description'
+ 'hostname', 'ostype', 'memory', 'swap', 'cpulimit', 'cpuunits',
+ /^net\d+/, 'rootfs', /^mp\d+/, 'nameserver', 'searchdomain', 'description',
],
initialize: function() {
me.down('titlebar').setTitle('CT: ' + me.vmid);
this.callParent();
- }
+ },
});
});
errlabel.show();
} else {
-
Ext.Msg.show({
title: 'Two-Factor Authentication',
message: 'Please enter your OTP verification code:',
} else {
me.mask({
xtype: 'loadmask',
- message: 'Loading...'
+ message: 'Loading...',
});
Proxmox.Utils.API2Request({
url: '/api2/extjs/access/tfa',
me.unmask();
Proxmox.Utils.authClear();
errlabel.show();
- }
+ },
});
}
},
});
}
-
},
config: {
xtype: 'image',
src: '/pve2/images/proxmox_logo.png',
height: 30,
- width: 209
+ width: 209,
},
{
xtype: 'fieldset',
placeHolder: gettext('User name'),
itemId: 'userNameTextField',
name: 'username',
- required: true
+ required: true,
},
{
xtype: 'passwordfield',
placeHolder: gettext('Password'),
itemId: 'passwordTextField',
name: 'password',
- required: true
+ required: true,
},
{
xtype: 'pveRealmSelector',
itemId: 'realmSelectorField',
name: 'realm',
- }
- ]
+ },
+ ],
},
{
xtype: 'label',
hidden: true,
hideAnimation: 'fadeOut',
showAnimation: 'fadeIn',
- style: 'color:#990000;margin:5px 0px;'
+ style: 'color:#990000;margin:5px 0px;',
},
{
xtype: 'button',
} else {
PVE.Workspace.updateLoginData(data);
}
- }
+ },
});
- }
- }
- ]
- }
+ },
+ },
+ ],
+ },
});
Ext.define('PVE.field.TFACode', {
config: {
component: {
- type: 'number'
+ type: 'number',
},
maxLength: 6,
required: true,
var data = me.getMenuItems() || [];
- var addHide = function (fn) {
- return function () {
+ var addHide = function(fn) {
+ return function() {
if (me.menuPanel) {
me.menuPanel.hide();
Ext.Viewport.remove(me.menuPanel);
text: gettext('Datacenter'),
handler: addHide(function() {
PVE.Workspace.gotoPage('');
- })
+ }),
});
}
items.push(Ext.apply(el, {
xtype: 'button',
ui: 'plain',
- handler: addHide(el.handler)
+ handler: addHide(el.handler),
}));
});
if (me.getPveStdMenu()) {
- items.push({
+ items.push({
xtype: 'button',
ui: 'plain',
text: gettext('Logout'),
handler: addHide(function() {
PVE.Workspace.showLogin();
- })
+ }),
});
}
visible: false,
minWidth: 200,
layout: {
- type:'vbox',
- align: 'stretch'
+ type: 'vbox',
+ align: 'stretch',
},
- items: items
+ items: items,
});
PVE.Workspace.history.on('change', function() {
config: {
menuItems: undefined,
pveStdMenu: false, // add LOGOUT
- handler: function() {
+ handler: function() {
var me = this;
if (!me.menuPanel) {
me.createMenuPanel();
}
me.menuPanel.showBy(me, 'tr-bc?');
- }
+ },
},
initialize: function() {
if (me.getPveStdMenu()) {
me.setIconCls('more');
}
-
- }
+ },
});
items: [
{
xtype: 'pveTitleBar',
- pveReloadButton: false
+ pveReloadButton: false,
},
- {
+ {
xtype: 'formpanel',
flex: 1,
padding: 10,
},
{
xtype: 'checkboxfield',
- name : 'online',
+ name: 'online',
checked: true,
- label: gettext('Online')
- }
- ]
+ label: gettext('Online'),
+ },
+ ],
},
{
xtype: 'button',
itemId: 'migrate',
ui: 'action',
- text: gettext('Migrate')
- }
- ]
- }
- ]
+ text: gettext('Migrate'),
+ },
+ ],
+ },
+ ],
},
initialize: function() {
btn.setHandler(function() {
var form = this.up('formpanel');
var values = form.getValues();
-
+
if (!values.target) {
Ext.Msg.alert('Error', 'Please select a target node');
return;
},
success: function(response, options) {
var upid = response.result.data;
- var page = 'nodes/' + me.nodename + '/tasks/' + upid;
+ var page = 'nodes/' + me.nodename + '/tasks/' + upid;
PVE.Workspace.gotoPage(page);
- }
+ },
});
});
- }
+ },
});
Ext.define('PVE.QemuMigrate', {
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/qemu\/(\d+)\/migrate$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/qemu\/(\d+)\/migrate$/);
+ },
},
initialize: function() {
me.down('titlebar').setTitle(gettext('Migrate') + ': VM ' + me.vmid);
this.callParent();
- }
+ },
});
Ext.define('PVE.LXCMigrate', {
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/lxc\/(\d+)\/migrate$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/lxc\/(\d+)\/migrate$/);
+ },
},
initialize: function() {
me.down('titlebar').setTitle(gettext('Migrate') + ': CT ' + me.vmid);
this.callParent();
- }
+ },
});
valueField: 'node',
displayField: 'node',
store: {
- fields: [ 'node', 'cpu', 'maxcpu', 'mem', 'maxmem', 'uptime' ],
+ fields: ['node', 'cpu', 'maxcpu', 'mem', 'maxmem', 'uptime'],
autoLoad: true,
proxy: {
type: 'pve',
- url: '/api2/json/nodes'
+ url: '/api2/json/nodes',
},
sorters: [
{
- property : 'node',
- direction: 'ASC'
- }
- ]
+ property: 'node',
+ direction: 'ASC',
+ },
+ ],
},
- value: ''
- }
+ value: '',
+ },
});
}
var per = values.cpu * 100;
return per.toFixed(2) + "% (" + values.cpuinfo.cpus + " CPUs)";
- }
- }
- ]
+ },
+ },
+ ],
},
});
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)$/);
+ },
},
nodename: undefined,
config: {
items: [
- {
- xtype: 'pveTitleBar'
+ {
+ xtype: 'pveTitleBar',
},
{
- xtype: 'pveNodeInfo'
+ xtype: 'pveNodeInfo',
},
{
xtype: 'component',
cls: 'dark',
padding: 5,
- html: gettext('Virtual machines')
+ html: gettext('Virtual machines'),
},
{
xtype: 'list',
disableSelection: true,
listeners: {
itemsingletap: function(list, index, target, record) {
- PVE.Workspace.gotoPage('nodes/' + record.get('nodename') + '/' +
+ PVE.Workspace.gotoPage('nodes/' + record.get('nodename') + '/' +
record.get('type') + '/' + record.get('vmid'));
- }
+ },
},
grouped: true,
itemTpl: [
return '-';
}
return (values.cpu*100).toFixed(1) + '%';
- }
- }
- ]
- }
- ]
+ },
+ },
+ ],
+ },
+ ],
},
reload: function() {
- var me = this;
+ var me = this;
var ni = me.down('pveNodeInfo');
success: function(response) {
var d = response.result.data;
if (d.pveversion) {
- d.pveversion = d.pveversion.replace(/pve\-manager\//, '');
+ d.pveversion = d.pveversion.replace(/pve-manager\//, '');
}
ni.setData(d);
- }
+ },
});
list.setMasked(false);
var error_handler = function(response) {
- list.setMasked({ xtype: 'loadmask', message: response.htmlStatus} );
+ list.setMasked({ xtype: 'loadmask', message: response.htmlStatus });
};
Proxmox.Utils.API2Request({
success: function(response) {
var d = response.result.data;
d.nodename = me.nodename;
- d.forEach(function(el) { el.type = 'lxc'; el.nodename = me.nodename });
+ d.forEach(function(el) { el.type = 'lxc'; el.nodename = me.nodename; });
me.store.each(function(rec) {
if (rec.get('type') === 'lxc') {
rec.destroy();
});
me.store.add(d);
},
- failure: error_handler
+ failure: error_handler,
});
Proxmox.Utils.API2Request({
method: 'GET',
success: function(response) {
var d = response.result.data;
- d.forEach(function(el) { el.type = 'qemu'; el.nodename = me.nodename });
+ d.forEach(function(el) { el.type = 'qemu'; el.nodename = me.nodename; });
me.store.each(function(rec) {
if (rec.get('type') === 'qemu') {
rec.destroy();
});
me.store.add(d);
},
- failure: error_handler
+ failure: error_handler,
});
-
},
initialize: function() {
text: gettext('Tasks'),
handler: function() {
PVE.Workspace.gotoPage('nodes/' + me.nodename + '/tasks');
- }
+ },
},
]);
me.store = Ext.create('Ext.data.Store', {
- fields: [ 'name', 'vmid', 'nodename', 'type', 'memory', 'uptime', 'mem', 'maxmem', 'cpu', 'cpus'],
+ fields: ['name', 'vmid', 'nodename', 'type', 'memory', 'uptime', 'mem', 'maxmem', 'cpu', 'cpus'],
sorters: ['vmid'],
grouper: {
groupFn: function(record) {
return record.get('type');
- }
+ },
},
});
me.reload();
this.callParent();
- }
+ },
});
docked: 'top',
pveReloadButton: true,
pveBackButton: true,
- pveStdMenu: true // add 'Login' and 'Datacenter' to menu by default
+ pveStdMenu: true, // add 'Login' and 'Datacenter' to menu by default
},
initialize: function() {
iconCls: 'arrow_left',
handler: function() {
PVE.Workspace.goBack();
- }
+ },
});
}
iconCls: 'refresh',
handler: function() {
this.up('pvePage').reload();
- }
+ },
});
}
items.push({
xtype: 'pveMenuButton',
align: 'right',
- pveStdMenu: me.getPveStdMenu()
+ pveStdMenu: me.getPveStdMenu(),
});
me.setItems(items);
- }
+ },
});
Ext.define('PVE.RestProxy', {
extend: 'Ext.data.RestProxy',
- alias : 'proxy.pve',
+ alias: 'proxy.pve',
constructor: function(config) {
var me = this;
config = config || {};
Ext.applyIf(config, {
- pageParam : null,
+ pageParam: null,
startParam: null,
limitParam: null,
groupParam: null,
sortParam: null,
filterParam: null,
- noCache : false,
+ noCache: false,
reader: {
type: 'json',
- rootProperty: config.root || 'data'
+ rootProperty: config.root || 'data',
},
afterRequest: function(request, success) {
me.fireEvent('afterload', me, request, success);
- return;
- }
+ },
});
- me.callParent([config]);
- }
+ me.callParent([config]);
+ },
});
Ext.define('pve-domains', {
extend: "Ext.data.Model",
config: {
- fields: [ 'realm', 'type', 'comment', 'default', 'tfa',
- {
+ fields: ['realm', 'type', 'comment', 'default', 'tfa',
+ {
name: 'descr',
// Note: We use this in the RealmComboBox.js
// (see Bug #125)
}
return text;
- }
- }
+ },
+ },
],
proxy: {
type: 'pve',
- url: "/api2/json/access/domains"
- }
- }
+ url: "/api2/json/access/domains",
+ },
+ },
});
Ext.define('pve-tasks', {
extend: 'Ext.data.Model',
config: {
- fields: [
- { name: 'starttime', type : 'date', dateFormat: 'timestamp' },
- { name: 'endtime', type : 'date', dateFormat: 'timestamp' },
+ fields: [
+ { name: 'starttime', type: 'date', dateFormat: 'timestamp' },
+ { name: 'endtime', type: 'date', dateFormat: 'timestamp' },
{ name: 'pid', type: 'int' },
- 'node', 'upid', 'user', 'status', 'type', 'id'
+ 'node', 'upid', 'user', 'status', 'type', 'id',
],
- idProperty: 'upid'
- }
+ idProperty: 'upid',
+ },
});
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/qemu\/(\d+)$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/qemu\/(\d+)$/);
+ },
},
vmtype: 'qemu',
config_keys: [
'name', 'memory', 'sockets', 'cores', 'ostype', 'bootdisk', /^net\d+/,
- /^ide\d+/, /^virtio\d+/, /^sata\d+/, /^scsi\d+/, /^unused\d+/
+ /^ide\d+/, /^virtio\d+/, /^sata\d+/, /^scsi\d+/, /^unused\d+/,
],
initialize: function() {
me.down('titlebar').setTitle('VM: ' + me.vmid);
this.callParent();
- }
+ },
});
valueField: 'realm',
displayField: 'descr',
store: { model: 'pve-domains' },
- value: 'pam'
+ value: 'pam',
},
needOTP: function(realm) {
var me = this;
me.callParent();
-
+
var realmstore = me.getStore();
realmstore.load({
if (!def || !realmstore.findRecord('realm', def)) {
def = 'pam';
Ext.each(r, function(record) {
- if (record.get('default')) {
+ if (record.get('default')) {
def = record.get('realm');
}
});
me.setValue(def);
}
}
- }
+ },
});
- }
+ },
});
baseUrl: undefined,
items: [
{
- xtype: 'pveTitleBar'
+ xtype: 'pveTitleBar',
},
{
xtype: 'list',
disableSelection: true,
listeners: {
itemsingletap: function(list, index, target, record) {
- PVE.Workspace.gotoPage('nodes/' + record.get('node') + '/tasks/' +
+ PVE.Workspace.gotoPage('nodes/' + record.get('node') + '/tasks/' +
record.get('upid'));
- }
+ },
},
itemTpl: [
'<div style="vertical-align: middle;">' +
},
status: function(values) {
return Ext.String.ellipsis(values.status, 160);
- }
- }
- ]
- }
- ]
+ },
+ },
+ ],
+ },
+ ],
},
reload: function() {
model: 'pve-tasks',
proxy: {
type: 'pve',
- url: '/api2/json' + me.getBaseUrl()
+ url: '/api2/json' + me.getBaseUrl(),
},
sorters: [
{
- property : 'starttime',
- direction: 'DESC'
- }
- ]
+ property: 'starttime',
+ direction: 'DESC',
+ },
+ ],
});
var list = me.down('list');
list.setStore(me.store);
me.reload();
-
+
this.callParent();
- }
+ },
});
Ext.define('PVE.ClusterTaskList', {
statics: {
pathMatch: function(loc) {
return loc.match(/^tasks$/);
- }
+ },
},
config: {
- baseUrl: '/cluster/tasks'
+ baseUrl: '/cluster/tasks',
},
initialize: function() {
}
this.callParent();
- }
+ },
});
Ext.define('PVE.NodeTaskList', {
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/tasks$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/tasks$/);
+ },
},
nodename: undefined,
me.down('titlebar').setTitle(gettext('Tasks') + ': ' + me.nodename);
this.callParent();
- }
+ },
});
statics: {
pathMatch: function(loc) {
- return loc.match(/^nodes\/([^\s\/]+)\/tasks\/([^\s\/]+)$/);
- }
+ return loc.match(/^nodes\/([^\s/]+)\/tasks\/([^\s/]+)$/);
+ },
},
nodename: undefined,
config: {
items: [
- {
- xtype: 'pveTitleBar'
+ {
+ xtype: 'pveTitleBar',
},
{
itemId: 'taskStatus',
'<tpl for=".">',
'<tr><td>{key}</td><td>{value}</td></tr>',
'</tpl>',
- '</table>'
- ]
- },
+ '</table>',
+ ],
+ },
{
xtype: 'component',
cls: 'dark',
- padding: 5,
- html: gettext('Log')
+ padding: 5,
+ html: gettext('Log'),
},
{
itemId: 'taskLog',
styleHtmlContent: true,
style: 'background-color:white;white-space: pre;font-family: Monospace;',
data: {},
- tpl: '{text}'
- }
- ]
+ tpl: '{text}',
+ },
+ ],
},
reloadLog: function() {
logCmp.setData({ text: text });
},
failure: function(response) {
- logCmp.setData({ text: response.htmlStatus } );
- }
+ logCmp.setData({ text: response.htmlStatus });
+ },
});
},
var me = this;
var statusCmp = me.down('#taskStatus');
- var logCmp = me.down('#taskLog');
Proxmox.Utils.API2Request({
url: "/nodes/" + me.nodename + "/tasks/" + me.upid + "/status",
}
},
failure: function(response) {
- me.setMasked({ xtype: 'loadmask', message: response.htmlStatus} );
- }
+ me.setMasked({ xtype: 'loadmask', message: response.htmlStatus });
+ },
});
},
me.reload();
this.callParent();
- }
+ },
});
// Sencha Touch related things
-Proxmox.Utils.toolkit = 'touch',
+Proxmox.Utils.toolkit = 'touch';
Ext.Ajax.setDisableCaching(false);
Ext.MessageBox = Ext.Msg = {
alert: (title, message) => console.warn(title, message),
- show: ({title, message}) => console.warn(title, message),
+ show: ({ title, message }) => console.warn(title, message),
};
-Ext.Loader.injectScriptElement = (url) => console.warn(`surpressed loading ${url}`)
+Ext.Loader.injectScriptElement = (url) => console.warn(`surpressed loading ${url}`);
},
failure: function(response, opts) {
Ext.Msg.alert('Error', response.htmlStatus);
- }
+ },
});
},
config: {
items: [
{
- xtype: 'pveTitleBar'
+ xtype: 'pveTitleBar',
},
{
xtype: 'component',
return per.toFixed(2) + "% (" + values.cpus + " CPUs)";
},
status: function(values) {
- return values.qmpstatus ? values.qmpstatus :
- values.status;
- }
- }
- ]
+ return values.qmpstatus ? values.qmpstatus
+ : values.status;
+ },
+ },
+ ],
},
{
xtype: 'component',
cls: 'dark',
padding: 5,
- html: gettext('Configuration')
+ html: gettext('Configuration'),
},
{
xtype: 'container',
'<tpl for=".">',
'<tr><td>{key}</td><td>{value}</td></tr>',
'</tpl>',
- '</table>'
- ]
- }
- ]
+ '</table>',
+ ],
+ },
+ ],
},
reload: function() {
vm_stat.setData(d);
},
- failure: error_handler
+ failure: error_handler,
});
var vm_cfg = me.down('#vmconfig');
var kv = PVE.Workspace.obj_to_kv(d, me.config_keys);
vm_cfg.setData(kv);
},
- failure: error_handler
+ failure: error_handler,
});
},
text: gettext('Start'),
handler: function() {
me.vm_command("start", {});
- }
+ },
},
{
text: gettext('Stop'),
handler: function() {
me.vm_command("stop", {});
- }
- }
+ },
+ },
];
var bottom_items = [{
handler: function() {
PVE.Workspace.gotoPage('nodes/' + me.nodename + '/' + me.vmtype +
'/' + me.vmid +'/migrate');
- }
+ },
}];
// use qmpstatus with qemu, as it's exacter
- var vm_status = (me.vmtype === 'qemu') ? data.qmpstatus : data.status;
-
- if(vm_status === 'running') {
+ var vm_status = me.vmtype === 'qemu' ? data.qmpstatus : data.status;
+ if (vm_status === 'running') {
top_items.push(
{
text: gettext('Shutdown'),
handler: function() {
me.vm_command("shutdown", {});
- }
+ },
},
{
text: gettext('Suspend'),
handler: function() {
me.vm_command("suspend", {});
- }
- }
+ },
+ },
);
bottom_items.push({
var vmtype = me.vmtype === 'qemu' ? 'kvm' : me.vmtype;
PVE.Utils.openConsoleWindow('html5', vmtype, me.vmid,
me.nodename);
- }
+ },
});
- if(data.spice || me.vmtype==='lxc') {
+ if (data.spice || me.vmtype==='lxc') {
bottom_items.push({
text: gettext('Spice'),
handler: function() {
var vmtype = me.vmtype === 'qemu' ? 'kvm' : me.vmtype;
PVE.Utils.openConsoleWindow('vv', vmtype, me.vmid,
me.nodename);
- }
+ },
});
}
-
- } else if(vm_status === 'paused') {
+ } else if (vm_status === 'paused') {
top_items.push({
text: gettext('Resume'),
handler: function() {
me.vm_command("resume", {});
- }
+ },
});
}
// concat our item arrays and add them to the menu
me.down('pveMenuButton').setMenuItems(top_items.concat(bottom_items));
-
},
initialize: function() {
me.reload();
this.callParent();
- }
+ },
});
statics: {
pathMatch: function(loc) {
throw "implement this in subclass";
- }
+ },
},
config: {
layout: 'vbox',
- appUrl: undefined
- }
+ appUrl: undefined,
+ },
});
Ext.define('PVE.ErrorPage', {
layout: {
type: 'vbox',
pack: 'center',
- align: 'stretch'
+ align: 'stretch',
},
items: [
{
xtype: 'pveTitleBar',
pveReloadButton: false,
- title: gettext('Error')
- }
- ]
- }
+ title: gettext('Error'),
+ },
+ ],
+ },
});
-Ext.define('PVE.Workspace', { statics: {
+Ext.define('PVE.Workspace', {
+ statics: {
// this class only contains static functions
loginData: null, // Data from last login call
history: null,
- pages: [
+ pages: [
'PVE.LXCMigrate',
'PVE.LXCSummary',
'PVE.QemuMigrate',
'PVE.QemuSummary',
- 'PVE.NodeSummary',
+ 'PVE.NodeSummary',
'PVE.ClusterTaskList',
'PVE.NodeTaskList',
'PVE.TaskViewer',
- 'PVE.Datacenter'
+ 'PVE.Datacenter',
],
setHistory: function(h) {
lastAction = actions[actions.length - 2];
var url = '';
- if(lastAction) {
+ if (lastAction) {
actions.pop();
url = lastAction.getUrl();
}
},
__setAppWindow: function(comp, dir) {
-
var old = PVE.Workspace.appWindow;
PVE.Workspace.appWindow = comp;
Ext.Viewport.animateActiveItem(PVE.Workspace.appWindow, anim);
}
// remove old after anim (hack, because anim.after does not work in 2.3.1a)
- Ext.Function.defer(function(){
+ Ext.Function.defer(function() {
if (comp !== old) {
Ext.Viewport.remove(old);
}
},
gotoPage: function(loc) {
- var match;
-
var old = PVE.Workspace.appWindow;
if (old.getAppUrl) {
comp = Ext.create('PVE.ErrorPage', {});
}
}
-
+
PVE.Workspace.__setAppWindow(comp, 'noanim');
},
if (done[item.key]) return;
done[item.key] = 1;
if (item.value) kv.push(item);
- }
+ };
var keys = Ext.Array.sort(Ext.Object.getKeys(d));
Ext.Array.each(names, function(k) {
- if (typeof(k) === 'object') {
+ if (typeof k === 'object') {
Ext.Array.each(keys, function(n) {
if (k.test(n)) {
pushItem({ key: n, value: d[n] });
}
});
} else {
-
pushItem({ key: k, value: d[k] });
}
});
pushItem({ key: k, value: d[k] });
});
return kv;
- }
+ },
-}});
+},
+});
PVE.Workspace.setHistory(me.getHistory());
Ext.Ajax.on('requestexception', function(conn, response) {
- if (response.status === 401) {
+ if (response.status === 401) {
PVE.Workspace.showLogin();
}
});
- }
+ },
});