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