Commit 0bd9939a authored by Thomas Lamprecht's avatar Thomas Lamprecht Committed by Dietmar Maurer

replace OpenVZ API calls in mobile UI with LXC

Signed-off-by: 's avatarThomas Lamprecht <t.lamprecht@proxmox.com>
parent be34116f
Ext.define('PVE.OpenVzSummary', { Ext.define('PVE.LXCSummary', {
extend: 'PVE.Page', extend: 'PVE.Page',
alias: 'widget.pveOpenVzSummary', alias: 'widget.pveLXCSummary',
statics: { statics: {
pathMatch: function(loc) { pathMatch: function(loc) {
return loc.match(/^nodes\/([^\s\/]+)\/openvz\/(\d+)$/); return loc.match(/^nodes\/([^\s\/]+)\/lxc\/(\d+)$/);
} }
}, },
...@@ -16,7 +16,7 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -16,7 +16,7 @@ Ext.define('PVE.OpenVzSummary', {
PVE.Utils.API2Request({ PVE.Utils.API2Request({
params: params, params: params,
url: '/nodes/' + me.nodename + '/openvz/' + me.vmid + '/status/' + cmd, url: '/nodes/' + me.nodename + '/lxc/' + me.vmid + '/status/' + cmd,
method: 'POST', method: 'POST',
success: function(response, opts) { success: function(response, opts) {
var upid = response.result.data; var upid = response.result.data;
...@@ -46,7 +46,7 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -46,7 +46,7 @@ Ext.define('PVE.OpenVzSummary', {
{ {
xtype: 'pveMenuButton', xtype: 'pveMenuButton',
align: 'right', align: 'right',
pveStdMenu: true, pveStdMenu: true
} }
] ]
}, },
...@@ -57,10 +57,13 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -57,10 +57,13 @@ Ext.define('PVE.OpenVzSummary', {
style: 'background-color:white;', style: 'background-color:white;',
tpl: [ tpl: [
'<table style="margin-bottom:0px;">', '<table style="margin-bottom:0px;">',
'<tr><td>Status:</td><td>{status}</td></tr>', '<tr><td>Status:</td><td>{status}</td></tr>',
'<tr><td>Memory:</td><td>{[this.meminfo(values)]}</td></tr>', '<tr><td>Memory:</td><td>{[this.meminfo(values)]}</td></tr>',
'<tr><td>CPU:</td><td>{[this.cpuinfo(values)]}</td></tr>', '<tr><td>CPU:</td><td>{[this.cpuinfo(values)]}</td></tr>',
'<tr><td>Uptime:</td><td>{[PVE.Utils.format_duration_long(values.uptime)]}</td></tr>', '<tr><td>Uptime:</td><td>{[PVE.Utils.format_duration_long'+
'(values.uptime)]}</td></tr>',
'</table>', '</table>',
{ {
meminfo: function(values) { meminfo: function(values) {
...@@ -113,7 +116,7 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -113,7 +116,7 @@ Ext.define('PVE.OpenVzSummary', {
}; };
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + me.nodename + '/openvz/' + me.vmid + '/status/current', url: '/nodes/' + me.nodename + '/lxc/' + me.vmid + '/status/current',
method: 'GET', method: 'GET',
success: function(response) { success: function(response) {
var d = response.result.data; var d = response.result.data;
...@@ -125,12 +128,13 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -125,12 +128,13 @@ Ext.define('PVE.OpenVzSummary', {
var ctc = me.down('#ctconfig'); var ctc = me.down('#ctconfig');
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + me.nodename + '/openvz/' + me.vmid + '/config', url: '/nodes/' + me.nodename + '/lxc/' + me.vmid + '/config',
method: 'GET', method: 'GET',
success: function(response) { success: function(response) {
var d = response.result.data; var d = response.result.data;
var names = ['hostname', 'memory', 'swap', 'cpus', 'ostemplate', var names = ['hostname', 'memory', 'swap', 'cpus', 'ostemplate',
'ip_address', 'nameserver', 'searchdomain', 'netif']; 'ip_address', 'nameserver', 'searchdomain',
'netif'];
var kv = PVE.Workspace.obj_to_kv(d, names); var kv = PVE.Workspace.obj_to_kv(d, names);
ctc.setData(kv); ctc.setData(kv);
}, },
...@@ -185,19 +189,22 @@ Ext.define('PVE.OpenVzSummary', { ...@@ -185,19 +189,22 @@ Ext.define('PVE.OpenVzSummary', {
{ {
text: gettext('Migrate'), text: gettext('Migrate'),
handler: function() { handler: function() {
PVE.Workspace.gotoPage('nodes/' + me.nodename + '/openvz/' + me.vmid + '/migrate'); PVE.Workspace.gotoPage('nodes/' + me.nodename + '/lxc/'
+ me.vmid + '/migrate');
} }
}, },
{ {
text: gettext('Console'), text: gettext('Console'),
handler: function() { handler: function() {
PVE.Utils.openConsoleWindow('html5', 'openvz', me.vmid, me.nodename); PVE.Utils.openConsoleWindow('html5', 'lxc', me.vmid,
me.nodename);
} }
}, },
{ {
text: gettext('Spice'), text: gettext('Spice'),
handler: function() { handler: function() {
PVE.Utils.openConsoleWindow('vv', 'openvz', me.vmid, me.nodename); PVE.Utils.openConsoleWindow('vv', 'lxc', me.vmid,
me.nodename);
} }
} }
]); ]);
......
...@@ -18,7 +18,7 @@ JSSRC= \ ...@@ -18,7 +18,7 @@ JSSRC= \
NodeSummary.js \ NodeSummary.js \
Migrate.js \ Migrate.js \
QemuSummary.js \ QemuSummary.js \
OpenVzSummary.js \ LXCSummary.js \
app.js app.js
all: pvemanager-mobile.js all: pvemanager-mobile.js
......
...@@ -3,7 +3,7 @@ Ext.define('PVE.MigrateBase', { ...@@ -3,7 +3,7 @@ Ext.define('PVE.MigrateBase', {
nodename: undefined, nodename: undefined,
vmid: undefined, vmid: undefined,
vmtype: undefined, // qemu or openvz vmtype: undefined, // qemu or lxc
config: { config: {
items: [ items: [
...@@ -110,14 +110,14 @@ Ext.define('PVE.QemuMigrate', { ...@@ -110,14 +110,14 @@ Ext.define('PVE.QemuMigrate', {
} }
}); });
Ext.define('PVE.OpenVzMigrate', { Ext.define('PVE.LXCMigrate', {
extend: 'PVE.MigrateBase', extend: 'PVE.MigrateBase',
vmtype: 'openvz', vmtype: 'lxc',
statics: { statics: {
pathMatch: function(loc) { pathMatch: function(loc) {
return loc.match(/^nodes\/([^\s\/]+)\/openvz\/(\d+)\/migrate$/); return loc.match(/^nodes\/([^\s\/]+)\/lxc\/(\d+)\/migrate$/);
} }
}, },
......
...@@ -141,14 +141,14 @@ Ext.define('PVE.NodeSummary', { ...@@ -141,14 +141,14 @@ Ext.define('PVE.NodeSummary', {
}; };
PVE.Utils.API2Request({ PVE.Utils.API2Request({
url: '/nodes/' + me.nodename + '/openvz', url: '/nodes/' + me.nodename + '/lxc',
method: 'GET', method: 'GET',
success: function(response) { success: function(response) {
var d = response.result.data; var d = response.result.data;
d.nodename = me.nodename; d.nodename = me.nodename;
d.forEach(function(el) { el.type = 'openvz'; el.nodename = me.nodename }); d.forEach(function(el) { el.type = 'lxc'; el.nodename = me.nodename });
me.store.each(function(rec) { me.store.each(function(rec) {
if (rec.get('type') === 'openvz') { if (rec.get('type') === 'lxc') {
rec.destroy(); rec.destroy();
} }
}); });
......
...@@ -52,8 +52,8 @@ Ext.define('PVE.Workspace', { statics: { ...@@ -52,8 +52,8 @@ Ext.define('PVE.Workspace', { statics: {
history: null, history: null,
pages: [ pages: [
'PVE.OpenVzMigrate', 'PVE.LXCMigrate',
'PVE.OpenVzSummary', 'PVE.LXCSummary',
'PVE.QemuMigrate', 'PVE.QemuMigrate',
'PVE.QemuSummary', 'PVE.QemuSummary',
'PVE.NodeSummary', 'PVE.NodeSummary',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment