* [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
@ 2023-12-05 10:19 Christian Ebner
2023-12-06 9:07 ` Gabriel Goller
0 siblings, 1 reply; 4+ messages in thread
From: Christian Ebner @ 2023-12-05 10:19 UTC (permalink / raw)
To: pbs-devel
Warn about a missing garbage collection schedule, prune job or verify
job configurations in the datastore's summary panel.
Show the number of prune/verify job configurations, if there are jobs
configured.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- add check mark icon for configured jobs/schedule
- add question mark icon for unknown configuration state
- fix typo in garbage collection variable name
- add missing trailing commas found by pve-eslint
- refactor message initialization to allow to use format helper
functions
I included also the green check mark for configured states, as
suggested by Gabriel, as in the end I found it less invasive than I
thought it might be.
www/datastore/Summary.js | 98 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
diff --git a/www/datastore/Summary.js b/www/datastore/Summary.js
index a932b4e0..307fc220 100644
--- a/www/datastore/Summary.js
+++ b/www/datastore/Summary.js
@@ -49,12 +49,30 @@ Ext.define('PBS.DataStoreInfo', {
usage: {},
stillbad: 0,
mountpoint: "",
+ gcScheduleMsg: "",
+ pruneJobMsg: "",
+ verifyJobMsg: "",
},
},
controller: {
xclass: 'Ext.app.ViewController',
+ fmtConfigured: function(fmtString, params) {
+ let msg = Ext.String.format(fmtString, params);
+ return `<i class="fa fa-fw fa-lg fa-check-circle good"></i> ${msg}`;
+ },
+
+ fmtMissing: function(fmtString, params) {
+ let msg = Ext.String.format(fmtString, params);
+ return `<i class="fa fa-fw fa-lg fa-question-circle-o warning"></i> ${msg}`;
+ },
+
+ fmtWarning: function(fmtString, params) {
+ let msg = Ext.String.format(fmtString, params);
+ return `<i class="fa fa-fw fa-lg fa-exclamation-circle warning"></i> ${msg}`;
+ },
+
onLoad: function(store, data, success) {
let me = this;
if (!success) {
@@ -101,6 +119,50 @@ Ext.define('PBS.DataStoreInfo', {
vm.set('ctcount', countstext(counts.ct));
vm.set('vmcount', countstext(counts.vm));
vm.set('hostcount', countstext(counts.host));
+
+ Proxmox.Utils.API2Request({
+ url: `/config/datastore/${me.view.datastore}`,
+ success: function(response) {
+ if (response.result.data['gc-schedule']) {
+ vm.set('gcScheduleMsg', me.fmtConfigured(gettext('configured')));
+ } else {
+ vm.set('gcScheduleMsg', me.fmtWarning(gettext('none configured')));
+ }
+ },
+ failure: function() {
+ vm.set('gcScheduleMsg', me.fmtMissing(gettext('unknown')));
+ },
+ });
+
+ Proxmox.Utils.API2Request({
+ url: `/admin/prune?store=${me.view.datastore}`,
+ success: function(response) {
+ let len = response.result.data.length;
+ if (len > 0) {
+ vm.set('pruneJobMsg', me.fmtConfigured(gettext('{0} configured'), len));
+ } else {
+ vm.set('pruneJobMsg', me.fmtWarning(gettext('none configured')));
+ }
+ },
+ failure: function() {
+ vm.set('pruneJobMsg', me.fmtMissing(gettext('unknown')));
+ },
+ });
+
+ Proxmox.Utils.API2Request({
+ url: `/admin/verify?store=${me.view.datastore}`,
+ success: function(response) {
+ let len = response.result.data.length;
+ if (len > 0) {
+ vm.set('verifyJobMsg', me.fmtConfigured(gettext('{0} configured'), len));
+ } else {
+ vm.set('verifyJobMsg', me.fmtWarning(gettext('none configured')));
+ }
+ },
+ failure: function() {
+ vm.set('verifyJobMsg', me.fmtMissing(gettext('unknown')));
+ },
+ });
},
startStore: function() { this.store.startUpdate(); },
@@ -115,6 +177,14 @@ Ext.define('PBS.DataStoreInfo', {
});
me.store.on('load', me.onLoad, me);
},
+
+ initComponent: function() {
+ let me = this;
+ let vm = me.getViewModel();
+ vm.set('gcScheduleMsg', me.fmtMissing(gettext('unknown')));
+ vm.set('pruneJobMsg', me.fmtMissing(gettext('unknown')));
+ vm.set('verifyJobMsg', me.fmtMissing(gettext('unknown')));
+ },
},
listeners: {
@@ -201,6 +271,34 @@ Ext.define('PBS.DataStoreInfo', {
visible: '{stillbad}',
},
},
+ {
+ title: gettext('Garbage Collection Schedule'),
+ printBar: false,
+ bind: {
+ data: {
+ text: '{gcScheduleMsg}',
+ },
+ },
+ padding: '10 0 0 0',
+ },
+ {
+ title: gettext('Prune Jobs'),
+ printBar: false,
+ bind: {
+ data: {
+ text: '{pruneJobMsg}',
+ },
+ },
+ },
+ {
+ title: gettext('Verify Jobs'),
+ printBar: false,
+ bind: {
+ data: {
+ text: '{verifyJobMsg}',
+ },
+ },
+ },
],
});
--
2.39.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
2023-12-05 10:19 [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs Christian Ebner
@ 2023-12-06 9:07 ` Gabriel Goller
2023-12-06 11:16 ` Christian Ebner
0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Goller @ 2023-12-06 9:07 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Christian Ebner
On 12/5/23 11:19, Christian Ebner wrote:
> [..]
> @@ -115,6 +177,14 @@ Ext.define('PBS.DataStoreInfo', {
> });
> me.store.on('load', me.onLoad, me);
> },
> +
> + initComponent: function() {
> + let me = this;
> + let vm = me.getViewModel();
> + vm.set('gcScheduleMsg', me.fmtMissing(gettext('unknown')));
> + vm.set('pruneJobMsg', me.fmtMissing(gettext('unknown')));
> + vm.set('verifyJobMsg', me.fmtMissing(gettext('unknown')));
> + },
> },
`initComponent` won't be executed, because it is in a controller, not a
regular extjs component.
It works if you move these lines up to the `init()` function above.
> [..]
Otherwise it LGTM!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
2023-12-06 9:07 ` Gabriel Goller
@ 2023-12-06 11:16 ` Christian Ebner
2023-12-06 11:33 ` Christian Ebner
0 siblings, 1 reply; 4+ messages in thread
From: Christian Ebner @ 2023-12-06 11:16 UTC (permalink / raw)
To: Gabriel Goller, Proxmox Backup Server development discussion
> On 06.12.2023 10:07 CET Gabriel Goller <g.goller@proxmox.com> wrote:
>
> `initComponent` won't be executed, because it is in a controller, not a
> regular extjs component.
> It works if you move these lines up to the `init()` function above.
True, thanks for noticing! Will be fixed in version 3 of the patch.
> Otherwise it LGTM!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs
2023-12-06 11:16 ` Christian Ebner
@ 2023-12-06 11:33 ` Christian Ebner
0 siblings, 0 replies; 4+ messages in thread
From: Christian Ebner @ 2023-12-06 11:33 UTC (permalink / raw)
To: Proxmox Backup Server development discussion, Gabriel Goller
> On 06.12.2023 12:16 CET Christian Ebner <c.ebner@proxmox.com> wrote:
>
> True, thanks for noticing! Will be fixed in version 3 of the patch.
>
Patch version 3 available [0].
[0] https://lists.proxmox.com/pipermail/pbs-devel/2023-December/007451.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-06 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 10:19 [pbs-devel] [PATCH v2 proxmox-backup] ui: warn of missing gc-schedule, prune/verify jobs Christian Ebner
2023-12-06 9:07 ` Gabriel Goller
2023-12-06 11:16 ` Christian Ebner
2023-12-06 11:33 ` Christian Ebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox