[BE] Migrate work items data from Haml to GraphQL for dynamic contexts
Summary
Work items need to be able to dynamically get data via GraphQL instead of passing data via Haml, as work items can be rendered in different contexts within the same Vue app.
Problem Description
Currently, work items data (including paths like projectImportJiraPath) is passed via Haml in the helper. However, for work items in particular, we no longer want to pass data via Haml because work items can be rendered in different contexts within the same Vue app, so work items need to be able to dynamically get data via GraphQL.
Proposed Solution
-
First MR: Add missing paths (including
projectImportJiraPathand other unadded paths if straightforward) to GraphQL- Add paths to
app/graphql/types/namespaces/link_paths.rb - Ensure all necessary work items paths are available via GraphQL
- Add paths to
-
Second MR: Update the frontend to use these new GraphQL paths instead of Haml-injected data
- Remove Haml data injection for work items paths
- Update Vue components to fetch paths dynamically via GraphQL
- Ensure work items work correctly in all rendering contexts
Current Implementation
Currently in app/helpers/work_items_helper.rb:
if resource_parent.is_a?(Project)
data[:releases_path] = project_releases_path(resource_parent, format: :json)
data[:project_import_jira_path] = project_import_jira_path(resource_parent)
end
Expected Outcome
- Work items can dynamically fetch required paths via GraphQL
- Work items function correctly in different rendering contexts
- Reduced dependency on Haml data injection for work items
Additional Context
- This issue was identified during the review of !200502 (merged)
- Original discussion: !200502 (comment 2683488086)
- The current implementation passes
projectImportJiraPathvia Haml, but this should be migrated to GraphQL for better flexibility
Acceptance Criteria
-
Add projectImportJiraPathand other missing paths to GraphQL schema -
Update work items components to fetch paths via GraphQL -
Remove Haml data injection for work items paths -
Ensure work items function correctly in all contexts -
Add appropriate tests for GraphQL path fetching
Labels
typefeature devopsplan groupproduct planning sectiondev frontend backend