Allow refetching when request fails
What does this MR do and why?
Currently, if a request fails, the MR Widget does not allow refetching the expanded data. This MR adjusts that functionality and allows refetching when the error fails.
Screenshots or screen recordings
How to set up and validate locally
- User clicks on the toggle button
- Loading icon is displayed
- Once loaded, the parent is updated and the
expandedproperty of the object passed throughv-modelis updated.
How to set up and validate locally
- This feature is behind a feature flag. Enable
:refactor_security_extensionto turn this feature on.
echo "Feature.enable(:refactor_security_extension)" | rails c
- Visit an MR page with Security Scanning
The easiest way to populate data for testing is using this extension https://chrome.google.com/webstore/detail/mokku-mock-api-calls-seam/llflfcikklhgamfmnjkgpdadpmdplmji?hl=en and importing mokku-mocks-22-8-2022.json this json.
Once you have enabled the extension:
- Open the developer tools
- Find Mokku tab
- Click on import
- Import the file mentioned above
- Wait until the initial request resolves and the widget displays the number of vulnerabilities found
- Go back to the Mokku tab
- Change the status of a request to 5
- Hit the toggle button as shown in the screencast above
Apply the following patch to force triggering a request:
diff --git a/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue b/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
index 04645dddb575..f8103dd413b4 100644
--- a/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
+++ b/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
@@ -98,7 +98,9 @@ export default {
this.isLoading = value;
},
- fetchExpandedData() {},
+ fetchExpandedData() {
+ return this.fetchCollapsedData();
+ },
fetchCollapsedData() {
// TODO: check if gl.mrWidgetData can be safely removed after we migrate to the
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 #371539 (closed)

