Add modal to upload file with code
What does this MR do and why?
Add button to upload file with code
- create modal
- add drag and drop section
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Scenario | Screenshot |
---|---|
Default | ![]() |
Success | ![]() |
Confirmation Modal | ![]() |
Error | ![]() |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Upload a GitLab Ultimate license
- Enable the following feature flag
echo "Feature.enable(:compliance_pipeline_in_policies)" | rails c
- Go to a project or group
-
Secure
->Policies
->New policy
->Scan execution policy
- Add new action -> Execute a YAML code block
- Verify button appears and one can upload a file
To create an error:
- Apply the following patch
diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_import.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_import.vue
index c07fcda3f6ad..13f49815e104 100644
--- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_import.vue
+++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_import.vue
@@ -51,6 +51,7 @@ export default {
this.uploadedFile = e?.target?.files[0];
const processedFile = new FileReader();
if (this.uploadedFile) {
+ debugger;
processedFile.readAsText(this.uploadedFile);
processedFile.onload = this.handleFileProcessed;
processedFile.onerror = this.showError;
- Open the browser debugger
- Upload a file
- When the code gets stuck on the debugger, delete the chosen file
- Continue the code execution
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #428508 (closed)
Edited by Alexander Turinske