In the event that the user pastes a search query that contains a label, we will have to ask the backend to determine what the label color is. There could be some lag between the time the label is pasted and the time we display the actual label color because of network speeds.
@cperessini : Are you saying we just don't need this issue? The point of this issue is to color the labels in the search bar per the design in the description. Is that not a good design?
@cperessini : Oh I understand what you mean by "same color we have for other tokens". I.e. all tokens have the same default color right? And only in the special case of labels, we override that default if it's a valid label. Makes sense.
Although the scenarios in this issue is similar to https://gitlab.com/gitlab-org/gitlab-ce/issues/30468, the implementation for this should be much easier because all the labels are returned in one API request.
There are currently multiple scenarios for a label to be added to the search bar.
User types out the label
User clicks on the label that is displayed on the dropdown (same as if the user filters and clicks)
User pastes the label to the search bar
In our current implementation, when the user first invokes the label dropdown (after the user types label:), the label json data for the project is retrieved from the API and cached. Since the data is already cached, we can easily load the label color in the filtered search bar without needing an additional API request.
If the user goes through scenario 3 without invoking the label dropdown, I propose we perform an API request to retrieve all the label data so that we can load the label color in the filtered search. When the user first pastes the search query containing labels, the label visual token color will be the same as the other tokens. After the label data is retrieved from the API, the label color will be styled based on what was retrieved from the backend.
If the label is not found in the label list, the color will remain the same as the other tokens.
Multiple assignees (FE) review ended up taking a lot of my time this release month. I don't think I will be able to ship this Deliverable in time along with my others. Assigning to @jschatz1 as discussed in slack.
@winh : Please go ahead with what's in the description unless @cperessini responds otherwise. Don't want to slow you down as the deadline for 9.2 is coming up. The designs in the description were created by the UX team (@cperessini I think?) . So I think they are fine.