diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue index 42a87be2aa30eb016c534d994ac4eb06e38f472b..49d3671c66e4fa1dc4c01336fc28d9b771ef6d52 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policies/list_component.vue @@ -303,6 +303,7 @@ export default { await goToPolicyMR({ action, assignedPolicyProject: this.assignedPolicyProject, + extraMergeRequestInput: { type: policyType }, name: policy.name, namespacePath: this.namespacePath, yamlEditorValue: policy.yaml.concat(`type: ${policyType}`), diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_wrapper.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_wrapper.vue index 7ac3ccd641b2b0feb6eb2f7f84dc75285313c50c..cb3426ce052c1aad2a5726bc3d138b54a4c10921 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_wrapper.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/editor_wrapper.vue @@ -146,8 +146,8 @@ export default { // Process error to pass to specific component this.errorSources = [...newErrorSources, ...parseError(error)]; }, - async handleSave({ action, extraMergeRequestInput = null, policy, isRuleMode = false }) { - this.extraMergeRequestInput = extraMergeRequestInput; + async handleSave({ action, extraMergeRequestInput = {}, policy, isRuleMode = false }) { + this.extraMergeRequestInput = { ...extraMergeRequestInput, type: this.policyUrlParameter }; this.policyModificationAction = action || this.policyActionName; this.policy = policy; this.isRuleMode = isRuleMode; diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/utils.js b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/utils.js index 4240ae48ae83c9c5725e25c139cbe73e569ff568..d25b98b569b0cbb64c22550db44aff4764e53520 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/utils.js +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/utils.js @@ -49,7 +49,7 @@ const createMergeRequest = async ({ projectPath, sourceBranch, targetBranch, - title = DEFAULT_MR_TITLE, + title, description = '', }) => { const input = { @@ -122,7 +122,12 @@ export const modifyPolicy = async ({ namespacePath, yamlEditorValue, }); - const { title, description } = extraMergeRequestInput ?? {}; + const { title, description, type } = extraMergeRequestInput ?? {}; + const specificTitle = sprintf(s__('SecurityOrchestration|%{action} %{name} %{type} policy'), { + action, + name, + type, + }); checkForErrors(newPolicyCommitBranch); @@ -130,7 +135,7 @@ export const modifyPolicy = async ({ projectPath: assignedPolicyProject.fullPath, sourceBranch: newPolicyCommitBranch.branch, targetBranch: assignedPolicyProject.branch, - title, + title: title || specificTitle || DEFAULT_MR_TITLE, description, }); diff --git a/locale/gitlab.pot b/locale/gitlab.pot index c42f41c9b7d191faf1f437243d2c69aa5a0f4fd7..0c4c7d1d02db5d9f93e19e2c417cfed31b854ef2 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -57948,6 +57948,9 @@ msgid_plural "SecurityOrchestration|%d projects which have compliance framework: msgstr[0] "" msgstr[1] "" +msgid "SecurityOrchestration|%{action} %{name} %{type} policy" +msgstr "" + msgid "SecurityOrchestration|%{agent} for %{namespaces}" msgstr ""