Skip to content
Draft
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
2 changes: 1 addition & 1 deletion packages/kuma-gui/src/app/legacy-data-planes/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { meshIdentityRoutes } from '../resources/routes'
import { routes as meshIdentityRoutes } from '../mesh-identities/routes'
import { routes as connections, networking } from '@/app/connections/routes'
import { routes as subscriptions } from '@/app/subscriptions/routes'
import type { RouteRecordRaw } from 'vue-router'
Expand Down
20 changes: 20 additions & 0 deletions packages/kuma-gui/src/app/mesh-identities/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { token } from '@kumahq/container'

import { sources } from './sources'
import type { ServiceDefinition } from '@kumahq/container'

type Token = ReturnType<typeof token>

export const services = (app: Record<string, Token>): ServiceDefinition[] => {
return [
[token('mesh-identities.sources'), {
service: sources,
arguments: [
app.api,
],
labels: [
app.sources,
],
}],
]
}
11 changes: 11 additions & 0 deletions packages/kuma-gui/src/app/mesh-identities/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { RouteRecordRaw } from 'vue-router'

export const routes = (prefix?: string): RouteRecordRaw[] => {
return [
{
path: 'meshidentity/:mid',
name: `${prefix ? `${prefix}-` : ''}mesh-identity-summary-view`,
component: () => import('@/app/mesh-identities/views/MeshIdentitySummaryView.vue'),
},
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import createClient from 'openapi-fetch'

import { MeshIdentity } from './data/MeshIdentity'
import type { KumaMeshIdentity } from './data/MeshIdentity'
import { MeshTrust } from './data/MeshTrust'
import type { KumaMeshTrust } from './data/MeshTrust'
import { defineSources } from '@/app/application'
import type KumaApi from '@/app/kuma/services/kuma-api/KumaApi'
import type { paths } from '@kumahq/kuma-http-api'
Expand Down Expand Up @@ -59,51 +57,5 @@ export const sources = (api: KumaApi) => {

return res.data
},

'/meshes/:mesh/meshtrusts': async (params) => {
const { mesh } = params

const res = await http.GET('/meshes/{mesh}/meshtrusts', {
params: {
path: {
mesh,
},
},
})

return MeshTrust.fromCollection(res.data!)
},

'/meshtrusts/:mtrust': async (params) => {
const { mtrust } = params

const res = await http.GET('/_kri/{kri}', {
params: {
path: {
kri: mtrust,
},
},
})

return MeshTrust.fromObject(res.data as KumaMeshTrust)
},

'/meshtrusts/:mtrust/as/kubernetes': async (params) => {
const { mtrust } = params

const res = await http.GET('/_kri/{kri}', {
params: {
path: {
kri: mtrust,
},
// @ts-ignore
query: {
format: 'kubernetes',
},
},
})

return res.data
},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<script lang="ts" setup>
import type { MeshIdentity } from '../data/MeshIdentity'
import { YAML } from '@/app/application'
import { sources } from '@/app/resources/sources'
import { sources } from '@/app/mesh-identities/sources'

const props = defineProps<{
meshIdentities: MeshIdentity[]
Expand Down
20 changes: 20 additions & 0 deletions packages/kuma-gui/src/app/mesh-trusts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { token } from '@kumahq/container'

import { sources } from './sources'
import type { ServiceDefinition } from '@kumahq/container'

type Token = ReturnType<typeof token>

export const services = (app: Record<string, Token>): ServiceDefinition[] => {
return [
[token('mesh-trusts.sources'), {
service: sources,
arguments: [
app.api,
],
labels: [
app.sources,
],
}],
]
}
11 changes: 11 additions & 0 deletions packages/kuma-gui/src/app/mesh-trusts/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { RouteRecordRaw } from 'vue-router'

export const routes = (): RouteRecordRaw[] => {
return [
{
path: 'meshtrust/:mtrust',
name: 'mesh-trust-summary-view',
component: () => import('@/app/mesh-trusts/views/MeshTrustSummaryView.vue'),
},
]
}
61 changes: 61 additions & 0 deletions packages/kuma-gui/src/app/mesh-trusts/sources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import createClient from 'openapi-fetch'

import { MeshTrust } from './data/MeshTrust'
import type { KumaMeshTrust } from './data/MeshTrust'
import { defineSources } from '@/app/application'
import type KumaApi from '@/app/kuma/services/kuma-api/KumaApi'
import type { paths } from '@kumahq/kuma-http-api'

export const sources = (api: KumaApi) => {
const http = createClient<paths>({
baseUrl: '',
fetch: api.client.fetch,
})
return defineSources({
'/meshes/:mesh/meshtrusts': async (params) => {
const { mesh } = params

const res = await http.GET('/meshes/{mesh}/meshtrusts', {
params: {
path: {
mesh,
},
},
})

return MeshTrust.fromCollection(res.data!)
},

'/meshtrusts/:mtrust': async (params) => {
const { mtrust } = params

const res = await http.GET('/_kri/{kri}', {
params: {
path: {
kri: mtrust,
},
},
})

return MeshTrust.fromObject(res.data as KumaMeshTrust)
},

'/meshtrusts/:mtrust/as/kubernetes': async (params) => {
const { mtrust } = params

const res = await http.GET('/_kri/{kri}', {
params: {
path: {
kri: mtrust,
},
// @ts-ignore
query: {
format: 'kubernetes',
},
},
})

return res.data
},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<script lang="ts" setup>
import { YAML } from '@/app/application'
import { sources } from '@/app/resources/sources'
import { sources } from '@/app/mesh-trusts/sources'
</script>
<style scoped>
h2::before {
Expand Down
3 changes: 2 additions & 1 deletion packages/kuma-gui/src/app/meshes/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { meshIdentityRoutes, meshTrustRoutes } from '../resources/routes'
import { routes as meshIdentityRoutes } from '../mesh-identities/routes'
import { routes as meshTrustRoutes } from '../mesh-trusts/routes'
import type { RouteRecordRaw } from 'vue-router'

export type SplitRouteRecordRaw = {
Expand Down
14 changes: 1 addition & 13 deletions packages/kuma-gui/src/app/resources/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import { token } from '@kumahq/container'

import { sources } from './sources'
import type { ServiceDefinition } from '@kumahq/container'

type Token = ReturnType<typeof token>
type ResourcesSources = ReturnType<typeof sources>

export const services = (app: Record<string, Token>): ServiceDefinition[] => {
return [
[token<ResourcesSources>('resources.sources'), {
service: sources,
arguments: [
app.api,
],
labels: [
app.sources,
],
}],
]
return []
}
21 changes: 0 additions & 21 deletions packages/kuma-gui/src/app/resources/routes.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/kuma-gui/src/app/service-mesh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { services as controlPlanes } from '@/app/control-planes'
import { services as hostnameGenerators } from '@/app/hostname-generators'
import { Kri } from '@/app/kuma'
import { services as me } from '@/app/me'
import { services as meshIdentities } from '@/app/mesh-identities'
import { services as meshTrusts } from '@/app/mesh-trusts'
import { services as meshes } from '@/app/meshes'
import { services as resources } from '@/app/resources'
import { services as zones } from '@/app/zones'
Expand Down Expand Up @@ -136,6 +138,8 @@ export const services = (app: Record<string, Token>): ServiceDefinition[] => {
...zones(app),
...meshes(app),
...hostnameGenerators(app),
...meshIdentities(app),
...meshTrusts(app),
...resources(app),
]
}