From 1278aeec36f3fa2904167d2de0253e249f08fd01 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 5 Jun 2020 10:11:54 +0200 Subject: [PATCH] ui: add gc/prune schedule and options available in the ui by adding them as columns for the config view, and as a seperate tab on the edit window (this is done to not show too many options at once) Signed-off-by: Dominik Csapak --- www/config/DataStoreConfig.js | 56 ++++++++++++- www/window/DataStoreEdit.js | 153 +++++++++++++++++++++++++++------- 2 files changed, 177 insertions(+), 32 deletions(-) diff --git a/www/config/DataStoreConfig.js b/www/config/DataStoreConfig.js index 8ff647dd..75979119 100644 --- a/www/config/DataStoreConfig.js +++ b/www/config/DataStoreConfig.js @@ -10,12 +10,15 @@ Ext.define('pbs-datastore-list', { Ext.define('pbs-data-store-config', { extend: 'Ext.data.Model', - fields: [ 'name', 'path', 'comment' ], + fields: [ + 'name', 'path', 'comment', 'gc-schedule', 'prune-schedule', 'keep-last', + 'keep-hourly', 'keep-daily', 'keep-weekly', 'keep-monthly', 'keep-yearly', + ], proxy: { type: 'proxmox', - url: "/api2/json/config/datastore" + url: "/api2/json/config/datastore", }, - idProperty: 'name' + idProperty: 'name', }); Ext.define('PBS.DataStoreConfig', { @@ -133,6 +136,53 @@ Ext.define('PBS.DataStoreConfig', { dataIndex: 'path', flex: 1, }, + { + header: gettext('GC Schedule'), + sortable: false, + width: 120, + dataIndex: 'gc-schedule', + }, + { + header: gettext('Prune Schedule'), + sortable: false, + width: 120, + dataIndex: 'prune-schedule', + }, + { + header: gettext('Keep'), + columns: [ + { + text: gettext('Last'), + dataIndex: 'keep-last', + width: 70, + }, + { + text: gettext('Hourly'), + dataIndex: 'keep-hourly', + width: 70, + }, + { + text: gettext('Daily'), + dataIndex: 'keep-daily', + width: 70, + }, + { + text: gettext('Weekly'), + dataIndex: 'keep-weekly', + width: 70, + }, + { + text: gettext('Monthly'), + dataIndex: 'keep-monthly', + width: 70, + }, + { + text: gettext('Yearly'), + dataIndex: 'keep-yearly', + width: 70, + }, + ] + }, { header: gettext('Comment'), sortable: false, diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js index 9bce935e..6dffa1a3 100644 --- a/www/window/DataStoreEdit.js +++ b/www/window/DataStoreEdit.js @@ -6,6 +6,8 @@ Ext.define('PBS.DataStoreEdit', { subject: gettext('Datastore'), isAdd: true, + bodyPadding: 0, + cbindData: function(initialConfig) { var me = this; @@ -21,39 +23,132 @@ Ext.define('PBS.DataStoreEdit', { items: [ { - xtype: 'inputpanel', - column1: [ + xtype: 'tabpanel', + bodyPadding: 10, + items: [ { - xtype: 'pmxDisplayEditField', - cbind: { - editable: '{isCreate}', - }, - name: 'name', - allowBlank: false, - fieldLabel: gettext('Name'), - }, - ], + title: gettext('General'), + xtype: 'inputpanel', + column1: [ + { + xtype: 'pmxDisplayEditField', + cbind: { + editable: '{isCreate}', + }, + name: 'name', + allowBlank: false, + fieldLabel: gettext('Name'), + }, + { + xtype: 'pmxDisplayEditField', + cbind: { + editable: '{isCreate}', + }, + name: 'path', + allowBlank: false, + fieldLabel: gettext('Backing Path'), + emptyText: gettext('An absolute path'), + }, + ], - column2: [ - { - xtype: 'pmxDisplayEditField', - cbind: { - editable: '{isCreate}', - }, - name: 'path', - allowBlank: false, - fieldLabel: gettext('Backing Path'), - emptyText: gettext('An absolute path'), - }, - ], + column2: [ + { + xtype: 'proxmoxtextfield', + name: 'gc-schedule', + fieldLabel: gettext("GC Schedule"), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'prune-schedule', + fieldLabel: gettext("Prune Schedule"), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], - columnB: [ - { - xtype: 'textfield', - name: 'comment', - fieldLabel: gettext('Comment'), + columnB: [ + { + xtype: 'textfield', + name: 'comment', + fieldLabel: gettext('Comment'), + }, + ], }, - ], + { + title: gettext('Prune Options'), + xtype: 'inputpanel', + column1: [ + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Last'), + name: 'keep-last', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Daily'), + name: 'keep-daily', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Monthly'), + name: 'keep-monthly', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + ], + + column2: [ + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Hourly'), + name: 'keep-hourly', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Weekly'), + name: 'keep-weekly', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + { + xtype: 'proxmoxintegerfield', + fieldLabel: gettext('Keep Yearly'), + name: 'keep-yearly', + cbind: { + deleteEmpty: '{!isCreate}', + }, + minValue: 1, + allowBlank: true, + }, + ], + + } + ] } ], });