ui: datastore options: maintenance mode related refactorings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-04-12 16:52:14 +02:00
parent 3c8f240712
commit 9c3b29bd8f
2 changed files with 8 additions and 6 deletions

View File

@ -25,9 +25,6 @@ Ext.define('PBS.Datastore.Options', {
init: function(view) {
let me = this;
me.callParent();
view.rows['maintenance-mode'].renderer =
(value) => PBS.Utils.renderMaintenance(value, view.maintenanceActiveTasks);
me.activeOperationsRstore = Ext.create('Proxmox.data.ObjectStore', {
url: `/api2/json/admin/datastore/${view.datastore}/active-operations`,
@ -36,8 +33,9 @@ Ext.define('PBS.Datastore.Options', {
me.activeOperationsRstore.startUpdate();
view.mon(me.activeOperationsRstore, 'load', (store, data, success) => {
me.view.maintenanceActiveTasks.read = data[0].data.value;
me.view.maintenanceActiveTasks.write = data[1].data.value;
let activeTasks = me.getView().maintenanceActiveTasks;
activeTasks.read = data[0].data.value;
activeTasks.write = data[1].data.value;
});
},
@ -152,6 +150,9 @@ Ext.define('PBS.Datastore.Options', {
"maintenance-mode": {
required: true,
header: gettext('Maintenance mode'),
renderer: function(v) {
return PBS.Utils.renderMaintenance(v, this.maintenanceActiveTasks);
},
editor: {
xtype: 'pbsMaintenanceOptionEdit',
},

View File

@ -22,6 +22,7 @@ Ext.define('PBS.window.MaintenanceOptions', {
},
items: {
xtype: 'inputpanel',
onGetValues: function(values) {
if (values.delete === 'maintenance-type') {
values.delete = 'maintenance-mode';
@ -37,7 +38,6 @@ Ext.define('PBS.window.MaintenanceOptions', {
delete values['maintenance-msg'];
return values;
},
xtype: 'inputpanel',
items: [
{
xtype: 'pbsMaintenanceType',
@ -50,6 +50,7 @@ Ext.define('PBS.window.MaintenanceOptions', {
xtype: 'proxmoxtextfield',
name: 'maintenance-msg',
fieldLabel: gettext('Description'),
// FIXME: disable if maintenance type is none
},
],
},