From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@pve.proxmox.com
Subject: [pve-devel] [PATCH v4 manager 5/5] fix #2609 gui: backup: add window for not backed guests
Date: Tue, 7 Jul 2020 11:49:02 +0200 [thread overview]
Message-ID: <20200707094902.24712-6-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20200707094902.24712-1-a.lauterer@proxmox.com>
In case that there are guests which are not covered by any backup job, a
notification is shown and a window with a grid can be opened to view
these guests.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
v2 -> v4: (v3 was skipped to align version number to the rest of the
series)
* changed from having a dedicated `Summary` button to showing a
notification if there are guests not covered by any job
* API data is now fetched in the main backup grid and pushed to the
window showing the not covered guests
* code for the search box has been simplified
v1->v2:
* renamed ostore to cold_store
* changed double negative for permissions `not_all_permissions` to
`permissions_for_all`
www/manager6/dc/Backup.js | 145 +++++++++++++++++++++++++++++++++++++-
1 file changed, 144 insertions(+), 1 deletion(-)
diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 1e070510..1c0b5c57 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -696,6 +696,89 @@ Ext.define('PVE.dc.BackupInfo', {
}
});
+
+Ext.define('PVE.dc.BackedGuests', {
+ extend: 'Ext.grid.GridPanel',
+ alias: 'widget.pveBackedGuests',
+
+ textfilter: '',
+
+ columns: [
+ {
+ header: gettext('Type'),
+ dataIndex: "type",
+ renderer: PVE.Utils.render_resource_type,
+ flex: 1,
+ sortable: true,
+ },
+ {
+ header: gettext('VMID'),
+ dataIndex: 'vmid',
+ flex: 1,
+ sortable: true,
+ },
+ {
+ header: gettext('Name'),
+ dataIndex: 'name',
+ flex: 2,
+ sortable: true,
+ },
+ ],
+
+ initComponent: function() {
+ let me = this;
+
+ me.store.clearFilter(true);
+
+ Ext.apply(me, {
+ stateful: true,
+ stateId: 'grid-dc-backed-guests',
+ tbar: [
+ '->',
+ gettext('Search') + ':', ' ',
+ {
+ xtype: 'textfield',
+ width: 200,
+ enableKeyEvents: true,
+ listeners: {
+ buffer: 500,
+ keyup: function(field) {
+ let searchValue = field.getValue();
+ searchValue = searchValue.toLowerCase();
+
+ me.store.clearFilter(true);
+ me.store.filterBy(function(record) {
+ let match = false;
+
+ Ext.each(['name', 'vmid', 'type'], function(property) {
+ if (record.data[property] == null) {
+ return;
+ }
+
+ let v = record.data[property].toString();
+ if (v !== undefined) {
+ v = v.toLowerCase();
+ if (v.includes(searchValue)) {
+ match = true;
+ return;
+ }
+ }
+ });
+ return match;
+ });
+ }
+ }
+ }
+ ],
+ viewConfig: {
+ stripeRows: true,
+ trackOver: false,
+ },
+ });
+ me.callParent();
+ },
+});
+
Ext.define('PVE.dc.BackupView', {
extend: 'Ext.grid.GridPanel',
@@ -716,8 +799,27 @@ Ext.define('PVE.dc.BackupView', {
}
});
+ var not_backed_store = new Ext.data.Store({
+ sorters: 'vmid',
+ proxy:{
+ type: 'proxmox',
+ url: 'api2/json/cluster/backupinfo/not_backed_up',
+ },
+ });
+
var reload = function() {
store.load();
+ not_backed_store.load({
+ callback: function(records, operation, success) {
+ if (records.length) {
+ not_backed_warning.setVisible(true);
+ not_backed_btn.setVisible(true);
+ } else {
+ not_backed_warning.setVisible(false);
+ not_backed_btn.setVisible(false);
+ }
+ },
+ });
};
var sm = Ext.create('Ext.selection.RowModel', {});
@@ -834,6 +936,34 @@ Ext.define('PVE.dc.BackupView', {
}));
};
+ var run_show_not_backed = function() {
+ var me = this;
+ var backedinfo = Ext.create('PVE.dc.BackedGuests', {
+ flex: 1,
+ layout: 'fit',
+ store: not_backed_store,
+ });
+
+ var win = Ext.create('Ext.window.Window', {
+ modal: true,
+ width: 600,
+ height: 500,
+ resizable: true,
+ layout: 'fit',
+ title: gettext('Guests without backup job'),
+
+ items:[{
+ xtype: 'panel',
+ region: 'center',
+ layout: {
+ type: 'vbox',
+ align: 'stretch'
+ },
+ items: [backedinfo],
+ }]
+ }).show();
+ };
+
var edit_btn = new Proxmox.button.Button({
text: gettext('Edit'),
disabled: true,
@@ -882,6 +1012,17 @@ Ext.define('PVE.dc.BackupView', {
handler: run_detail,
});
+ var not_backed_warning = Ext.create('Ext.toolbar.TextItem', {
+ html: '<i class="fa fa-fw fa-exclamation-circle"></i>' + gettext('Some guests are not covered by any backup job.'),
+ hidden: true,
+ });
+
+ var not_backed_btn = new Proxmox.button.Button({
+ text: gettext('Show'),
+ hidden: true,
+ handler: run_show_not_backed,
+ });
+
Proxmox.Utils.monStoreErrors(me, store);
Ext.apply(me, {
@@ -907,7 +1048,9 @@ Ext.define('PVE.dc.BackupView', {
detail_btn,
'-',
run_btn,
- '-',
+ '->',
+ not_backed_warning,
+ not_backed_btn,
],
columns: [
{
--
2.20.1
next prev parent reply other threads:[~2020-07-07 9:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 9:48 [pve-devel] [PATCH v4 manager 0/5] add backup detail and not backed up view Aaron Lauterer
2020-07-07 9:48 ` [pve-devel] [PATCH v4 manager 1/5] api: backup: add endpoint to list included guests and volumes Aaron Lauterer
2020-07-08 7:11 ` Thomas Lamprecht
2020-07-08 7:21 ` Aaron Lauterer
2020-07-07 9:48 ` [pve-devel] [PATCH v4 manager 2/5] gui: dc/backup: move renderers to Utils.js Aaron Lauterer
2020-07-07 9:49 ` [pve-devel] [PATCH v4 manager 3/5] gui: dc/backup: add new backup job detail view Aaron Lauterer
2020-07-07 9:49 ` [pve-devel] [PATCH v4 manager 4/5] fix #2609 api: backupinfo: add non job specific endpoint Aaron Lauterer
2020-07-07 9:49 ` Aaron Lauterer [this message]
2020-07-09 18:06 ` [pve-devel] applied-series: Re: [PATCH v4 manager 0/5] add backup detail and not backed up view Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200707094902.24712-6-a.lauterer@proxmox.com \
--to=a.lauterer@proxmox.com \
--cc=pve-devel@pve.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal