Show the new dependency firewall dashboard on group pages

What does this MR do and why?

Part 7 of 7 for https://gitlab.com/gitlab-org/gitlab/-/work_items/631890.

This MR switches the group dependency firewall page to the new dashboard behind two feature flags, and labels policies defined below the group in the Active Policies table.

Group pages render the new dashboard when both dependency_firewall_dashboard_v2 and dependency_firewall_group_prevented_stats are on for the top-level group, surfaced through Availability.group_dashboard_v2_enabled?. Otherwise, the current dashboard renders as it does today, so nothing changes for groups that have not opted in.

Feature flags

These changes are being 2 separate feature flags

Flag Purpose
dependency_firewall_dashboard_v2 The redesigned dashboard and its prevented-package stats: the write path, the GraphQL fields and the dashboard UI. Already enabled for some groups on GitLab.com, where it switches project pages to the new dashboard.
dependency_firewall_group_prevented_stats The group-level prevented-package stats: scheduling and running group refreshes, and the group read path. On the group page it keeps groups on the current dashboard until their stats exist, even where dependency_firewall_dashboard_v2 is already on.

Until the group read path (!261481) is merged, the group prevented-package fields return null and the dashboard shows them as 0. dependency_firewall_group_prevented_stats will be enabled once parts 2 to 5 have been merged and deployed.

Active Policies table

In the Active Policies table, a policy defined in a project or subgroup below the current group now reads "Defined in " with a link to that namespace's policies, instead of the generic "This group". This makes it clearer where a policy actually originates when it was not defined directly on the group being viewed, which previously was not distinguishable from policies defined locally.

Screenshots or screen recordings

Group dependency firewall page
Before After
image image

How to set up and validate locally

Run the specs:

yarn jest ee/spec/frontend/dependency_firewall
bin/rspec ee/spec/requests/groups/security/dependency_firewall_controller_spec.rb ee/spec/lib/security/dependency_firewall/availability_spec.rb

To check the page, use a group with the dependency firewall available (for example gitlab-org in GDK) and open /groups/<group>/-/security/dependency_firewall:

  1. In bin/rails console, turn on only the dashboard flag:

    group = Group.find_by_full_path('<group>')
    Feature.enable(:dependency_firewall_dashboard_v2, group)
    Feature.disable(:dependency_firewall_group_prevented_stats, group)

    The page shows the current dashboard.

  2. Run Feature.enable(:dependency_firewall_group_prevented_stats, group) and reload. The page shows the new dashboard.

    • Blocked, warned and total triggers, and the Active Policies table, show the group's data.
    • The prevented-package cards show 0 until the group read path is merged.
  3. In the Active Policies table, a policy defined in a subgroup or project below the group reads "Defined in ", linking to that subgroup's or project's policies. Policies defined on the group itself or inherited from above keep their labels.

  4. Run Feature.disable(:dependency_firewall_dashboard_v2, group) and reload. The page shows the current dashboard again.

  5. A project's dependency firewall page is unchanged by this MR.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

References

Edited by Arpit Gogia

Merge request reports

Loading
Loading