Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now

Refactor labels management from HAML to Vue - nav bar component

Summary

Part of &7139

We want the start the process of refactoring the labels management in Groups, Projects, and Admin from HAML to Vue. This issue is to refactor the label nav bar (with search and sort) from HAML to Vue. We should introduce a nav_bar.vue component in app/assets/javascripts/labels/components.

Screen_Shot_2021-11-10_at_1.42.27_PM

Improvements

  • Be able to use GitLab UI components
  • More flexibility to improve search and sorting later down the road
  • Remove HAML and jQuery code

Risks

  • Introduce sort/search related bugs

Involved components

  • app/views/shared/labels/_nav.html.haml
  • spec/features/groups/labels/sort_labels_spec.rb
  • spec/features/projects/labels/sort_labels_spec.rb

Implementation plan

  • Introduce a feature flag
  • Add mount point element:
    • https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/views/groups/labels/index.html.haml#L9
    • app/views/projects/labels/index.html.haml#L6
  • Create nav_bar.vue in app/assets/javascripts/labels/components/
    • Use GlNav to render tabs
    • Use GlSearchBoxByClick for search box
    • Use GlSorting for sort dropdown.
  • Create an index.vue file in app/assets/javascripts/labels/components/index.vue that renders app/assets/javascripts/labels/components/nav_bar.vue
  • Create index.js file with initLabelsIndexApp function. This function mounts index.vue
  • Update feature specs
    • spec/features/groups/labels/sort_labels_spec.rb
    • spec/features/projects/labels/sort_labels_spec.rb
Edited Nov 12, 2021 by Peter Hegman
Assignee Loading
Time tracking Loading