Skip to content

Extend panel errors to support warnings

Ezekiel Kigbo requested to merge ek-support-panel-warnings into master

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 to setAlerts
  • 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
Screenshot_2024-05-02_at_19.08.33 Screenshot_2024-05-02_at_18.54.31 Screenshot_2024-05-02_at_19.04.44

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

  1. 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',
    
  2. Navigate to group analytics dashboards
  3. Select Value streams dashboard (or any other dashboard)
  4. Navigate to the ee/app/assets/javascripts/vue_shared/components/customizable_dashboard/panels_base.vue file and uncomment one of the alerts
  5. Refresh the dashboard, repeat with other alerts
Edited by Ezekiel Kigbo

Merge request reports