diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/constants.js b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/constants.js index 73f8b2199f478314e7b9a2af05047ff7f1f78fda..3f6dd443220a2780d9858d2278459ac00154a16b 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/constants.js +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/constants.js @@ -4,8 +4,6 @@ export const DEFAULT_PIPELINE_EXECUTION_POLICY = `type: pipeline_execution_polic name: '' description: '' enabled: true -rules: - - foo: bar actions: - foo: bar `; diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/editor_component.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/editor_component.vue index 9e481b7bcb61b3454f61a7b294e4d04d02b6425a..a7e3081f04139e76edf66481cd82955953d9f309 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/editor_component.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/editor_component.vue @@ -8,24 +8,22 @@ import { PARSING_ERROR_MESSAGE, SECURITY_POLICY_ACTIONS, ACTIONS_LABEL, - RULES_LABEL, } from '../constants'; import EditorLayout from '../editor_layout.vue'; import DimDisableContainer from '../dim_disable_container.vue'; import RuleSection from './rule/rule_section.vue'; import ActionSection from './action/action_section.vue'; import { createPolicyObject, policyToYaml } from './utils'; -import { DEFAULT_PIPELINE_EXECUTION_POLICY } from './constants'; +import { CONDITIONS_LABEL, DEFAULT_PIPELINE_EXECUTION_POLICY } from './constants'; export default { ACTION: 'actions', - RULE: 'rules', EDITOR_MODE_RULE, EDITOR_MODE_YAML, SECURITY_POLICY_ACTIONS, i18n: { ACTIONS_LABEL, - RULES_LABEL, + CONDITIONS_LABEL, PARSING_ERROR_MESSAGE, notOwnerButtonText: __('Learn more'), }, @@ -107,21 +105,14 @@ export default { <template #rules> <dim-disable-container :disabled="hasParsingError"> <template #title> - <h4>{{ $options.i18n.RULES_LABEL }}</h4> + <h4>{{ $options.i18n.CONDITIONS_LABEL }}</h4> </template> <template #disabled> <div class="gl-bg-gray-10 gl-rounded-base gl-p-6"></div> </template> - <rule-section - v-for="(rule, index) in policy.rules" - :key="rule.id" - :data-testid="`rule-${index}`" - class="gl-mb-4" - :init-rule="rule" - :rule-index="index" - /> + <rule-section class="gl-mb-4" /> </dim-disable-container> </template> diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section.vue index 6f366fb3878c0dac0a281ce9518a7a1b4ff5064c..a215258d224a487a2f59d1889393a4b3172e9984 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section.vue @@ -1,13 +1,30 @@ <script> -import { RULES_LABEL } from '../../constants'; +import { GlLink, GlSprintf } from '@gitlab/ui'; +import { s__ } from '~/locale'; +import { helpPagePath } from '~/helpers/help_page_helper'; export default { i18n: { - RULES_LABEL, + conditionText: s__( + 'SecurityOrchestration|Configure your conditions in the pipeline execution file. %{linkStart}What can pipeline execution do?%{linkEnd}', + ), + helpPageLink: helpPagePath('user/application_security/policies/pipeline-execution-policies'), + }, + components: { + GlLink, + GlSprintf, }, }; </script> <template> - <div>{{ $options.i18n.RULES_LABEL }}</div> + <div + class="gl-display-flex gl-flex-direction-column gl-lg-flex-direction-row gl-gap-3 security-policies-bg-gray-10 gl-rounded-base gl-p-5" + > + <gl-sprintf :message="$options.i18n.conditionText"> + <template #link="{ content }"> + <gl-link :href="$options.i18n.helpPageLink" target="_blank">{{ content }}</gl-link> + </template> + </gl-sprintf> + </div> </template> diff --git a/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/editor_component_spec.js b/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/editor_component_spec.js index a70ce696cb0ea4ebd985fe7ba9b0bd85ead609ce..339d200824570a812f90bb51a5a4cb22fa18e751 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/editor_component_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/editor_component_spec.js @@ -35,10 +35,14 @@ describe('RuleSection', () => { factory(); expect(findPolicyEditorLayout().exists()).toBe(true); expect(findActionSection().exists()).toBe(true); - expect(findRuleSection().exists()).toBe(true); expect(findEmptyState().exists()).toBe(false); }); + it('renders the rule section', () => { + factory(); + expect(findRuleSection().exists()).toBe(true); + }); + it('renders the empty page', () => { factory({ provide: { disableScanPolicyUpdate: true } }); expect(findPolicyEditorLayout().exists()).toBe(false); diff --git a/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section_spec.js b/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section_spec.js index ce4514eeb53a60c13ec4d67abc533a595603005e..3902de760d1423a2495f366a3970f8ce84e887ee 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section_spec.js @@ -1,3 +1,4 @@ +import { GlSprintf, GlLink } from '@gitlab/ui'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import RuleSection from 'ee/security_orchestration/components/policy_editor/pipeline_execution/rule/rule_section.vue'; @@ -12,11 +13,28 @@ describe('RuleSection', () => { provide: { ...provide, }, + stubs: { + GlSprintf, + }, }); }; - it('renders', () => { + const findGlSprintf = () => wrapper.findComponent(GlSprintf); + const findGlLink = () => wrapper.findComponent(GlLink); + + it('renders text', () => { + factory(); + expect(findGlSprintf().text()).toBe( + 'Configure your conditions in the pipeline execution file.', + ); + }); + + it('renders link', () => { factory(); - expect(wrapper.find('div').exists()).toBe(true); + expect(findGlLink().exists()).toBe(true); + expect(findGlLink().text()).toBe('What can pipeline execution do?'); + expect(findGlLink().attributes('href')).toBe( + '/help/user/application_security/policies/pipeline-execution-policies', + ); }); }); diff --git a/locale/gitlab.pot b/locale/gitlab.pot index f20d7363e4aa44f259d82446c1224260fcf7baa4..ca425e521b9ad0b2e4d5141223aae8e2c002d8ab 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -45949,6 +45949,9 @@ msgstr "" msgid "SecurityOrchestration|Compliance framework has no projects" msgstr "" +msgid "SecurityOrchestration|Configure your conditions in the pipeline execution file. %{linkStart}What can pipeline execution do?%{linkEnd}" +msgstr "" + msgid "SecurityOrchestration|Create more robust vulnerability rules and apply them to all your projects." msgstr ""