-
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: adds summary tray to service list view (#1611)
feat(services): adds summary tray Adds a summary tray to the service list view. Signed-off-by: Philipp Rudloff <[email protected]>
- Loading branch information
Philipp Rudloff
authored
Oct 25, 2023
1 parent
b9e5a23
commit e1a94d6
Showing
11 changed files
with
349 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Feature: Service tray | ||
Background: | ||
Given the CSS selectors | ||
| Alias | Selector | | ||
| item | [data-testid='service-collection'] tbody tr | | ||
| tray | [data-testid='tray'] | | ||
| close-tray-button | $tray [data-testid^='close-button-'] | | ||
And the URL "/meshes/default/service-insights" responds with | ||
""" | ||
body: | ||
items: | ||
- name: service-1 | ||
""" | ||
|
||
Scenario: Clicking a row opens the summary tray | ||
Given the environment | ||
""" | ||
KUMA_SERVICEINSIGHT_COUNT: 1 | ||
""" | ||
|
||
When I visit the "/meshes/default/services" URL | ||
And I click the "$item:nth-child(1) td:nth-child(2)" element | ||
Then the "$tray" element exists | ||
And the "$tray" element contains "service-1" | ||
|
||
When I click the "$close-tray-button" element | ||
Then the "$tray" element doesn't exist | ||
|
||
When I navigate "back" | ||
Then the "$tray" element exists | ||
And the "$tray" element contains "service-1" | ||
|
||
When I navigate "forward" | ||
Then the "$tray" element doesn't exist | ||
|
||
Scenario: Summary tray URL goes to page with open service tray | ||
Given the environment | ||
""" | ||
KUMA_SERVICEINSIGHT_COUNT: 51 | ||
""" | ||
|
||
When I visit the "/meshes/default/services/service-1?page=2&size=50" URL | ||
Then the "$tray" element exists |
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,49 @@ | ||
<template> | ||
<div> | ||
<DataSource | ||
v-slot="{ data: externalService, error: externalServiceError }: ExternalServiceSource" | ||
:src="`/meshes/${props.mesh}/external-services/for/${props.service}`" | ||
> | ||
<ErrorBlock | ||
v-if="externalServiceError" | ||
:error="externalServiceError" | ||
/> | ||
|
||
<LoadingBlock v-else-if="externalService === undefined" /> | ||
|
||
<EmptyBlock | ||
v-else-if="externalService === null" | ||
data-testid="no-matching-external-service" | ||
> | ||
<template #title> | ||
<p>{{ t('services.detail.no_matching_external_service', { name: props.service }) }}</p> | ||
</template> | ||
</EmptyBlock> | ||
|
||
<ResourceCodeBlock | ||
v-else | ||
id="code-block-service" | ||
:resource="externalService" | ||
:resource-fetcher="(params) => kumaApi.getExternalService({ mesh: externalService.mesh, name: externalService.name }, params)" | ||
is-searchable | ||
/> | ||
</DataSource> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import type { ExternalServiceSource } from '../sources' | ||
import EmptyBlock from '@/app/common/EmptyBlock.vue' | ||
import ErrorBlock from '@/app/common/ErrorBlock.vue' | ||
import LoadingBlock from '@/app/common/LoadingBlock.vue' | ||
import ResourceCodeBlock from '@/app/common/ResourceCodeBlock.vue' | ||
import { useI18n, useKumaApi } from '@/utilities' | ||
const { t } = useI18n() | ||
const kumaApi = useKumaApi() | ||
const props = defineProps<{ | ||
mesh: string | ||
service: string | ||
}>() | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,67 @@ | ||
<template> | ||
<div class="stack"> | ||
<KCard> | ||
<template #body> | ||
<div class="columns"> | ||
<DefinitionCard> | ||
<template #title> | ||
{{ t('http.api.property.address') }} | ||
</template> | ||
|
||
<template #body> | ||
{{ props.externalService.networking.address }} | ||
</template> | ||
</DefinitionCard> | ||
|
||
<DefinitionCard v-if="props.externalService.tags !== null"> | ||
<template #title> | ||
{{ t('http.api.property.tags') }} | ||
</template> | ||
|
||
<template #body> | ||
<TagList :tags="props.externalService.tags" /> | ||
</template> | ||
</DefinitionCard> | ||
</div> | ||
</template> | ||
</KCard> | ||
<div> | ||
<DataSource | ||
v-slot="{ data: externalService, error }: ExternalServiceSource" | ||
:src="`/meshes/${props.mesh}/external-services/for/${props.service}`" | ||
> | ||
<ErrorBlock | ||
v-if="error" | ||
:error="error" | ||
/> | ||
|
||
<LoadingBlock v-else-if="externalService === undefined" /> | ||
|
||
<EmptyBlock | ||
v-else-if="externalService === null" | ||
data-testid="no-matching-external-service" | ||
> | ||
<template #title> | ||
<p>{{ t('services.detail.no_matching_external_service', { name: props.service }) }}</p> | ||
</template> | ||
</EmptyBlock> | ||
|
||
<div | ||
v-else | ||
class="columns" | ||
> | ||
<DefinitionCard> | ||
<template #title> | ||
{{ t('http.api.property.address') }} | ||
</template> | ||
|
||
<template #body> | ||
<TextWithCopyButton :text="externalService.networking.address" /> | ||
</template> | ||
</DefinitionCard> | ||
|
||
<DefinitionCard v-if="externalService.tags !== null"> | ||
<template #title> | ||
{{ t('http.api.property.tags') }} | ||
</template> | ||
|
||
<template #body> | ||
<TagList :tags="externalService.tags" /> | ||
</template> | ||
</DefinitionCard> | ||
</div> | ||
</DataSource> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { KCard } from '@kong/kongponents' | ||
import type { ExternalServiceSource } from '../sources' | ||
import DefinitionCard from '@/app/common/DefinitionCard.vue' | ||
import EmptyBlock from '@/app/common/EmptyBlock.vue' | ||
import ErrorBlock from '@/app/common/ErrorBlock.vue' | ||
import LoadingBlock from '@/app/common/LoadingBlock.vue' | ||
import TagList from '@/app/common/TagList.vue' | ||
import { ExternalService } from '@/types/index.d' | ||
import TextWithCopyButton from '@/app/common/TextWithCopyButton.vue' | ||
import { useI18n } from '@/utilities' | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
externalService: ExternalService | ||
mesh: string | ||
service: string | ||
}>() | ||
</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
Oops, something went wrong.