[pbs-devel] [PATCH proxmox-backup 14/26] ui: maintenance edit: disable description in maintenance edit if no type is selected
Hannes Laimer
h.laimer at proxmox.com
Tue Jul 5 15:08:22 CEST 2022
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
www/Utils.js | 5 ++++-
www/window/MaintenanceOptions.js | 11 ++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index a1f17bdc..977a5255 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -666,7 +666,8 @@ Ext.define('PBS.Utils', {
let extra = '';
if (activeTasks !== undefined) {
- const conflictingTasks = activeTasks.write + (maintenance.type === 'offline' ? activeTasks.read : 0);
+ const conflictingTasks = activeTasks.write +
+ (['offline', 'unplugged'].includes(maintenance.type) ? activeTasks.read : 0);
if (conflictingTasks > 0) {
extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
@@ -682,6 +683,8 @@ Ext.define('PBS.Utils', {
let modeText = Proxmox.Utils.unknownText;
switch (maintenance.type) {
+ case 'unplugged': modeText = `<i>${gettext("Unplugged")}</i>`;
+ break;
case 'read-only': modeText = gettext("Read-only");
break;
case 'offline': modeText = gettext("Offline");
diff --git a/www/window/MaintenanceOptions.js b/www/window/MaintenanceOptions.js
index 3cd3e2ce..8907d75d 100644
--- a/www/window/MaintenanceOptions.js
+++ b/www/window/MaintenanceOptions.js
@@ -54,14 +54,20 @@ Ext.define('PBS.window.MaintenanceOptions', {
xtype: 'pbsMaintenanceType',
name: 'maintenance-type',
fieldLabel: gettext('Maintenance Type'),
+ listeners: {
+ change: (_picker, newValue, _oldValue) => {
+ Ext.ComponentManager.get('message-field')
+ .setDisabled(newValue === '__default__');
+ },
+ },
value: '__default__',
deleteEmpty: true,
},
{
xtype: 'proxmoxtextfield',
+ id: 'message-field',
name: 'maintenance-msg',
fieldLabel: gettext('Description'),
- // FIXME: disable if maintenance type is none
},
],
},
@@ -81,5 +87,8 @@ Ext.define('PBS.window.MaintenanceOptions', {
}
me.callParent([options]);
+
+ Ext.ComponentManager.get('message-field')
+ .setDisabled(options['maintenance-type'] === '__default__');
},
});
--
2.30.2
More information about the pbs-devel
mailing list