fix(redis): config card changes for add-ons [khcp-19716]#3079
fix(redis): config card changes for add-ons [khcp-19716]#3079aanchalm01 wants to merge 16 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Redis Configuration detail UI to support Konnect Cloud Gateways “managed cache” add-ons by showing a managed cache configuration card and (when available) a collapsible nested partial configuration card, aligning with the new Konnect-managed Redis experience.
Changes:
- Extend
EntityBaseConfigCardto support an optional#after-fieldsslot area and aformatsToHideprop to prune format dropdown entries (while always keeping Structured). - Add Cloud Gateways add-on parsing/display/schema/API helpers to normalize add-on payloads and render a stable managed-cache config card.
- Update
RedisConfigurationConfigCardto resolve route IDs as add-on vs partial and render the managed layout with optional partial collapse; add sandbox + locale updates.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/entities/entities-shared/src/components/entity-base-config-card/EntityBaseConfigCard.vue | Adds formatsToHide filtering and an after-fields block slot area under the grid; adjusts slot pass-through and styling. |
| packages/entities/entities-redis-configurations/src/types/redis-configuration-form.ts | Adds isCloudGateway flag to form config typing. |
| packages/entities/entities-redis-configurations/src/types/redis-configuration-config.ts | Extends Konnect entity config typing with managed-Redis + Cloud Gateway flags and add-on API base/geo fields. |
| packages/entities/entities-redis-configurations/src/types/cloud-gateways-add-on.ts | Introduces types for Cloud Gateways add-on API payloads (managed cache add-on). |
| packages/entities/entities-redis-configurations/src/locales/en.json | Adds i18n strings for managed cache/partial section labels and collapse UI. |
| packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on.ts | Barrel export for managed-cache add-on helper modules. |
| packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-parse.ts | Runtime-safe parsing/type-guard helpers for add-on payloads and cache_config_id extraction. |
| packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-display.ts | Flattens/normalizes add-on payloads into display-ready records (incl. cloud-auth stripping/grouping). |
| packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-display.spec.ts | Adds a unit test validating display shaping + allowlist picking for a managed add-on payload. |
| packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-api.ts | Adds API helpers to fetch add-ons and linked partials for list/detail flows. |
| packages/entities/entities-redis-configurations/src/helpers/managed-add-on-config-schema.ts | Builds an allowlisted, ordered config schema for the managed add-on card (incl. runtime Json vs JsonArray for DPG). |
| packages/entities/entities-redis-configurations/src/helpers.ts | Adds isKonnectManagedRedisEnabled helper gating managed Konnect behavior by FF + Cloud Gateway flag. |
| packages/entities/entities-redis-configurations/src/composables/useManagedCacheAddOnDisplaySchema.ts | Adds composable to rebuild managed add-on schema from fetched display records. |
| packages/entities/entities-redis-configurations/src/composables/index.ts | Exports the new composable for Cypress stubbing. |
| packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue | Implements managed Konnect detail resolver + managed add-on card rendering + nested partial collapse; hides YAML where needed. |
| packages/entities/entities-redis-configurations/sandbox/pages/RedisConfigurationFormPage.vue | Updates sandbox config to include the Cloud Gateway flag. |
| packages/entities/entities-redis-configurations/sandbox/pages/RedisConfigurationDetail.vue | Updates sandbox config to demonstrate Cloud Gateways base URL + managed flags. |
| packages/entities/entities-redis-configurations/package.json | Raises dist size checker limit to accommodate added functionality. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ges/entities/entities-shared/src/components/entity-base-config-card/EntityBaseConfigCard.vue
Show resolved
Hide resolved
...ges/entities/entities-shared/src/components/entity-base-config-card/EntityBaseConfigCard.vue
Show resolved
Hide resolved
...ges/entities/entities-shared/src/components/entity-base-config-card/EntityBaseConfigCard.vue
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-display.ts
Outdated
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Outdated
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Show resolved
Hide resolved
...ages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-display.spec.ts
Outdated
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/sandbox/pages/RedisConfigurationFormPage.vue
Show resolved
Hide resolved
2180fc9 to
f317fd9
Compare
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Outdated
Show resolved
Hide resolved
| } | ||
| return null | ||
| } | ||
|
|
There was a problem hiding this comment.
Non-blocking: could we use these util functions exported from lodash?
There was a problem hiding this comment.
I tried, but I am running into an issue with lodash-es - 4.18.1( ERR_PNPM_NO_MATURE_MATCHING_VERSION Version 4.18.1 (released 44 hours ago) of lodash-es does not meet the minimumReleaseAge constraint)
There was a problem hiding this comment.
@aanchalm01 can you try this again now that those restrictions have been removed from the repo?
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Outdated
Show resolved
Hide resolved
|
By the way, do we have a Konnect preview PR on this change? Since we're introducing changes in |
Yes, here's the consuming app PR: https://github.com/kong-konnect/konnect-ui-apps/pull/10823 |
6882db8 to
a504c51
Compare
kaiarrowood
left a comment
There was a problem hiding this comment.
There are testable changes to existing components and many new util helpers. Please add test coverage.
packages/entities/entities-redis-configurations/sandbox/pages/RedisConfigurationFormPage.vue
Outdated
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/helpers/managed-cache-add-on-parse.ts
Outdated
Show resolved
Hide resolved
...ges/entities/entities-shared/src/components/entity-base-config-card/EntityBaseConfigCard.vue
Outdated
Show resolved
Hide resolved
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Outdated
Show resolved
Hide resolved
| const payload = { ...entry } | ||
|
|
||
| delete payload.name |
There was a problem hiding this comment.
| const payload = { ...entry } | |
| delete payload.name | |
| const { payload, _name } = entry |
nit: alternative
There was a problem hiding this comment.
payload is not a field on entry, so const { payload, _name } = entry is not valid
There was a problem hiding this comment.
Sorry that was half-baked. I meant
const { name, ...payload } = entry; // put everything except for name in payload
| const emitFetchError = (error: AxiosError): void => emit('fetch:error', error) | ||
| const emitLoading = (isLoading: boolean): void => emit('loading', isLoading) |
There was a problem hiding this comment.
q: what is the purpose of these wrappers? Why not just call emit directly?
There was a problem hiding this comment.
They are used in three places, so wrappers are there to keep things DRY.
There was a problem hiding this comment.
But there is no extra logic in the wrapper so you aren't saving on any repetition?
There was a problem hiding this comment.
replaced with same inline emit at three places.
packages/entities/entities-redis-configurations/src/components/RedisConfigurationConfigCard.vue
Show resolved
Hide resolved
212ff4d to
b294954
Compare
fa77d53 to
0a1f28a
Compare
| const isPlainObject = (value: unknown): value is AddOnRecord => | ||
| value !== null && typeof value === 'object' && !Array.isArray(value) | ||
|
|
||
| const extractListMeta = (payload: unknown): { items: unknown[], totalPages?: number } => { | ||
| if (!isPlainObject(payload)) return { items: [] } | ||
|
|
||
| const items = Array.isArray(payload.data) ? payload.data as unknown[] : [] | ||
| if (!isPlainObject(payload.meta) || !isPlainObject(payload.meta.page)) return { items } |
There was a problem hiding this comment.
q: why do you need the checks for isPlainObject? Why would the type be unknown?
There was a problem hiding this comment.
I used unknown/runtime narrowing because Axios doesn’t type data as the list shape, so we either had to guard before property access or assert.The guards avoided casts while still handling normal TS object edge cases. Updated the code.
| isPlainObject(value) && Object.keys(value).length > 0 | ||
|
|
||
| // Coerce object/ JSON string to a plain record, otherwise null | ||
| const toPlainObject = (value: AddOnValue | undefined): AddOnRecord | null => { |
There was a problem hiding this comment.
Help me understand why you need these type helpers? Why are we doing so much manipulation of the API response?
There was a problem hiding this comment.
Most of that code is display normalization (shape/cloning for the card), not a second pass over the list/detail API validation. If the spread of helpers feels noisy, I can collapse it into one big build display model function so there’s a single place that owns that behavior.
There was a problem hiding this comment.
Please add test coverage around the changes to this file
There was a problem hiding this comment.
This file is super dense and hard to read, please try to use lodash helpers where possible and make sure you are adding comments throughout the functions.
89e3e5b to
8319164
Compare
Preview components from this PR in consuming applicationIn consuming application project install preview versions of shared packages generated by this PR: |
Summary
Addresses: https://konghq.atlassian.net/browse/KHCP-19716
Figma: https://www.figma.com/design/4aYQP8GdNbPAnrEq0TWxXQ/DCGW--Konnect-managed-cache?node-id=421-33880&t=t7njgqmnUSFmxUGc-0
FF:
khcp-19709-konnect-managed-redisThis PR introduces changes to Redis Configuration UI. The
Configurationtab for Konnect managed Redis shows the managed cache config info as well as partial config info now. No changes for legacy Konnect or Kong Manager code.Demo:
Config-tab-content.mov