ui
ui copied to clipboard
Nested attributes in objects
Description
Hello there - sorry for the title, no idea how to phrase that....
There are multiple ui components taking an array of objects as input. In this case I want to talk about the SelectMenu.
<USelectMenu
placeholder="Select an object"
:options="flatObjects"
option-attribute="name"
/>
This works great with flat objects. For unknown reason, I'm unable to specify a nested property (like metadata.name).
For these cases I have to create a computed, flat version of my original input array. Since I'm basically exclusively working with kubernetes manifests as input objects, I have to add a lot of wrappers for those.
I'm fine with that; however, I at least wanted to ask. 😅
Additional context
For reproduction, one of those objects, simplified:
const specs = [{
apiVersion: "some.api.io/v1alpha1",
kind: "Spec",
metadata: {
creationTimestamp: "2024-02-26T13:42:36Z",
generation: 3,
name: "m1-small",
namespace: "project",
resourceVersion: "76533369",
uid: "6567b033-b6fc-4ac7-ac56-1ed22853eea1"
},
spec: {
disk: 20,
ephemeral: 0,
id: "5c48b89a-94b9-4e71-a838-69cdc09fb13e",
name: "m1.small",
public: true,
ram: 2048,
vcpus: 1
},
status: {
status: "active"
}
}]
I have the same query but related to InputMenu component. I added a reproduction.
The docs say that search-attributes can be used with dot.notaton to access nested attributes, but it's not clear that it is only for the search-attributes until you try it out yourself. I would really like to be able to use it also for option-attribute and value-attribute to avoid unnecessary flattening when we have big nested objects.
Is this supported, or planned? Thanks :sunny:
This issue is stale because it has been open for 30 days with no activity.
This issue is not stale.
This issue is stale because it has been open for 30 days with no activity.
Nope, it's not...
This issue is stale because it has been open for 30 days with no activity.
@benjamincanac sorry for the ping - could you please clarify if this is something that could/should be done?
@max06 This is something that can be improved indeed 😊
@benjamincanac lovely! Thanks for looking into it 🙇🏼