Skip to content

Update errors emitted by un/linking project

Alexander Turinske requested to merge 416903-update-project-modal-errors into master

What does this MR do and why?

Update errors emitted by un/linking project

  • use custom error message
  • default to old error otherwise
  • update tests

Changelog: changed

EE: true

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image Screenshot_2024-02-14_at_16.07.27

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Upload a GitLab Ultimate license
  2. Navigate to a project => Secure => Policies
  3. Apply the following patch
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/project_modal.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/project_modal.vue
index 0c6ba9517bd1..ddff2ae87533 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policies/project_modal.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policies/project_modal.vue
@@ -79,8 +79,8 @@ export default {
           mutation: linkSecurityPolicyProject,
           variables: {
             input: {
-              fullPath: this.namespacePath,
-              securityPolicyProjectId: this.selectedProjectId,
+              fullPath: null,
+              securityPolicyProjectId: null,
             },
           },
         });
@@ -113,7 +113,7 @@ export default {
           mutation: unlinkSecurityPolicyProject,
           variables: {
             input: {
-              fullPath: this.namespacePath,
+              fullPath: null,
             },
           },
         });
  1. Try to link a project
  2. Verify the link error is not the standard one
  3. Remove the patch, link a project, reapply the patch, try to unlink the project
  4. Verify the unlink error is not the standard one

Related to #416903 (closed)

Merge request reports