From b614b29bea0012ebcf75d23cbf23a6c31c39053e Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 6 Nov 2020 17:51:52 +0100 Subject: [PATCH] ui: datastore: add option view tab Signed-off-by: Thomas Lamprecht --- www/Makefile | 1 + www/datastore/OptionView.js | 87 +++++++++++++++++++++++++++++++++++++ www/datastore/Panel.js | 9 ++++ 3 files changed, 97 insertions(+) create mode 100644 www/datastore/OptionView.js diff --git a/www/Makefile b/www/Makefile index 126f150a..8bb871f6 100644 --- a/www/Makefile +++ b/www/Makefile @@ -53,6 +53,7 @@ JSSRC= \ datastore/PruneAndGC.js \ datastore/Prune.js \ datastore/Content.js \ + datastore/OptionView.js \ datastore/Panel.js \ BackupGroupChangeOwner.js \ ServerStatus.js \ diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js new file mode 100644 index 00000000..1ea61f67 --- /dev/null +++ b/www/datastore/OptionView.js @@ -0,0 +1,87 @@ +Ext.define('PBS.Datastore.Options', { + extend: 'Proxmox.grid.ObjectGrid', + xtype: 'pbsDatastoreOptionView', + mixins: ['Proxmox.Mixin.CBind'], + + cbindData: function(initial) { + let me = this; + + me.datastore = encodeURIComponent(me.datastore); + me.url = `/api2/json/config/datastore/${me.datastore}`; + me.editorConfig = { + url: `/api2/extjs/config/datastore/${me.datastore}`, + datastore: me.datastore, + }; + return {}; + }, + + controller: { + xclass: 'Ext.app.ViewController', + + edit: function() { + this.getView().run_editor(); + }, + }, + + tbar: [ + { + xtype: 'proxmoxButton', + text: gettext('Edit'), + disabled: true, + handler: 'edit', + }, + ], + + listeners: { + activate: function() { this.rstore.startUpdate(); }, + destroy: function() { this.rstore.stopUpdate(); }, + deactivate: function() { this.rstore.stopUpdate(); }, + itemdblclick: 'edit', + }, + + rows: { + "notify": { + required: true, + header: gettext('Notfiy'), + renderer: (value) => { + let notify = PBS.Utils.parsePropertyString(value); + let res = []; + for (const k of ['Verify', 'Sync', 'GC']) { + let v = Ext.String.capitalize(notify[k.toLowerCase()]) || 'Always'; + res.push(`${k}=${v}`); + } + return res.join(', '); + }, + editor: { + xtype: 'pbsNotifyOptionEdit', + }, + }, + "notify-user": { + required: true, + defaultValue: 'root@pam', + header: gettext('Notfiy User'), + editor: { + xtype: 'pbsNotifyOptionEdit', + }, + }, + "verify-new": { + required: true, + header: gettext('Verify New Snapshots'), + defaultValue: false, + renderer: Proxmox.Utils.format_boolean, + editor: { + xtype: 'proxmoxWindowEdit', + title: gettext('Verify New'), + width: 350, + items: { + xtype: 'proxmoxcheckbox', + name: 'verify-new', + boxLabel: gettext("Verify new backups immediately after completion"), + defaultValue: false, + deleteDefaultValue: true, + deleteEmpty: true, + }, + }, + }, + }, +}); diff --git a/www/datastore/Panel.js b/www/datastore/Panel.js index 4368d1d7..473aa50c 100644 --- a/www/datastore/Panel.js +++ b/www/datastore/Panel.js @@ -77,6 +77,15 @@ Ext.define('PBS.DataStorePanel', { datastore: '{datastore}', }, }, + { + xtype: 'pbsDatastoreOptionView', + itemId: 'options', + title: gettext('Options'), + iconCls: 'fa fa-cog', + cbind: { + datastore: '{datastore}', + }, + }, { itemId: 'acl', xtype: 'pbsACLView',