Make error alert accept error dictionary and default error
What does this MR do and why?
Make friendly error alert in purchase flow accept error dictionary and default error to make it reusable
- Makes
error_alert.vue
reusable from outside purchase flows by allowing to specify specific error dictionary and default error message - Updates the utils to be pure functions for re-usability
- Moves
error_alert.vue
up a level to make it reusable from outside purchase flows, eg. usage quotas - Moves error constants to a separate file
We'll be using the updated error_alert.vue
component in this MR from usage quotas page.
Screenshots or screen recordings
No changes to the UI, corresponding friendly errors should be displayed as before.
Scenario | Before | After |
---|---|---|
Error message as string | ||
Error with attribute map | ||
Error message as object | ||
Error with no message | ||
Error with no matching friendly error |
How to set up and validate locally
- Customers Dot needs to be setup in order to view the billing page for a group
- Start GDK in SaaS mode
GITLAB_SIMULATE_SAAS=1 gdk start
- Login into
gdk
- Go to a group where you are an owner (or create one)
- Copy the group id
- Plan purchase flow: Visit
<your-gdk-url>/-/subscriptions/new?namespace_id=<your-group-id>&plan_id=2c92a00d76f0d5060176f2fb0a5029ff
- AddOn Purchase Flow: Visit
<your-gdk-url>/-/subscriptions/buy_minutes?selected_group=<your-group-id>
- The best way to see the error as soon as you land on the page is to use this patch: error_mapping_patch.patch
- You can change the constant in
new Error(EMAIL_TAKEN_ERROR)
to-
EMAIL_TAKEN_ERROR_TYPE
(for attribute map) -
FIRST_NAME_BLANK_ERROR_VARIATION
(for error message as object) - empty (
new Error()
for no message) - a random string
new Error('no matching friendly error')
) for no mapping available scenario.
-
- You can change the constant in
Storybook
- Start storybook
yarn storybook:start
- Visit http://localhost:9002/?path=/story/ee-vue-shared-components-error-alert--default
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 #420010
Edited by Vamsi Vempati