Hide unlicensed fields in work item display settings

What does this MR do and why?

The Display options drawer of the issues list (Fields section) offered a toggle for every metadata field, including Status, Health, Iteration and Weight, even when the namespace does not have those licensed features. For example, a GitLab Premium instance saw a Health toggle, although Health status needs Ultimate, and Free saw a Status toggle that does nothing. The Table view already hides the matching columns through licensedFeature in table/constants.js.

  • constants.js: mark the Status, Weight, Iteration and Health preference fields with the licensedFeature they need (hasStatusFeature, hasIssueWeightsFeature, hasIterationsFeature, hasIssuableHealthStatusFeature), the same flags the Table view uses.
  • display_settings_preferences.js: applicableMetadataFields takes an isFeatureLicensed function and leaves out a field whose feature is not enabled. This applies to the list and board views. The default function hides every gated field.
  • work_item_display_settings_metadata.vue: inject the four flags from the work item metadata provider and pass (feature) => Boolean(this[feature]). Without the provider they default to false, so unlicensed fields stay hidden.
  • Specs: the field list for each missing feature, none of the licensed fields when no feature is licensed, the board view, and the rendered toggles in the component.

Out of scope: the child items "Display options" menu (work_item_more_actions.vue) lists the same fields and is not changed here.

References

Screenshots or screen recordings

Display options > Fields for a namespace with Weight and Iteration but without Health (GitLab Premium):

Before After
579810-before 579810-after

How these were captured: the real WorkItemDisplaySettingsMetadata component was mounted in Jest from this branch (After) and from master (Before) with hasIssuableHealthStatusFeature: false, hasIterationsFeature: true and hasIssueWeightsFeature: true. The HTML was rendered in headless Chrome with GitLab.com's production stylesheets. The nested toggle <button> was re-tagged as <span> only so the serialized HTML parses the same way in the browser. It is not a live instance.

How to set up and validate locally

  1. Use an EE instance with a Premium license, so Health status is not available.
  2. Open a project Issues list and select Display options.
  3. Look at the toggles under Fields.
  4. Before: there is a Health toggle. After: no Health toggle, while Iteration and Weight stay. On Free, Status, Iteration and Weight are gone as well.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Priyanshu Jha

Merge request reports

Loading
Loading