Commit f8a3a52c authored by Robert Hunt's avatar Robert Hunt Committed by Mark Chao

Replace Approval gates term with Status checks

parent 6612b31a
...@@ -18,11 +18,9 @@ const i18n = { ...@@ -18,11 +18,9 @@ const i18n = {
), ),
}, },
externalRule: { externalRule: {
primaryButtonText: s__('ApprovalRuleRemove|Remove approval gate'), primaryButtonText: s__('StatusCheck|Remove status check'),
modalTitle: s__('ApprovalRuleRemove|Remove approval gate?'), modalTitle: s__('StatusCheck|Remove status check?'),
removeWarningText: s__( removeWarningText: s__('StatusCheck|You are about to remove the %{name} status check.'),
'ApprovalRuleRemove|You are about to remove the %{name} approval gate. Approval from this service is not revoked.',
),
}, },
}; };
......
...@@ -10,17 +10,17 @@ import { ...@@ -10,17 +10,17 @@ import {
RULE_TYPE_REGULAR, RULE_TYPE_REGULAR,
} from '../../constants'; } from '../../constants';
import ApprovalGateIcon from '../approval_gate_icon.vue';
import EmptyRule from '../empty_rule.vue'; import EmptyRule from '../empty_rule.vue';
import RuleInput from '../mr_edit/rule_input.vue'; import RuleInput from '../mr_edit/rule_input.vue';
import RuleBranches from '../rule_branches.vue'; import RuleBranches from '../rule_branches.vue';
import RuleControls from '../rule_controls.vue'; import RuleControls from '../rule_controls.vue';
import Rules from '../rules.vue'; import Rules from '../rules.vue';
import UnconfiguredSecurityRules from '../security_configuration/unconfigured_security_rules.vue'; import UnconfiguredSecurityRules from '../security_configuration/unconfigured_security_rules.vue';
import StatusChecksIcon from '../status_checks_icon.vue';
export default { export default {
components: { components: {
ApprovalGateIcon, StatusChecksIcon,
RuleControls, RuleControls,
Rules, Rules,
UserAvatarList, UserAvatarList,
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
class="js-members" class="js-members"
:class="settings.allowMultiRule ? 'd-none d-sm-table-cell' : null" :class="settings.allowMultiRule ? 'd-none d-sm-table-cell' : null"
> >
<approval-gate-icon v-if="isExternalApprovalRule(rule)" :url="rule.externalUrl" /> <status-checks-icon v-if="isExternalApprovalRule(rule)" :url="rule.externalUrl" />
<user-avatar-list v-else :items="rule.approvers" :img-size="24" empty-text="" /> <user-avatar-list v-else :items="rule.approvers" :img-size="24" empty-text="" />
</td> </td>
<td v-if="settings.allowMultiRule" class="js-branches"> <td v-if="settings.allowMultiRule" class="js-branches">
......
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
groupIds() { groupIds() {
return this.groups.map((x) => x.id); return this.groups.map((x) => x.id);
}, },
invalidApprovalGateUrl() { invalidStatusChecksUrl() {
if (this.serverValidationErrors.includes('External url has already been taken')) { if (this.serverValidationErrors.includes('External url has already been taken')) {
return this.$options.i18n.validations.externalUrlTaken; return this.$options.i18n.validations.externalUrlTaken;
} }
...@@ -159,7 +159,7 @@ export default { ...@@ -159,7 +159,7 @@ export default {
); );
}, },
isValidExternalApprovalRule() { isValidExternalApprovalRule() {
return this.isValidName && this.isValidBranches && this.isValidApprovalGateUrl; return this.isValidName && this.isValidBranches && this.isValidStatusChecksUrl;
}, },
isValidName() { isValidName() {
return !this.showValidation || !this.invalidName; return !this.showValidation || !this.invalidName;
...@@ -173,8 +173,8 @@ export default { ...@@ -173,8 +173,8 @@ export default {
isValidApprovers() { isValidApprovers() {
return !this.showValidation || !this.invalidApprovers; return !this.showValidation || !this.invalidApprovers;
}, },
isValidApprovalGateUrl() { isValidStatusChecksUrl() {
return !this.showValidation || !this.invalidApprovalGateUrl; return !this.showValidation || !this.invalidStatusChecksUrl;
}, },
isMultiSubmission() { isMultiSubmission() {
return this.settings.allowMultiRule && !this.isFallbackSubmission; return this.settings.allowMultiRule && !this.isFallbackSubmission;
...@@ -234,10 +234,6 @@ export default { ...@@ -234,10 +234,6 @@ export default {
externalUrl: this.externalUrl, externalUrl: this.externalUrl,
}; };
}, },
approvalGateLabel() {
const { approvalGate, addApprovalGate } = this.$options.i18n.form;
return this.isEditing ? approvalGate : addApprovalGate;
},
}, },
watch: { watch: {
approversToAdd(value) { approversToAdd(value) {
...@@ -388,9 +384,9 @@ export default { ...@@ -388,9 +384,9 @@ export default {
}, },
i18n: { i18n: {
form: { form: {
addApprovalGate: s__('ApprovalRule|Add approvel gate'), addStatusChecks: s__('StatusCheck|API to check'),
approvalGate: s__('ApprovalRule|Approvel gate'), statusChecks: s__('StatusCheck|Status to check'),
approvalGateDescription: s__('ApprovalRule|Invoke an external API as part of the approvals'), statusChecksDescription: s__('StatusCheck|Invoke an external API as part of the approvals'),
approvalsRequiredLabel: s__('ApprovalRule|Approvals required'), approvalsRequiredLabel: s__('ApprovalRule|Approvals required'),
approvalTypeLabel: s__('ApprovalRule|Approver Type'), approvalTypeLabel: s__('ApprovalRule|Approver Type'),
approversLabel: s__('ApprovalRule|Add approvers'), approversLabel: s__('ApprovalRule|Add approvers'),
...@@ -417,7 +413,7 @@ export default { ...@@ -417,7 +413,7 @@ export default {
}, },
approverTypeOptions: [ approverTypeOptions: [
{ type: RULE_TYPE_USER_OR_GROUP_APPROVER, text: s__('ApprovalRule|Users or groups') }, { type: RULE_TYPE_USER_OR_GROUP_APPROVER, text: s__('ApprovalRule|Users or groups') },
{ type: RULE_TYPE_EXTERNAL_APPROVAL, text: s__('ApprovalRule|Approval service API') }, { type: RULE_TYPE_EXTERNAL_APPROVAL, text: s__('ApprovalRule|Status check') },
], ],
}; };
</script> </script>
...@@ -496,18 +492,18 @@ export default { ...@@ -496,18 +492,18 @@ export default {
</template> </template>
<gl-form-group <gl-form-group
v-if="isExternalApprovalRule" v-if="isExternalApprovalRule"
:label="approvalGateLabel" :label="$options.i18n.form.addStatusChecks"
:description="$options.i18n.form.approvalGateDescription" :description="$options.i18n.form.statusChecksDescription"
:state="isValidApprovalGateUrl" :state="isValidStatusChecksUrl"
:invalid-feedback="invalidApprovalGateUrl" :invalid-feedback="invalidStatusChecksUrl"
data-testid="approval-gate-url-group" data-testid="status-checks-url-group"
> >
<gl-form-input <gl-form-input
v-model="externalUrl" v-model="externalUrl"
:state="isValidApprovalGateUrl" :state="isValidStatusChecksUrl"
type="url" type="url"
data-qa-selector="external_url_field" data-qa-selector="external_url_field"
data-testid="approval-gate-url" data-testid="status-checks-url"
/> />
</gl-form-group> </gl-form-group>
<div v-if="!isExternalApprovalRule" class="bordered-box overflow-auto h-12em"> <div v-if="!isExternalApprovalRule" class="bordered-box overflow-auto h-12em">
......
<script> <script>
import { GlIcon, GlPopover } from '@gitlab/ui'; import { GlIcon, GlPopover } from '@gitlab/ui';
import { uniqueId } from 'lodash'; import { uniqueId } from 'lodash';
import { __ } from '~/locale'; import { s__ } from '~/locale';
export default { export default {
components: { components: {
...@@ -16,14 +16,14 @@ export default { ...@@ -16,14 +16,14 @@ export default {
}, },
computed: { computed: {
iconId() { iconId() {
return uniqueId('approval-icon-'); return uniqueId('status-checks-icon-');
}, },
containerId() { containerId() {
return uniqueId('approva-icon-container-'); return uniqueId('status-checks-icon-container-');
}, },
}, },
i18n: { i18n: {
title: __('Approval Gate'), title: s__('StatusCheck|Status to check'),
}, },
}; };
</script> </script>
......
...@@ -91,14 +91,14 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do ...@@ -91,14 +91,14 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
end end
end end
it 'adds an approval gate' do it 'adds a status check' do
visit edit_project_path(project) visit edit_project_path(project)
open_modal(text: 'Add approval rule', expand: false) open_modal(text: 'Add approval rule', expand: false)
within('.modal-content') do within('.modal-content') do
find('button', text: "Users or groups").click find('button', text: "Users or groups").click
find('button', text: "Approval service API").click find('button', text: "Status check").click
find('[data-qa-selector="rule_name_field"]').set('My new rule') find('[data-qa-selector="rule_name_field"]').set('My new rule')
find('[data-qa-selector="external_url_field"]').set('https://api.gitlab.com') find('[data-qa-selector="external_url_field"]').set('https://api.gitlab.com')
...@@ -111,10 +111,10 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do ...@@ -111,10 +111,10 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
expect(first('.js-name')).to have_content('My new rule') expect(first('.js-name')).to have_content('My new rule')
end end
context 'with an approval gate' do context 'with a status check' do
let_it_be(:rule) { create(:external_approval_rule, project: project) } let_it_be(:rule) { create(:external_approval_rule, project: project) }
it 'updates the approval gate' do it 'updates the status check' do
visit edit_project_path(project) visit edit_project_path(project)
expect(first('.js-name')).to have_content(rule.name) expect(first('.js-name')).to have_content(rule.name)
...@@ -132,7 +132,7 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do ...@@ -132,7 +132,7 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
expect(first('.js-name')).to have_content('Something new') expect(first('.js-name')).to have_content('Something new')
end end
it 'removes the approval gate' do it 'removes the status check' do
visit edit_project_path(project) visit edit_project_path(project)
expect(first('.js-name')).to have_content(rule.name) expect(first('.js-name')).to have_content(rule.name)
...@@ -140,7 +140,7 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do ...@@ -140,7 +140,7 @@ RSpec.describe 'Project settings > [EE] Merge Requests', :js do
first('.js-controls').find('[data-testid="remove-icon"]').click first('.js-controls').find('[data-testid="remove-icon"]').click
within('.modal-content') do within('.modal-content') do
click_button 'Remove approval gate' click_button 'Remove status check'
end end
wait_for_requests wait_for_requests
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
exports[`Approvals ModalRuleRemove matches the snapshot for external approval 1`] = ` exports[`Approvals ModalRuleRemove matches the snapshot for external approval 1`] = `
<div <div
title="Remove approval gate?" title="Remove status check?"
> >
<p> <p>
You are about to remove the You are about to remove the
<strong> <strong>
API Gate API Gate
</strong> </strong>
approval gate. Approval from this service is not revoked. status check.
</p> </p>
</div> </div>
`; `;
......
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ApprovalGateIcon from 'ee/approvals/components/approval_gate_icon.vue';
import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue'; import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue';
import ProjectRules from 'ee/approvals/components/project_settings/project_rules.vue'; import ProjectRules from 'ee/approvals/components/project_settings/project_rules.vue';
import RuleName from 'ee/approvals/components/rule_name.vue'; import RuleName from 'ee/approvals/components/rule_name.vue';
import Rules from 'ee/approvals/components/rules.vue'; import Rules from 'ee/approvals/components/rules.vue';
import UnconfiguredSecurityRules from 'ee/approvals/components/security_configuration/unconfigured_security_rules.vue'; import UnconfiguredSecurityRules from 'ee/approvals/components/security_configuration/unconfigured_security_rules.vue';
import StatusChecksIcon from 'ee/approvals/components/status_checks_icon.vue';
import { createStoreOptions } from 'ee/approvals/stores'; import { createStoreOptions } from 'ee/approvals/stores';
import projectSettingsModule from 'ee/approvals/stores/modules/project_settings'; import projectSettingsModule from 'ee/approvals/stores/modules/project_settings';
import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue'; import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue';
...@@ -159,8 +159,8 @@ describe('Approvals ProjectRules', () => { ...@@ -159,8 +159,8 @@ describe('Approvals ProjectRules', () => {
factory(); factory();
}); });
it('renders the approval gate component with URL', () => { it('renders the status check component with URL', () => {
expect(wrapper.findComponent(ApprovalGateIcon).props('url')).toBe(rule.externalUrl); expect(wrapper.findComponent(StatusChecksIcon).props('url')).toBe(rule.externalUrl);
}); });
it('does not render a user avatar component', () => { it('does not render a user avatar component', () => {
......
...@@ -106,8 +106,8 @@ describe('EE Approvals RuleForm', () => { ...@@ -106,8 +106,8 @@ describe('EE Approvals RuleForm', () => {
const findApproversList = () => wrapper.findComponent(ApproversList); const findApproversList = () => wrapper.findComponent(ApproversList);
const findBranchesSelect = () => wrapper.findComponent(BranchesSelect); const findBranchesSelect = () => wrapper.findComponent(BranchesSelect);
const findApproverTypeSelect = () => wrapper.findComponent(ApproverTypeSelect); const findApproverTypeSelect = () => wrapper.findComponent(ApproverTypeSelect);
const findExternalUrlInput = () => wrapper.findByTestId('approval-gate-url'); const findExternalUrlInput = () => wrapper.findByTestId('status-checks-url');
const findExternalUrlValidation = () => wrapper.findByTestId('approval-gate-url-group'); const findExternalUrlValidation = () => wrapper.findByTestId('status-checks-url-group');
const findBranchesValidation = () => wrapper.findByTestId('branches-group'); const findBranchesValidation = () => wrapper.findByTestId('branches-group');
const inputsAreValid = (inputs) => inputs.every((x) => x.props('state')); const inputsAreValid = (inputs) => inputs.every((x) => x.props('state'));
...@@ -848,7 +848,7 @@ describe('EE Approvals RuleForm', () => { ...@@ -848,7 +848,7 @@ describe('EE Approvals RuleForm', () => {
}); });
}); });
describe('when the approval gates feature is disabled', () => { describe('when the status check feature is disabled', () => {
it('does not render the approver type select input', async () => { it('does not render the approver type select input', async () => {
createComponent({ isMrEdit: false }, { ffComplianceApprovalGates: false }); createComponent({ isMrEdit: false }, { ffComplianceApprovalGates: false });
......
import { GlPopover, GlIcon } from '@gitlab/ui'; import { GlPopover, GlIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import ApprovalGateIcon from 'ee/approvals/components/approval_gate_icon.vue'; import StatusChecksIcon from 'ee/approvals/components/status_checks_icon.vue';
jest.mock('lodash/uniqueId', () => (id) => `${id}mock`); jest.mock('lodash/uniqueId', () => (id) => `${id}mock`);
describe('ApprovalGateIcon', () => { describe('StatusChecksIcon', () => {
let wrapper; let wrapper;
const findPopover = () => wrapper.findComponent(GlPopover); const findPopover = () => wrapper.findComponent(GlPopover);
const findIcon = () => wrapper.findComponent(GlIcon); const findIcon = () => wrapper.findComponent(GlIcon);
const createComponent = () => { const createComponent = () => {
return shallowMount(ApprovalGateIcon, { return shallowMount(StatusChecksIcon, {
propsData: { propsData: {
url: 'https://gitlab.com/', url: 'https://gitlab.com/',
}, },
...@@ -28,15 +28,15 @@ describe('ApprovalGateIcon', () => { ...@@ -28,15 +28,15 @@ describe('ApprovalGateIcon', () => {
it('renders the icon', () => { it('renders the icon', () => {
expect(findIcon().props('name')).toBe('api'); expect(findIcon().props('name')).toBe('api');
expect(findIcon().attributes('id')).toBe('approval-icon-mock'); expect(findIcon().attributes('id')).toBe('status-checks-icon-mock');
}); });
it('renders the popover with the URL for the icon', () => { it('renders the popover with the URL for the icon', () => {
expect(findPopover().exists()).toBe(true); expect(findPopover().exists()).toBe(true);
expect(findPopover().attributes()).toMatchObject({ expect(findPopover().attributes()).toMatchObject({
content: 'https://gitlab.com/', content: 'https://gitlab.com/',
title: 'Approval Gate', title: 'Status to check',
target: 'approval-icon-mock', target: 'status-checks-icon-mock',
}); });
}); });
}); });
...@@ -655,7 +655,7 @@ RSpec.describe ProjectsHelper do ...@@ -655,7 +655,7 @@ RSpec.describe ProjectsHelper do
allow(helper).to receive(:can?).and_return(true) allow(helper).to receive(:can?).and_return(true)
end end
context 'with the approval gate feature flag' do context 'with the status check feature flag' do
where(feature_flag_enabled: [true, false]) where(feature_flag_enabled: [true, false])
with_them do with_them do
before do before do
......
...@@ -4027,9 +4027,6 @@ msgstr "" ...@@ -4027,9 +4027,6 @@ msgstr ""
msgid "Applying suggestions..." msgid "Applying suggestions..."
msgstr "" msgstr ""
msgid "Approval Gate"
msgstr ""
msgid "Approval Status" msgid "Approval Status"
msgstr "" msgstr ""
...@@ -4047,15 +4044,6 @@ msgid_plural "ApprovalRuleRemove|%d members" ...@@ -4047,15 +4044,6 @@ msgid_plural "ApprovalRuleRemove|%d members"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "ApprovalRuleRemove|Remove approval gate"
msgstr ""
msgid "ApprovalRuleRemove|Remove approval gate?"
msgstr ""
msgid "ApprovalRuleRemove|You are about to remove the %{name} approval gate. Approval from this service is not revoked."
msgstr ""
msgid "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} member%{strongEnd}. Approvals from this member are not revoked." msgid "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} member%{strongEnd}. Approvals from this member are not revoked."
msgid_plural "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} members%{strongEnd}. Approvals from these members are not revoked." msgid_plural "ApprovalRuleRemove|You are about to remove the %{name} approver group which has %{strongStart}%{count} members%{strongEnd}. Approvals from these members are not revoked."
msgstr[0] "" msgstr[0] ""
...@@ -4071,24 +4059,15 @@ msgid_plural "ApprovalRuleSummary|%{count} approvals required from %{membersCoun ...@@ -4071,24 +4059,15 @@ msgid_plural "ApprovalRuleSummary|%{count} approvals required from %{membersCoun
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "ApprovalRule|Add approvel gate"
msgstr ""
msgid "ApprovalRule|Add approvers" msgid "ApprovalRule|Add approvers"
msgstr "" msgstr ""
msgid "ApprovalRule|Approval rules" msgid "ApprovalRule|Approval rules"
msgstr "" msgstr ""
msgid "ApprovalRule|Approval service API"
msgstr ""
msgid "ApprovalRule|Approvals required" msgid "ApprovalRule|Approvals required"
msgstr "" msgstr ""
msgid "ApprovalRule|Approvel gate"
msgstr ""
msgid "ApprovalRule|Approver Type" msgid "ApprovalRule|Approver Type"
msgstr "" msgstr ""
...@@ -4098,15 +4077,15 @@ msgstr "" ...@@ -4098,15 +4077,15 @@ msgstr ""
msgid "ApprovalRule|Examples: QA, Security." msgid "ApprovalRule|Examples: QA, Security."
msgstr "" msgstr ""
msgid "ApprovalRule|Invoke an external API as part of the approvals"
msgstr ""
msgid "ApprovalRule|Name" msgid "ApprovalRule|Name"
msgstr "" msgstr ""
msgid "ApprovalRule|Rule name" msgid "ApprovalRule|Rule name"
msgstr "" msgstr ""
msgid "ApprovalRule|Status check"
msgstr ""
msgid "ApprovalRule|Target branch" msgid "ApprovalRule|Target branch"
msgstr "" msgstr ""
...@@ -30467,6 +30446,24 @@ msgstr "" ...@@ -30467,6 +30446,24 @@ msgstr ""
msgid "Status: %{title}" msgid "Status: %{title}"
msgstr "" msgstr ""
msgid "StatusCheck|API to check"
msgstr ""
msgid "StatusCheck|Invoke an external API as part of the approvals"
msgstr ""
msgid "StatusCheck|Remove status check"
msgstr ""
msgid "StatusCheck|Remove status check?"
msgstr ""
msgid "StatusCheck|Status to check"
msgstr ""
msgid "StatusCheck|You are about to remove the %{name} status check."
msgstr ""
msgid "StatusPage|AWS %{docsLink}" msgid "StatusPage|AWS %{docsLink}"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment