[pdm-devel] [RFC PATCH datacenter-manager v2 15/16] ui: dashboard: implement 'View'

Shannon Sterz s.sterz at proxmox.com
Fri Oct 24 12:17:25 CEST 2025


On 10/23/25 1:44 PM, Dominik Csapak wrote:
> On 10/23/25 1:19 PM, Shannon Sterz wrote:
>> On Thu Oct 23, 2025 at 10:28 AM CEST, Dominik Csapak wrote:
> [snip]
>>> +
>>> +struct ViewComp {
>>> +    template: LoadResult<ViewTemplate, Error>,
>>> +
>>> +    // various api call results
>>> +    status: LoadResult<ResourcesStatus, Error>,
>>> +    top_entities: LoadResult<TopEntities, proxmox_client::Error>,
>>> +    statistics: LoadResult<TaskStatistics, Error>,
>>
>> this is fine, but i just had an idea, maybe this isn't too useful right
>> now, but might be worth exploring: we could turn this into a HashMap
>> with something like this:
>>
>> HashMap<ToQuery, LoadResult<ApiResponseData, Error>>
>>
>> then loading could become iterating over the keys and calling a function
>> on them. with a wrapper type we could even implement a getter that
>> transforms the ApiResponseData to a concrete type. might cut down on the
>> loading logic below and make this more easily extensible in the future.
>>
>> the required_api_calls below could then just return such a hashmap with
>> only the necessary keys. what do you think (note i haven't tested any of
>> this)?
>
> i don't think this will work, since ApiResponseData itself takes a
> generic parameter too, and we can't use different ones for different
> values of the same hashmap AFAIK
>
> but yeah, we should think about how we could generalize this
> instead of just adding on new members...
>

sorry seems I dropped the list in my last response... so sending this
again.

thought about this a bit. we can leverage DeserializeOwned and Value
here quite a bit to make it work. i did a bit of messing around and came
up with the attached patch. this certainly isn't perfect or polished
(e.g. we could use wrapper types to move the get_entities function
somewhere more sensible; safe a clone here or there etc.), but the
general gist is there. it also works so yeah :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-wip-ui-view-refactor-loading-logic-to-use-hashmap.patch
Type: text/x-patch
Size: 16051 bytes
Desc: not available
URL: <http://lists.proxmox.com/pipermail/pdm-devel/attachments/20251024/8e0ffd88/attachment.bin>


More information about the pdm-devel mailing list