Skip to content

Return all data from entity select instead of just text and value

Daniel Tian requested to merge 431713-return-all-data-from-entity-select into master

What does this MR do and why?

We have 3 shared dropdown components to select a project, a group, or an organization:

  1. app/assets/javascripts/vue_shared/components/entity_select/project_select.vue
  2. app/assets/javascripts/vue_shared/components/entity_select/group_select.vue
  3. app/assets/javascripts/vue_shared/components/entity_select/organization_select.vue
ksnip_20231201-164841

Currently, when a dropdown item is selected, the component will emit an event with the item's ID and display name:

ksnip_20231201-165212

However, in some cases we need additional data. For example, in a follow-up MR I need the group's full path instead of its ID. This MR changes it so that rather than only emitting 2 properties of the selected item, it emits the entire selected item:

ksnip_20231202-013913

This is a refactor, so there's no changes in UI behavior and is backwards compatible with existing code.

How to set up and validate locally

For the project and group dropdowns, click on Search or go to... in the sidebar, click on Admin Area, then go to Settings -> Templates. Expand the two categories to see the dropdowns (same as screenshot above).

For the organization dropdown, it currently doesn't work properly because the API doesn't return organization data, even on master:

ksnip_20231201-164751

I think it's still under development, but to access it:

  1. Enable the ui_for_organizations feature flag.
  2. Go to the homepage of the GitLab instance and click on Organizations in the sidebar.
  3. Use the UI to create some organizations.
  4. In the sidebar, click on your user badge and select Preferences.
  5. Scroll down to Home organization. Open the dropdown and observe the error.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #431713 (closed)

Edited by Daniel Tian

Merge request reports