Productivity Analytics: Add deep links (BE only)
What does this MR do?
- BE task for adding deep links to the PA page.
- FE is being implemented in !21390 (merged)
- Changelog entry will be added in this MR.
How
- User goes to productivity analytics page and selects specific filters.
- User bookmarks the page to easily "load" the selected filters.
- When the user clicks on the bookmarked link the backend does the following:
- Process/cast all input parameters that are given with the initial HTML request.
- Validate the parameters.
- If the parameters are valid: expose them via HTML data attributes, so the frontend can process them.
- If the parameters are invalid: do nothing, expose only the safe, default values:
merged_at_after
andmerged_at_before
parameters.
Implementation
- For the validation we're using
ActiveModel
since it has capabilities to cast attributes and provide standard error messages. We do similar validation for the cycle analytics feature. -
ActiveModel
also supports adding custom validation rules:date_1
attr should be earlier thandate_2
attr. - For the initial HTML request the page should always load, even if the parameters are invalid (have fallback).
- For the API requests (JSON) we must always validate the params and return
422
, if the given parameters are invalid.- Note: the error messages are mainly for the frontend developers to easily debug problems, by default we expect that the frontend will always pass correct parameters.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
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
Edited by Adam Hegyi