Add helpPagePath helper function
What does this MR do?
Introduces a helpPagePath
helper function, similar to the help_page_path
function in Ruby as described in our docs: https://docs.gitlab.com/ee/development/documentation/#linking-to-help. Its purpose is to provide a standardized way for frontend engineers to link to a GitLab documentation page.
There are currently ~103 instances of https://docs.gitlab.com
in the app/assets/javascripts
directory of the GitLab codebase; such a function is applicable to all of these.
This idea was originally discussed in !45273 (comment 430630256).
Downsides
- Using this function will mean help doc urls are generated at runtime. We could potentially look at adding some Webpack smarts to evaluate the functions at compile time if it becomes a problem
- ...
Rollout schedule
- Merge this MR
- Announce this to #development, gather feedback and iron out implementation
- Create epic to replace hard-coded docs links with the
helpPagePath
helper function
Types of Help URLs on the Frontend
We have a mixed strategy for defining help page links on the front end. Links can come in the form of:
- Full URL to
docs.gitlab.com
:https://docs.gitlab.com/ee/user/infrastructure/index.html
(source) - Relative path to
/help
:/help/user/markdown
(source - URLs provided by the server via data attributes. These should be generated by the Ruby
help_page_path()
helper (example)
The addition of this function will allow us to have a unified strategy for the first 2 forms. We can then iteratively move instances of the third form from rails to JS.
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
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 -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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