-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mesh-service-detail-view): add dpp status and hostnames (#3497)
This PR introduces both status of DPPs and hostnames of a mesh service and hostnames for mesh-external and mesh-multizone-service. The status of DPPs is already part of the mesh service API (`status.dataplaneProxies`) and the hostnames are exposed by the `_hostnames` API. The order of placement of the two new cards is first hostnames and then the status of DPPs so the status of DPPs is directly above the listing of DPPs. Additionally I've updated the generated openapi-typescript types from [kuma/master/docs/generated/openapi.yaml](https://github.com/kumahq/kuma/blob/master/docs/generated/openapi.yaml). The endpoint for services `_hostnames` is part of the api specs and fully typed. The `:serviceType` parameter is a union type and requires one of `meshservices`, `meshmultizoneservices` or `meshexternalservices`. While I'd prefer to have `defineSources` consider the types from the specs, it would require several changes in other parts. So for now to satisfy TypeScript and catch any mismatches I've added a type guard like in other places and throw an error in case an incorrect value is provided. ![image](https://github.com/user-attachments/assets/b182a2a7-3aff-44a3-b559-106efa812852) --- I decided to keep the different mocks of `meshservices`, `meshexternalservices` and `meshmultizoneservices` in separate files, although the code is almost the same. I found that it's a little easier to find and probably easier to extend in the future when things might further differ. If we find in the future that this becomes cumbersome to maintain, we can definitely think of merging those files into one. Closes #3322 --------- Signed-off-by: schogges <[email protected]>
- Loading branch information
Showing
16 changed files
with
3,231 additions
and
1,972 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { components } from '@/types/auto-generated.d' | ||
|
||
type GeneratedHostnames = components['responses']['InspectHostnamesResponse']['content']['application/json'] | ||
type GeneratedHostname = components['responses']['InspectHostnamesResponse']['content']['application/json']['items'][number] | ||
|
||
export const Hostname = { | ||
fromObject(item: GeneratedHostname) { | ||
return item | ||
}, | ||
|
||
fromCollection(collection: GeneratedHostnames) { | ||
const items = Array.isArray(collection.items) ? collection.items.map(Hostname.fromObject) : [] | ||
|
||
return { | ||
...collection, | ||
items, | ||
total: collection.total ?? items.length, | ||
} | ||
}, | ||
} | ||
export type Hostname = ReturnType<typeof Hostname['fromObject']> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.