summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
e8b411f)
The UI state about running tasks can be out of sync, especially for
situations where one quickly follows up with a stop, e.g. after
triggering a shutdown by mistake.
So, show the checkbox always for users that got Sys.Modify on (some)
node, but pre-check it still only if there where task detected on
component creation (we could watch the state though and show a hint,
but that's a bit over the top IMO).
Show it also when HA is enabled but explicitly disable it there,
hopefully this increases the chance that the users can understand that
this is done by design, and isn't a bug – ideally we would also show
an extra hint.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
// offer to overrule if there is at least one matching shutdown task and the guest is not
// HA-enabled. Also allow users to abort tasks started by one of their API tokens.
// offer to overrule if there is at least one matching shutdown task and the guest is not
// HA-enabled. Also allow users to abort tasks started by one of their API tokens.
- let shutdownTaskIdx = Ext.getStore('pve-cluster-tasks')?.findBy(task =>
+ let activeShutdownTask = Ext.getStore('pve-cluster-tasks')?.findBy(task =>
(hasSysModify || task.data.user === Proxmox.UserName) &&
task.data.id === me.vm.vmid.toString() &&
task.data.status === undefined &&
task.data.type === overruleTaskType,
(hasSysModify || task.data.user === Proxmox.UserName) &&
task.data.id === me.vm.vmid.toString() &&
task.data.status === undefined &&
task.data.type === overruleTaskType,
let haEnabled = me.vm.hastate && me.vm.hastate !== 'unmanaged';
let haEnabled = me.vm.hastate && me.vm.hastate !== 'unmanaged';
- me.askOverrule = !haEnabled && shutdownTaskIdx >= 0;
me.promptContainer.add({
xtype: 'proxmoxcheckbox',
name: 'overrule-shutdown',
me.promptContainer.add({
xtype: 'proxmoxcheckbox',
name: 'overrule-shutdown',
+ checked: !haEnabled && activeShutdownTask,
boxLabel: gettext('Overrule active shutdown tasks'),
boxLabel: gettext('Overrule active shutdown tasks'),
- hidden: !me.askOverrule,
+ hidden: !(hasSysModify || activeShutdownTask),
+ disabled: !(hasSysModify || activeShutdownTask) || haEnabled,
+ padding: '3 0 0 0',
});
},
handler: function(btn) {
let me = this;
if (btn === 'yes') {
});
},
handler: function(btn) {
let me = this;
if (btn === 'yes') {
- let checkbox = me.promptContainer.down('proxmoxcheckbox[name=overrule-shutdown]');
- let overruleShutdown = me.askOverrule && checkbox.getSubmitValue();
- let params = overruleShutdown ? { 'overrule-shutdown': 1 } : undefined;
+ let overruleField = me.promptContainer.down('proxmoxcheckbox[name=overrule-shutdown]');
+ let params = !overruleField.isDisabled() && overruleField.getSubmitValue()
+ ? { 'overrule-shutdown': 1 }
+ : undefined;
Proxmox.Utils.API2Request({
url: me.url,
waitMsgTarget: me,
Proxmox.Utils.API2Request({
url: me.url,
waitMsgTarget: me,