mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 11:33:50 +00:00
make container clones/template available in the gui
also refactor the right click menu logic Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
34c61eaf4b
commit
9bad05bd76
@ -831,32 +831,22 @@ Ext.define('PVE.Utils', { utilities: {
|
|||||||
v.select(record);
|
v.select(record);
|
||||||
}
|
}
|
||||||
var menu;
|
var menu;
|
||||||
|
var template = !!record.data.template;
|
||||||
|
var type = record.data.type;
|
||||||
|
|
||||||
if (record.data.type === 'qemu' && !record.data.template) {
|
if (template) {
|
||||||
menu = Ext.create('PVE.qemu.CmdMenu', {
|
if (type === 'qemu' || type == 'lxc') {
|
||||||
pveSelNode: record
|
menu = Ext.create('PVE.menu.TemplateMenu', {
|
||||||
});
|
pveSelNode: record
|
||||||
} else if (record.data.type === 'qemu' && record.data.template) {
|
});
|
||||||
menu = Ext.create('PVE.menu.TemplateMenu', {
|
}
|
||||||
pveSelNode: record
|
} else if (type === 'qemu' ||
|
||||||
});
|
type === 'lxc' ||
|
||||||
} else if (record.data.type === 'lxc' && !record.data.template) {
|
type === 'node') {
|
||||||
menu = Ext.create('PVE.lxc.CmdMenu', {
|
menu = Ext.create('PVE.' + type + '.CmdMenu', {
|
||||||
pveSelNode: record
|
pveSelNode: record,
|
||||||
});
|
|
||||||
} else if (record.data.type === 'lxc' && record.data.template) {
|
|
||||||
/* since clone does not work reliably, disable for now
|
|
||||||
menu = Ext.create('PVE.lxc.TemplateMenu', {
|
|
||||||
pveSelNode: record
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
return;
|
|
||||||
|
|
||||||
} else if (record.data.type === 'node' ){
|
|
||||||
menu = Ext.create('PVE.node.CmdMenu', {
|
|
||||||
nodename: record.data.node
|
nodename: record.data.node
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +115,14 @@ Ext.define('PVE.lxc.CmdMenu', {
|
|||||||
xtype: 'menuseparator',
|
xtype: 'menuseparator',
|
||||||
hidden: standalone || !caps.vms['VM.Migrate']
|
hidden: standalone || !caps.vms['VM.Migrate']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: gettext('Clone'),
|
||||||
|
iconCls: 'fa fa-fw fa-clone',
|
||||||
|
hidden: !caps.vms['VM.Clone'],
|
||||||
|
handler: function() {
|
||||||
|
PVE.window.Clone.wrap(nodename, vmid, me.isTemplate, 'lxc');
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: gettext('Migrate'),
|
text: gettext('Migrate'),
|
||||||
iconCls: 'fa fa-fw fa-send-o',
|
iconCls: 'fa fa-fw fa-send-o',
|
||||||
@ -128,26 +136,26 @@ Ext.define('PVE.lxc.CmdMenu', {
|
|||||||
win.show();
|
win.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// text: gettext('Convert to template'),
|
text: gettext('Convert to template'),
|
||||||
// icon: '/pve2/images/forward.png',
|
iconCls: 'fa fa-fw fa-file-o',
|
||||||
// handler: function() {
|
handler: function() {
|
||||||
// var msg = Proxmox.Utils.format_task_description('vztemplate', vmid);
|
var msg = Proxmox.Utils.format_task_description('vztemplate', vmid);
|
||||||
// Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
|
Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
|
||||||
// if (btn !== 'yes') {
|
if (btn !== 'yes') {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// Proxmox.Utils.API2Request({
|
Proxmox.Utils.API2Request({
|
||||||
// url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
|
url: '/nodes/' + nodename + '/lxc/' + vmid + '/template',
|
||||||
// method: 'POST',
|
method: 'POST',
|
||||||
// failure: function(response, opts) {
|
failure: function(response, opts) {
|
||||||
// Ext.Msg.alert('Error', response.htmlStatus);
|
Ext.Msg.alert('Error', response.htmlStatus);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// },
|
},
|
||||||
{ xtype: 'menuseparator' },
|
{ xtype: 'menuseparator' },
|
||||||
{
|
{
|
||||||
text: gettext('Console'),
|
text: gettext('Console'),
|
||||||
|
@ -93,6 +93,32 @@ Ext.define('PVE.lxc.Config', {
|
|||||||
var moreBtn = Ext.create('Proxmox.button.Button', {
|
var moreBtn = Ext.create('Proxmox.button.Button', {
|
||||||
text: gettext('More'),
|
text: gettext('More'),
|
||||||
menu: { items: [
|
menu: { items: [
|
||||||
|
{
|
||||||
|
text: gettext('Clone'),
|
||||||
|
iconCls: 'fa fa-fw fa-clone',
|
||||||
|
hidden: caps.vms['VM.Clone'] ? false : true,
|
||||||
|
handler: function() {
|
||||||
|
PVE.window.Clone.wrap(nodename, vmid, template, 'lxc');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: gettext('Convert to template'),
|
||||||
|
disabled: template,
|
||||||
|
xtype: 'pveMenuItem',
|
||||||
|
iconCls: 'fa fa-fw fa-file-o',
|
||||||
|
hidden: caps.vms['VM.Allocate'] ? false : true,
|
||||||
|
confirmMsg: Proxmox.Utils.format_task_description('vztemplate', vmid),
|
||||||
|
handler: function() {
|
||||||
|
Proxmox.Utils.API2Request({
|
||||||
|
url: base_url + '/template',
|
||||||
|
waitMsgTarget: me,
|
||||||
|
method: 'POST',
|
||||||
|
failure: function(response, opts) {
|
||||||
|
Ext.Msg.alert('Error', response.htmlStatus);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
iconCls: 'fa fa-heartbeat ',
|
iconCls: 'fa fa-heartbeat ',
|
||||||
hidden: !caps.nodes['Sys.Console'],
|
hidden: !caps.nodes['Sys.Console'],
|
||||||
|
Loading…
Reference in New Issue
Block a user