Create empty state when Protected Environment has no approval rules
Problem:
From: !111862 (comment 1290890837)
With the introduction of Multiple approval rules - Protected environments are not allowed to have no deployment rules, but are allowed to have no approval rules. Currently when a protected environment has no approval rules, it is shown in the table like the screenshot below, which causes the UI to look unfinished and as if something hasn't loaded:
| Example |
|---|
![]() |
Solution:
We'll probably want to add in some empty-state communication to help explain why the UI looks as it does.
Design:
Implementation guide
- Update
edit_protected_environment_rules_cardcomponent:- Ensure that the template is rendered if there are no rules present
- Add a new slot for the
empty-statewhich is rendered when there are no rules provided - Use similar styles for the empty state block:
gl-border-t gl-p-5 gl-bg-white - Currently, there's a conditional border rendering (
:class="{ 'gl-border-t': rules.length }"). We don't need the condition anymore as we want to render the border in any case.
- Update
edit_protected_environments_listcomponent to use the newly addedempty-stateslot:- Add translated string into the
$options.i18nobject (the text iss__('ProtectedEnvironments|This environment has no approval rules set up. %{linkStart}Learn more about deployment approvals.%{linkEnd}') - Use the
GlSprintfcomponent for rendering the string with the link - Use the
HelpPageLinkshared component to render a link to the docs ( the link isci/environments/deployment_approvals)
- Add translated string into the
- Update corresponding tests.
Edited by Anna Vovchenko

