[pbs-devel] [PATCH proxmox-backup v8 27/45] ui: add s3 client selector and bucket field for s3 backend setup
Lukas Wagner
l.wagner at proxmox.com
Tue Jul 22 11:25:19 CEST 2025
On Sat Jul 19, 2025 at 2:28 PM CEST, Christian Ebner wrote:
> On 7/18/25 12:02 PM, Lukas Wagner wrote:
>>> listeners: {
>>> change: function (checkbox, selected) {
>>> let isRemovable = selected === 'removable';
>>> + let isS3 = selected === 's3';
>>>
>>> let inputPanel = checkbox.up('inputpanel');
>>> let pathField = inputPanel.down('[name=path]');
>>> let uuidEditField = inputPanel.down('[name=backing-device]');
>>> + let bucketField = inputPanel.down('[name=bucket]');
>>> + let s3ClientSelector = inputPanel.down('[name=s3client]');
>>>
>>> uuidEditField.setDisabled(!isRemovable);
>>> uuidEditField.allowBlank = !isRemovable;
>>> uuidEditField.setValue('');
>>>
>>> + bucketField.setDisabled(!isS3);
>>> + bucketField.allowBlank = !isS3;
>>> + bucketField.setValue('');
>>> +
>>> + s3ClientSelector.setDisabled(!isS3);
>>> + s3ClientSelector.allowBlank = !isS3;
>>> + s3ClientSelector.setValue('');
>>> +
>>> if (isRemovable) {
>>> pathField.setFieldLabel(gettext('Path on Device'));
>>> pathField.setEmptyText(gettext('A relative path'));
>>> + } else if (isS3) {
>>> + pathField.setFieldLabel(gettext('Store Cache'));
>>> + pathField.setEmptyText(gettext('An absolute path'));
>>> } else {
>>> pathField.setFieldLabel(gettext('Backing Path'));
>>> pathField.setEmptyText(gettext('An absolute path'));
>>
>> Yup, with these additional changes I'd definitely prefer the viewModel approach mentioned earlier :)
>
> Well... I did check this out, also based on the off-list input you gave
> me on this one, but unfortunately the viewModel and binding approach
> does not work just yet, since the `pmxDisplayField` xtype used for the
> `path` does not implement the logic for bindings of the `fieldLabel` and
> `emtpyText`. Therefore these cannot be dynamically adapted by the use of
> formulas and/or view model data.
>
> So I would like to rather do this as followup instead, to not further
> delay the path series until I've figured out how to correctly add these
> as bindable values in the corresponding component.
>
> But I do see the benefits of the viewModel and formulas approach, thanks
> a lot for your input on that.
As a workaround we could just keep the fieldLabel and emptyText static
and use separate fields that are hidden/shown on demand, supported by
the view model. Might need some additional code in onSetValues and/or
onGetValues to then map these fields to the correct parameter in the end.
But as you said, this is definitely material for a follow-up, no
pressure now.
More information about the pbs-devel
mailing list