use split button for shutdown/stop for vm/ct

uses the new split button for the shutdown action
to reduse the number of buttons, and reduce confusion

also make the stop button 'dangerous'
(shows just a different symbol on the confirm dialog)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-04-05 11:25:33 +02:00 committed by Dietmar Maurer
parent 7900e69169
commit d6ace8a06d
2 changed files with 22 additions and 17 deletions

View File

@ -55,21 +55,25 @@ Ext.define('PVE.lxc.Config', {
}
});
var stopBtn = Ext.create('PVE.button.Button', {
var stopBtn = Ext.create('Ext.menu.Item',{
text: gettext('Stop'),
disabled: !caps.vms['VM.PowerMgmt'],
confirmMsg: PVE.Utils.format_task_description('vzstop', vmid),
dangerous: true,
handler: function() {
vm_command("stop");
}
});
var shutdownBtn = Ext.create('PVE.button.Button', {
var shutdownBtn = Ext.create('PVE.button.Split', {
text: gettext('Shutdown'),
disabled: !caps.vms['VM.PowerMgmt'],
confirmMsg: PVE.Utils.format_task_description('vzshutdown', vmid),
handler: function() {
vm_command('shutdown');
},
menu: {
items:[stopBtn]
}
});
@ -112,7 +116,7 @@ Ext.define('PVE.lxc.Config', {
Ext.apply(me, {
title: Ext.String.format(gettext("Container {0} on node {1}"), descr, "'" + nodename + "'"),
hstateid: 'lxctab',
tbar: [ startBtn, shutdownBtn, umountBtn, stopBtn, removeBtn,
tbar: [ startBtn, shutdownBtn, umountBtn, removeBtn,
migrateBtn, consoleBtn ],
defaults: { statusStore: me.statusStore },
items: [
@ -228,11 +232,11 @@ Ext.define('PVE.lxc.Config', {
if (status === 'mounted') {
umountBtn.setDisabled(false);
umountBtn.setVisible(true);
stopBtn.setVisible(false);
stopBtn.setDisabled(true);
} else {
umountBtn.setDisabled(true);
umountBtn.setVisible(false);
stopBtn.setVisible(true);
stopBtn.setDisabled(false);
}
});

View File

@ -55,15 +55,6 @@ Ext.define('PVE.qemu.Config', {
}
});
var stopBtn = Ext.create('PVE.button.Button', {
text: gettext('Stop'),
disabled: !caps.vms['VM.PowerMgmt'],
confirmMsg: PVE.Utils.format_task_description('qmstop', vmid),
handler: function() {
vm_command("stop", { timeout: 30 });
}
});
var migrateBtn = Ext.create('Ext.Button', {
text: gettext('Migrate'),
disabled: !caps.vms['VM.Migrate'],
@ -86,12 +77,23 @@ Ext.define('PVE.qemu.Config', {
}
});
var shutdownBtn = Ext.create('PVE.button.Button', {
var shutdownBtn = Ext.create('PVE.button.Split', {
text: gettext('Shutdown'),
disabled: !caps.vms['VM.PowerMgmt'],
confirmMsg: PVE.Utils.format_task_description('qmshutdown', vmid),
handler: function() {
vm_command('shutdown');
},
menu: {
items: [{
text: gettext('Stop'),
disabled: !caps.vms['VM.PowerMgmt'],
dangerous: true,
confirmMsg: PVE.Utils.format_task_description('qmstop', vmid),
handler: function() {
vm_command("stop", { timeout: 30 });
}
}]
}
});
@ -121,7 +123,7 @@ Ext.define('PVE.qemu.Config', {
Ext.apply(me, {
title: Ext.String.format(gettext("Virtual Machine {0} on node {1}"), descr, "'" + nodename + "'"),
hstateid: 'kvmtab',
tbar: [ resumeBtn, startBtn, shutdownBtn, stopBtn, resetBtn,
tbar: [ resumeBtn, startBtn, shutdownBtn, resetBtn,
removeBtn, migrateBtn, consoleBtn],
defaults: { statusStore: me.statusStore },
items: [
@ -241,7 +243,6 @@ Ext.define('PVE.qemu.Config', {
startBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'running' || template);
resetBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running' || template);
shutdownBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status !== 'running');
stopBtn.setDisabled(!caps.vms['VM.PowerMgmt'] || status === 'stopped');
removeBtn.setDisabled(!caps.vms['VM.Allocate'] || status !== 'stopped');
consoleBtn.setDisabled(template);
});