[pbs-devel] [PATCH v5 proxmox-backup 23/31] ui: sync: pass sync-direction to allow removing push jobs

Christian Ebner c.ebner at proxmox.com
Wed Oct 30 14:50:01 CET 2024


On 10/30/24 14:33, Fabian Grünbichler wrote:
> 
>> Christian Ebner <c.ebner at proxmox.com> hat am 30.10.2024 14:23 CET geschrieben:
>>
>>   
>> On 10/25/24 12:42, Dominik Csapak wrote:
>>> a bit high level, and sorry if i'm late to the party
>>> (maybe that was already asked in a previous iteration)
>>>
>>> why does the api call require the type to be given for it to be identified?
>>>
>>> AFAICS the jobs are in the same sectionconfig which share an id
>>> namespace anyway?
>>
>> The `SectionConfigData` one gets from `sync::config()` calls requires
>> both, the `id` and the `type` for entry lookups. I could not find a way
>> to get the config entry just by `id`. So keeping this as is, unless I am
>> overseeing a way to achieve this without the type?
> 
> there is convert_to_array, but you can also iterate over the sections yourself (they are pub after all, it's just a HashMap inside..)

Okay, with that it should work indeed, will adapt accordingly.
Thanks!

> 
>>
>>> if the api call would get the type automatically from the config, the
>>> parameter
>>> and this patch would vanish completely?
>>>
>>> On 10/18/24 10:42, Christian Ebner wrote:
>>>> Without the `sync-direction` parameter set, the job will not be
>>>> found in the config, because the `sync` config type is used instead
>>>> of the correct `sync-push` for sync jobs in push direction.
>>>>
>>>> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
>>>> ---
>>>> changes since version 4:
>>>> - no changes
>>>>
>>>> changes since version 3:
>>>> - no changes
>>>>
>>>>    www/config/SyncView.js | 22 +++++++++++++++++++++-
>>>>    1 file changed, 21 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/www/config/SyncView.js b/www/config/SyncView.js
>>>> index 68a147615..981b9b251 100644
>>>> --- a/www/config/SyncView.js
>>>> +++ b/www/config/SyncView.js
>>>> @@ -104,6 +104,26 @@ Ext.define('PBS.config.SyncJobView', {
>>>>            });
>>>>        },
>>>> +    removeSyncJob: function(btn, event, rec) {
>>>> +        let me = this;
>>>> +        let view = me.getView();
>>>> +        let params = {};
>>>> +        if (view.syncDirection !== undefined) {
>>>> +        params["sync-direction"] = view.syncDirection;
>>>> +        }
>>>> +        Proxmox.Utils.API2Request({
>>>> +        url: '/config/sync/' + rec.getId(),
>>>> +        method: 'DELETE',
>>>> +        params: params,
>>>> +        callback: function(options, success, response) {
>>>> +            Ext.callback(me.callback, me.scope, [options, success,
>>>> response, 0, me]);
>>>> +        },
>>>> +        failure: function(response, opt) {
>>>> +            Ext.Msg.alert(gettext('Error'), response.htmlStatus);
>>>> +        },
>>>> +        });
>>>> +    },
>>>> +
>>>>        render_optional_owner: function(value, metadata, record) {
>>>>            if (!value) return '-';
>>>>            return Ext.String.htmlEncode(value);
>>>> @@ -161,7 +181,7 @@ Ext.define('PBS.config.SyncJobView', {
>>>>        },
>>>>        {
>>>>            xtype: 'proxmoxStdRemoveButton',
>>>> -        baseurl: '/config/sync/',
>>>> +        handler: 'removeSyncJob',
>>>>            confirmMsg: gettext('Remove entry?'),
>>>>            callback: 'reload',
>>>>        },
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> pbs-devel mailing list
>> pbs-devel at lists.proxmox.com
>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel





More information about the pbs-devel mailing list