Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(meshservice): several amends to Mesh*Service #2936

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/services/data/MeshService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export const MeshService = {
...item,
tls: typeof item.tls !== 'undefined' ? item.tls : { status: 'NotReady' },
vips: Array.isArray(item.vips) ? item.vips : [],
dataplaneProxies: ((item = {}) => ({
connected: item.connected ?? 0,
total: item.total ?? 0,
healthy: item.healthy ?? 0,
}))(item.dataplaneProxies),
addresses: Array.isArray(item.addresses)
? item.addresses.map(item => {
return {
Expand Down
69 changes: 36 additions & 33 deletions src/app/services/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,34 @@ export const routes = (can: Can) => {
},
],
},
{
path: 'mesh-multi-zone-services/:service',
name: 'mesh-multi-zone-service-detail-tabs-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceDetailTabsView.vue'),
children: [
...(can('use zones')
? [
{
path: 'overview',
name: 'mesh-multi-zone-service-detail-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceDetailView.vue'),
path: 'mesh-multi-zone-services/:service',
name: 'mesh-multi-zone-service-detail-tabs-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceDetailTabsView.vue'),
children: [
{
path: ':dataPlane',
name: 'mesh-multi-zone-service-data-plane-summary-view',
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
path: 'overview',
name: 'mesh-multi-zone-service-detail-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceDetailView.vue'),
children: [
{
path: ':dataPlane',
name: 'mesh-multi-zone-service-data-plane-summary-view',
component: () => import('@/app/data-planes/views/DataPlaneSummaryView.vue'),
},
],
},
{
path: 'config',
name: 'mesh-multi-zone-service-config-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceConfigView.vue'),
},
],
},
{
path: 'config',
name: 'mesh-multi-zone-service-config-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceConfigView.vue'),
},
],
},
]
: []),
{
path: 'mesh-external-services/:service',
name: 'mesh-external-service-detail-tabs-view',
Expand All @@ -99,11 +103,6 @@ export const routes = (can: Can) => {
name: 'mesh-external-service-detail-view',
component: () => import('@/app/services/views/MeshExternalServiceDetailView.vue'),
},
{
path: 'config',
name: 'mesh-external-service-config-view',
component: () => import('@/app/services/views/MeshExternalServiceConfigView.vue'),
},
],
},
]
Expand Down Expand Up @@ -147,18 +146,22 @@ export const routes = (can: Can) => {
},
],
},
{
path: 'mesh-multi-zone-services',
name: 'mesh-multi-zone-service-list-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceListView.vue'),
children: [
...(can('use zones')
? [
{
path: ':service',
name: 'mesh-multi-zone-service-summary-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceSummaryView.vue'),
path: 'mesh-multi-zone-services',
name: 'mesh-multi-zone-service-list-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceListView.vue'),
children: [
{
path: ':service',
name: 'mesh-multi-zone-service-summary-view',
component: () => import('@/app/services/views/MeshMultiZoneServiceSummaryView.vue'),
},
],
},
],
},
]
: []),
{
path: 'mesh-external-services',
name: 'mesh-external-service-list-view',
Expand Down
48 changes: 0 additions & 48 deletions src/app/services/views/MeshExternalServiceConfigView.vue

This file was deleted.

89 changes: 40 additions & 49 deletions src/app/services/views/MeshExternalServiceDetailView.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
<template>
<RouteView
name="mesh-external-service-detail-view"
v-slot="{ can }"
:params="{
codeSearch: '',
codeFilter: false,
codeRegExp: false,
}"
v-slot="{ route, can }"
>
<AppView>
<div
class="stack"
>
<KCard>
<div class="columns">
<DefinitionCard
v-if="props.data.namespace.length > 0"
>
<template #title>
Namespace
</template>

<template #body>
{{ props.data.namespace }}
</template>
</DefinitionCard>
<DefinitionCard
v-if="can('use zones') && props.data.zone"
>
Expand All @@ -32,38 +48,6 @@
</XAction>
</template>
</DefinitionCard>
<DefinitionCard
v-if="props.data.status.addresses.length > 0"
>
<template
#title
>
Addresses
</template>
<template
#body
>
<template
v-if="props.data.status.addresses.length === 1"
>
<TextWithCopyButton
:text="props.data.status.addresses[0].hostname"
>
{{ props.data.status.addresses[0].hostname }}
</TextWithCopyButton>
</template>
<KTruncate
v-else
>
<span
v-for="address in props.data.status.addresses"
:key="address.hostname"
>
{{ address.hostname }}
</span>
</KTruncate>
</template>
</DefinitionCard>
<DefinitionCard
v-if="data.spec.match"
class="port"
Expand Down Expand Up @@ -104,32 +88,39 @@
</KBadge>
</template>
</DefinitionCard>
<DefinitionCard
v-if="typeof data.status.vip !== 'undefined'"
class="ip"
>
<template
#title
>
VIP
</template>
<template
#body
>
{{ data.status.vip.ip }}
</template>
</DefinitionCard>
</div>
</KCard>
<ResourceCodeBlock
:resource="props.data.config"
is-searchable
:query="route.params.codeSearch"
:is-filter-mode="route.params.codeFilter"
:is-reg-exp-mode="route.params.codeRegExp"
@query-change="route.update({ codeSearch: $event })"
@filter-mode-change="route.update({ codeFilter: $event })"
@reg-exp-mode-change="route.update({ codeRegExp: $event })"
v-slot="{ copy, copying }"
>
<DataSource
v-if="copying"
:src="`/meshes/${props.data.mesh}/mesh-external-service/${props.data.id}/as/kubernetes?no-store`"
@change="(data) => {
copy((resolve) => resolve(data))
}"
@error="(e) => {
copy((_resolve, reject) => reject(e))
}"
/>
</ResourceCodeBlock>
</div>
</AppView>
</RouteView>
</template>

<script lang="ts" setup>
import type { MeshExternalService } from '../data'
import ResourceCodeBlock from '@/app/common/code-block/ResourceCodeBlock.vue'
import DefinitionCard from '@/app/common/DefinitionCard.vue'
import TextWithCopyButton from '@/app/common/TextWithCopyButton.vue'

const props = defineProps<{
data: MeshExternalService
Expand Down
32 changes: 0 additions & 32 deletions src/app/services/views/MeshExternalServiceListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
{ ...me.get('headers.name'), label: 'Name', key: 'name' },
{ ...me.get('headers.namespace'), label: 'Namespace', key: 'namespace' },
...(can('use zones') ? [{ ...me.get('headers.zone'), label: 'Zone', key: 'zone' }] : []),
{ ...me.get('headers.tls'), label: 'TLS', key: 'tls' },
{ ...me.get('headers.addresses'), label: 'Addresses', key: 'addresses' },
{ ...me.get('headers.port'), label: 'Port', key: 'port' },
{ ...me.get('headers.actions'), label: 'Actions', key: 'actions', hideLabel: true },
]"
Expand Down Expand Up @@ -97,36 +95,6 @@
{{ t('common.detail.none') }}
</template>
</template>
<template #tls="{ row: item }">
<KBadge
appearance="neutral"
>
{{ item.spec.tls?.enabled ? 'Enabled' : 'Disabled' }}
</KBadge>
</template>
<template
#addresses="{ row: item }"
>
<template
v-if="item.status.addresses.length === 1"
>
<TextWithCopyButton
:text="item.status.addresses[0].hostname"
>
{{ item.status.addresses[0].hostname }}
</TextWithCopyButton>
</template>
<KTruncate
v-else
>
<span
v-for="address in item.status.addresses"
:key="address.hostname"
>
{{ address.hostname }}
</span>
</KTruncate>
</template>
<template
#port="{ row: item }"
>
Expand Down
46 changes: 12 additions & 34 deletions src/app/services/views/MeshExternalServiceSummaryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@
<div
class="stack-with-borders"
>
<DefinitionCard
v-if="item.namespace.length > 0"
layout="horizontal"
>
<template #title>
Namespace
</template>

<template #body>
{{ item.namespace }}
</template>
</DefinitionCard>
<DefinitionCard
v-if="can('use zones') && item.zone"
layout="horizontal"
Expand All @@ -67,39 +79,6 @@
</XAction>
</template>
</DefinitionCard>
<DefinitionCard
v-if="item.status.addresses.length > 0"
layout="horizontal"
>
<template
#title
>
Addresses
</template>
<template
#body
>
<template
v-if="item.status.addresses.length === 1"
>
<TextWithCopyButton
:text="item.status.addresses[0].hostname"
>
{{ item.status.addresses[0].hostname }}
</TextWithCopyButton>
</template>
<KTruncate
v-else
>
<span
v-for="address in item.status.addresses"
:key="address.hostname"
>
{{ address.hostname }}
</span>
</KTruncate>
</template>
</DefinitionCard>
<DefinitionCard
v-if="item.spec.match"
layout="horizontal"
Expand Down Expand Up @@ -180,7 +159,6 @@
<script lang="ts" setup>
import ResourceCodeBlock from '@/app/common/code-block/ResourceCodeBlock.vue'
import DefinitionCard from '@/app/common/DefinitionCard.vue'
import TextWithCopyButton from '@/app/common/TextWithCopyButton.vue'
import type { MeshExternalService } from '@/app/services/data'
const props = defineProps<{
items: MeshExternalService[]
Expand Down
Loading