[pve-devel] [PATCH manager 1/3] Add Storage Controller class
Dominik Csapak
d.csapak at proxmox.com
Tue Oct 31 14:03:40 CET 2017
Comment inline:
On 10/31/2017 01:34 PM, Emmanuel Kasper wrote:
> This controller will display the 'Max Backups' field only if the storage can
> hold backups.
>
> Signed-off-by: Emmanuel Kasper <e.kasper at proxmox.com>
> ---
> www/manager6/Makefile | 1 +
> www/manager6/controller/StorageEdit.js | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
> create mode 100644 www/manager6/controller/StorageEdit.js
>
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index d2089618..d39bb49c 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -10,6 +10,7 @@ JSSRC= \
> button/ConsoleButton.js \
> button/Split.js \
> button/HelpButton.js \
> + controller/StorageEdit.js \
> qemu/SendKeyMenu.js \
> qemu/CmdMenu.js \
> qemu/TemplateMenu.js \
> diff --git a/www/manager6/controller/StorageEdit.js b/www/manager6/controller/StorageEdit.js
> new file mode 100644
> index 00000000..798d439f
> --- /dev/null
> +++ b/www/manager6/controller/StorageEdit.js
> @@ -0,0 +1,18 @@
> +Ext.define('PVE.controller.StorageEdit', {
> + extend: 'Ext.app.ViewController',
> + alias: 'controller.storageEdit',
> + control: {
> + 'field[name=content]': {
> + change: function(field, value) {
> + var hasBackups = Ext.Array.contains(value, 'backup');
> + var maxfiles = this.lookupReference('maxfiles');
> +
> + // do not disable invalid fields as it removes
> + // their dirty state
> + if (maxfiles.isValid()) {
> + maxfiles.setDisabled(!hasBackups);
> + }
i find that behaviour inconsistent:
if the maxfiles is invalid and we deselect backups, the maxfiles field
is still enabled, event tough it has no meaning in this configuration,
since we are unable to make backups on this storage now
something like this would be better imho:
when the maxfiles field gets disabled, reset it to the value it had, to
reflect that we do not change the backend value
> + }
> + }
> + }
> +});
>
More information about the pve-devel
mailing list