[pbs-devel] [PATCH proxmox-backup 3/5] ui: form/DataStoreSelector: show maintenance mode in selector
Dominik Csapak
d.csapak at proxmox.com
Tue May 17 08:52:13 CEST 2022
to not having to query the activeTasks everywhere, change the renderer
to omit the check/spinner when no activeTasks are given
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
www/Utils.js | 17 ++++++++++-------
www/form/DataStoreSelector.js | 9 +++++++++
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/www/Utils.js b/www/Utils.js
index 838b4511..b277cd99 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -662,14 +662,17 @@ Ext.define('PBS.Utils', {
let [type, message] = PBS.Utils.parseMaintenanceMode(mode);
- const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0);
-
let extra = '';
- if (conflictingTasks > 0) {
- extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
- extra += Ext.String.format(gettext('{0} conflicting tasks still active.'), conflictingTasks);
- } else {
- extra += '<i class="fa fa-check"></i>';
+
+ if (activeTasks !== undefined) {
+ const conflictingTasks = activeTasks.write + (type === 'offline' ? activeTasks.read : 0);
+
+ if (conflictingTasks > 0) {
+ extra += '| <i class="fa fa-spinner fa-pulse fa-fw"></i> ';
+ extra += Ext.String.format(gettext('{0} conflicting tasks still active.'), conflictingTasks);
+ } else {
+ extra += '<i class="fa fa-check"></i>';
+ }
}
if (message) {
diff --git a/www/form/DataStoreSelector.js b/www/form/DataStoreSelector.js
index a1471a84..90f20bee 100644
--- a/www/form/DataStoreSelector.js
+++ b/www/form/DataStoreSelector.js
@@ -29,6 +29,15 @@ Ext.define('PBS.form.DataStoreSelector', {
renderer: Ext.String.htmlEncode,
flex: 1,
},
+ {
+ header: gettext('Maintenance'),
+ sortable: true,
+ dataIndex: 'maintenance',
+ renderer: (value) => {
+ return PBS.Utils.renderMaintenance(value);
+ },
+ flex: 1,
+ }
],
},
});
--
2.30.2
More information about the pbs-devel
mailing list