-
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(zones): adds an available services listing tab for zone ingresses (
#1607) Adds a listing tab for ZoneIngress AvailableServices. --------- Signed-off-by: John Cowen <[email protected]>
- Loading branch information
Showing
17 changed files
with
217 additions
and
36 deletions.
There are no files selected for viewing
20 changes: 15 additions & 5 deletions
20
...res/zones/zone-cps/ingresses/Item.feature → ...nes/zone-cps/ingresses/item/Index.feature
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,28 @@ | ||
Feature: zones / ingresses / item / services | ||
Background: | ||
Given the CSS selectors | ||
| Alias | Selector | | ||
| items | [data-testid='available-services-collection'] | | ||
| item | $items tbody tr | | ||
|
||
And the environment | ||
""" | ||
KUMA_MODE: global | ||
KUMA_SERVICE_COUNT: 2 | ||
""" | ||
|
||
Scenario: An ingress with 2 available services | ||
Given the URL "/zoneingresses+insights/item-1" responds with | ||
""" | ||
body: | ||
zoneIngress: | ||
zone: zone-cp-1 | ||
availableServices: | ||
- tags: | ||
kuma.io/service: service-1 | ||
- tags: | ||
kuma.io/service: service-2 | ||
""" | ||
When I visit the "/zones/zone-cp-1/ingresses/item-1/services" URL | ||
Then the "$item" element exists 2 times | ||
|
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,24 @@ | ||
import type { ZoneIngressOverview as PartialZoneIngressOverview } from '@/types/index.d' | ||
export type { AvailableService } from '@/types/index.d' | ||
type PartialZoneIngress = PartialZoneIngressOverview['zoneIngress'] | ||
|
||
type RequiredZoneIngress = | ||
Required<Pick<PartialZoneIngress, | ||
'availableServices' | ||
>> | ||
& PartialZoneIngressOverview['zoneIngress'] | ||
|
||
export type ZoneIngressOverview = PartialZoneIngressOverview & { | ||
zoneIngress: RequiredZoneIngress | ||
} | ||
export const ZoneIngressOverview = { | ||
fromObject: (item: PartialZoneIngressOverview): ZoneIngressOverview => { | ||
return { | ||
...item, | ||
zoneIngress: { | ||
...item.zoneIngress, | ||
availableServices: !Array.isArray(item.zoneIngress.availableServices) ? [] : item.zoneIngress.availableServices, | ||
}, | ||
} | ||
}, | ||
} |
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
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,111 @@ | ||
<template> | ||
<RouteView | ||
v-slot="{ t }" | ||
name="zone-ingress-services-view" | ||
> | ||
<AppView> | ||
<template #title> | ||
<h2> | ||
<RouteTitle | ||
:title="t('zone-ingresses.routes.item.navigation.zone-ingress-services-view')" | ||
:render="true" | ||
/> | ||
</h2> | ||
</template> | ||
|
||
<KCard> | ||
<template #body> | ||
<AppCollection | ||
data-testid="available-services-collection" | ||
:empty-state-message="t('common.emptyState.message', { type: 'Services' })" | ||
:headers="[ | ||
{ label: 'Name', key: 'name' }, | ||
{ label: 'Mesh', key: 'mesh' }, | ||
{ label: 'Protocol', key: 'protocol' }, | ||
{ label: 'No. Instances', key: 'instances' }, | ||
{ label: 'Actions', key: 'actions', hideLabel: true }, | ||
]" | ||
:items="props.data.zoneIngress.availableServices" | ||
> | ||
<template #name="{ row: item }: {row: AvailableService}"> | ||
<RouterLink | ||
:to="{ | ||
name: 'service-detail-view', | ||
params: { | ||
mesh: item.mesh, | ||
service: item.tags['kuma.io/service'], | ||
}, | ||
}" | ||
> | ||
{{ item.tags['kuma.io/service'] }} | ||
</RouterLink> | ||
</template> | ||
|
||
<template #mesh="{ row: item }: {row: AvailableService}"> | ||
<RouterLink | ||
:to="{ | ||
name: 'mesh-detail-view', | ||
params: { | ||
mesh: item.mesh, | ||
}, | ||
}" | ||
> | ||
{{ item.mesh }} | ||
</RouterLink> | ||
</template> | ||
|
||
<template #protocol="{ row: item }: {row: AvailableService}"> | ||
{{ item.tags['kuma.io/protocol'] ?? t('common.collection.none') }} | ||
</template> | ||
|
||
<template #instances="{ row: item }"> | ||
{{ item.instances }} | ||
</template> | ||
|
||
<template #actions="{ row: item }: {row: AvailableService}"> | ||
<KDropdownMenu | ||
class="actions-dropdown" | ||
:kpop-attributes="{ placement: 'bottomEnd', popoverClasses: 'mt-5 more-actions-popover' }" | ||
width="150" | ||
> | ||
<template #default> | ||
<KButton | ||
class="non-visual-button" | ||
appearance="secondary" | ||
size="small" | ||
> | ||
<MoreIcon :size="KUI_ICON_SIZE_30" /> | ||
</KButton> | ||
</template> | ||
<template #items> | ||
<KDropdownItem | ||
:item="{ | ||
to: { | ||
name: 'service-detail-view', | ||
params: { | ||
mesh: item.mesh, | ||
service: item.tags['kuma.io/service'], | ||
}, | ||
}, | ||
label: t('common.collection.actions.view'), | ||
}" | ||
/> | ||
</template> | ||
</KDropdownMenu> | ||
</template> | ||
</AppCollection> | ||
</template> | ||
</KCard> | ||
</AppView> | ||
</RouteView> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { KUI_ICON_SIZE_30 } from '@kong/design-tokens' | ||
import type { AvailableService, ZoneIngressOverview } from '../../data' | ||
import AppCollection from '@/app/application/components/app-collection/AppCollection.vue' | ||
const props = defineProps<{ | ||
data: ZoneIngressOverview | ||
}>() | ||
</script> |
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