Return all data from entity select instead of just text and value
What does this MR do and why?
We have 3 shared dropdown components to select a project, a group, or an organization:
app/assets/javascripts/vue_shared/components/entity_select/project_select.vue
app/assets/javascripts/vue_shared/components/entity_select/group_select.vue
app/assets/javascripts/vue_shared/components/entity_select/organization_select.vue
Currently, when a dropdown item is selected, the component will emit an event with the item's ID and display name:
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:
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:
I think it's still under development, but to access it:
- Enable the
ui_for_organizations
feature flag. - Go to the homepage of the GitLab instance and click on
Organizations
in the sidebar. - Use the UI to create some organizations.
- In the sidebar, click on your user badge and select
Preferences
. - 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #431713 (closed)