Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested attributes in objects #1800

Open
max06 opened this issue May 17, 2024 · 5 comments
Open

Nested attributes in objects #1800

max06 opened this issue May 17, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@max06
Copy link

max06 commented May 17, 2024

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"
    }
  }]
@max06 max06 added the enhancement New feature or request label May 17, 2024
@mrjakebaker
Copy link

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 ☀️

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 18, 2024
@max06
Copy link
Author

max06 commented Jul 18, 2024

This issue is not stale.

@github-actions github-actions bot removed the stale label Jul 19, 2024
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Aug 19, 2024
@max06
Copy link
Author

max06 commented Aug 19, 2024

Nope, it's not...

@github-actions github-actions bot removed the stale label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants