Extend panel errors to support warnings
What does this MR do and why?
Adds support for additional alert variants. This MR extends the setErrors
method (renamed to setAlerts
) to allow panels to emit a
warning or information alert.
This MR:
- Renames
setErrors
tosetAlerts
- Adds support for additional alert variants (
warning
,info
) - Updates the icon used for the error state (was incorrectly using the warning icon)
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.
Error | Warning | Info |
---|---|---|
Notes
The gl-border-t-blue-500
css utility doesnt seem to exist, I initially used gl-border-t-blue-600
which does exist but refuses to render, always resulting in the grey border top, will need to look into this separately.
How to set up and validate locally
- Apply this diff, this has 3 examples of alerts,
diff --git a/ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue b/ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue index e7758732c79b..c27c39711724 100644 --- a/ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue +++ b/ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue @@ -166,6 +166,32 @@ export default { }); }, }, + mounted() { + // TODO: for testing + // this.setAlerts({ + // title: 'Very bad!', + // alerts: ['One bad thing', 'Another bad thing'], + // }); + // + // TODO: for testing + // this.setAlerts({ + // variant: VARIANT_WARNING, + // fullPanelError: false, + // title: 'Cool title!', + // description: 'This is a very descriptive message about the warning state', + // canRetry: false, + // }); + // + // TODO: for testing + // Testing info alert + // this.setAlerts({ + // variant: VARIANT_INFO, + // fullPanelError: false, + // title: 'Information for you!', + // description: 'This is a very very informative information about what is happening in the thing.', + // canRetry: false, + // }); + }, watch: { visualization: { handler: 'fetchData',
- Navigate to group analytics dashboards
- Select
Value streams dashboard
(or any other dashboard) - Navigate to the
ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue
file and uncomment one of the alerts - Refresh the dashboard, repeat with other alerts
Edited by Ezekiel Kigbo