Draft: Extract common functionality for code suggestions usage for reuse
What does this MR do and why?
This MR includes an approach to refactor the existing code for Code Suggestions Usage to support both SM and SaaS usage flows.
The changes include:
- Updating the existing
addOnPurchase
query to take an optional parameter fornamespaceId
. - Refactoring the existing
code_suggestions_usage.vue
component to use the new query and pass in optionalnamespaceId
(groupId
) parameter when applicable- The only change to this component between SaaS and SM is the optional parameter (
groupId
) toaddOnPurchase
query, everything else including the response data structure for both flows will be identical. I don't anticipate this component diverging much between SM and SaaS flows in this future, which is one of the reasons to reuse the existing component without splitting it for SM and SaaS.
- The only change to this component between SaaS and SM is the optional parameter (
- Extracting
addOnEligibleUsers
query related logic fromadd_on_eligible_user_list.vue
to a wrapper componentsaas_add_on_eligible_user_list.vue
(we'd have a similar component for SM) which will be responsible for making the API call to fetch the eligible user list and transforming the response to make it suitable for the common component -add_on_eligible_user_list.vue
.- The combination of
add_on_eligible_user_list.vue
andsaas_add_on_eligible_user_list.vue
should give us flexibility to add features that are either common to both SM and SaaS flows or selectively applicable to either easily without unintended side effects.
- The combination of
This also only includes the changes to purely show the approach for a quicker scan/review before I split the MR into smaller ones. Therefore it doesn't include changes to rename or move files and variables or tests
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
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 #432440