Replace vsa stage slug with id
What does this MR do?
Ensures we use the stage id
field when fetching value stream stage data, previously we would use the title
field for default stages since they were not persisted and had no id
, but we should switch to the id
even though for default stages the id
is a string.
This was causing an issue with fetching value stream data when a user had changed their language from English, as the translated stage name would be picked up as the stage id.
Background
Initially we only had a single default
value stream configuration which was hard-coded on the frontend, this was a pretty basic configuration with all the data returned from a single endpoint. Over time, we've:
- Added the ability to create custom value streams
- Moved some calculations / values to individual endpoints to improve load time / db queries
The default
value stream configuration stuck around for a while and worked in conjunction with the custom value streams, because custom value streams were persisted in the db, stages associated with the value stream would have id
s which we could use to query our endpoints, but for the default
stream stages, we would use the name/title
of the stage as an id for querying.
We eventually moved the default
value stream configuration to the backend and fetch it when loading the page, at the same time we applied the users language preference to the descriptions / naming of the stage, which results in the
titlefield being returned in the user's language. Additionally stages provided from the backend now have an
id` field (which is still the english name of the stage), so we can now remove all the additional code we added to determine if the stage is a default stage or custom stage.
Screenshots or Screencasts (strongly suggested)
Before | After |
---|---|
Screen_Recording_2021-09-08_at_4.40.18_pm | Screen_Recording_2021-09-08_at_4.49.13_pm |
How to setup and validate locally (strongly suggested)
Group VSA seeding instructions
-
Ensure you have an EE license, or stub the
cycle_analytics_for_groups
license feature to true -
Create a group
-
Create a project within a group (make sure to initialize the project with a readme, or create it from a template)
-
Seed some test VSA data
$ VSA_SEED_PROJECT_ID=<project-id> VSA_ISSUE_COUNT=10 SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
-
Change your language preference in profile preferences - for example German
-
Navigate to value stream analytics for the group, ie for a project named clean-vsa-project in group new-vsa-group it would be http://
<gdk>
/group/:group_id/-/analytics/value_stream_analytics (or find it in the left menu)
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team