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: Remove RouterLink from globals, its replaced by XAction #2873

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ const INLINE_NON_VOID_ELEMENTS = [
// HTML
'search',
// vue-router
'RouterLink',
'RouterView',
// @kong/kongponents
'K[A-Z].*',
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/TagList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
:appearance="tag.isKuma ? 'info' : 'neutral'"
>
<component
:is="tag.route ? 'RouterLink' : 'span'"
:is="tag.route ? 'XAction' : 'span'"
:to="tag.route"
>
{{ tag.label }}:<b>{{ tag.value }}</b>
Expand Down
6 changes: 3 additions & 3 deletions src/app/common/TargetRef.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<span class="target-ref">
<RouterLink
<XAction
v-if="routeTarget !== null"
:to="routeTarget"
>
<KBadge>
<slot />
</KBadge>
</RouterLink>
</XAction>

<KBadge v-else>
<slot />
Expand Down Expand Up @@ -46,7 +46,7 @@ const props = defineProps<{
targetRef: TargetRef
}>()

const routeTarget = computed<RouteLocationNamedRaw | null>(() => {
const routeTarget = computed<Omit<RouteLocationNamedRaw, 'query'> | null>(() => {
if (!props.targetRef.name) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@
@reg-exp-mode-change="route.update({ codeRegExp: $event })"
>
<template #primary-actions>
<KButton
<XAction
action="refresh"
appearance="primary"
@click="refresh"
>
<RefreshIcon />

Refresh
</KButton>
</XAction>
</template>
</CodeBlock>
</DataCollection>
Expand All @@ -53,8 +52,6 @@
</RouteView>
</template>
<script lang="ts" setup>
import { RefreshIcon } from '@kong/icons'

import CodeBlock from '@/app/common/code-block/CodeBlock.vue'
import type { DataplaneInbound } from '@/app/data-planes/data'
import type { ClustersDataSource } from '@/app/data-planes/sources'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
v-for="origin in item.origins"
:key="`${origin.mesh}-${origin.name}`"
>
<RouterLink
<XAction
v-if="types[origin.type]"
:to="{
name: 'policy-detail-view',
Expand All @@ -166,7 +166,7 @@
}"
>
{{ origin.name }}
</RouterLink>
</XAction>
<template
v-else
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@
@reg-exp-mode-change="route.update({ codeRegExp: $event })"
>
<template #primary-actions>
<KButton
<XAction
action="refresh"
appearance="primary"
@click="refresh"
>
<RefreshIcon />

Refresh
</KButton>
</XAction>
</template>
</CodeBlock>
</DataCollection>
Expand All @@ -58,8 +57,6 @@
</RouteView>
</template>
<script lang="ts" setup>
import { RefreshIcon } from '@kong/icons'

import { StatsSource } from '../sources'
import CodeBlock from '@/app/common/code-block/CodeBlock.vue'
import type { DataplaneInbound, DataplaneOverview } from '@/app/data-planes/data/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@
@reg-exp-mode-change="route.update({ codeRegExp: $event })"
>
<template #primary-actions>
<KButton
<XAction
action="refresh"
appearance="primary"
@click="refresh"
>
<RefreshIcon />

Refresh
</KButton>
</XAction>
</template>
</CodeBlock>
</DataCollection>
Expand All @@ -53,8 +52,6 @@
</RouteView>
</template>
<script lang="ts" setup>
import { RefreshIcon } from '@kong/icons'

import CodeBlock from '@/app/common/code-block/CodeBlock.vue'
import type { ClustersDataSource } from '@/app/data-planes/sources'
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,16 @@
v-for="service in [route.params.connection.replace(/-([a-f0-9]){16}$/, '')]"
:key="service"
>
<div
class="stack-with-borders"
>
<DefinitionCard
layout="horizontal"
>
<div class="stack-with-borders">
<DefinitionCard layout="horizontal">
<template #title>
Protocol
</template>

<template #body>
<KBadge
appearance="info"
>
{{ t(`http.api.value.${['grpc', 'http', 'tcp'].find(protocol => typeof props.data[protocol] !== 'undefined')}`) }}
<KBadge appearance="info">
{{ t(`http.api.value.${['grpc', 'http', 'tcp'].find(protocol => typeof props.data[protocol] !==
'undefined')}`) }}
</KBadge>
</template>
</DefinitionCard>
Expand All @@ -52,32 +47,24 @@
})"
v-slot="{ data: rulesData }"
>
<template
v-if="props.data.$resourceMeta.type !== ''"
>
<template v-if="props.data.$resourceMeta.type !== ''">
<DataCollection
:predicate="(item) => {
return item.resourceMeta.type === 'Mesh' || ruleForCluster(props.data, item)
}"
:items="rulesData.toResourceRules"
v-slot="{ items }"
>
<div
class="stack-with-borders mt-4"
>
<div class="stack-with-borders mt-4">
<template
v-for="(rules, key) in Object.groupBy(items, item => item.type)"
:key="key"
>
<div>
<PolicyTypeTag
:policy-type="key"
>
<PolicyTypeTag :policy-type="key">
{{ key }}
</PolicyTypeTag>
<div
class="stack-with-borders mt-4"
>
<div class="stack-with-borders mt-4">
<template
v-for="item in rules!.length > 1 ? rules!.filter(item => ruleForCluster(props.data, item)) : rules"
:key="item"
Expand Down Expand Up @@ -137,9 +124,7 @@
</div>
</DataCollection>
</template>
<template
v-else
>
<template v-else>
<DataCollection
:predicate="(item) => {
// for to rules we don't have inbound.port, filter out Routes
Expand All @@ -149,7 +134,6 @@
)
}"
:items="rulesData!.rules"

v-slot="{ items }"
>
<div class="mt-4">
Expand All @@ -165,16 +149,12 @@
<KCard>
<AccordionItem>
<template #accordion-header>
<PolicyTypeTag
:policy-type="key"
>
<PolicyTypeTag :policy-type="key">
{{ key }} ({{ rules!.length }})
</PolicyTypeTag>
</template>
<template #accordion-content>
<div
class="stack-with-borders"
>
<div class="stack-with-borders">
<template
v-for="item in rules"
:key="item"
Expand All @@ -188,7 +168,9 @@
</template>

<template #body>
<p><RuleMatchers :items="item.matchers" /></p>
<p>
<RuleMatchers :items="item.matchers" />
</p>
</template>
</DefinitionCard>
<DefinitionCard
Expand All @@ -205,7 +187,7 @@
v-for="origin in item.origins"
:key="`${origin.mesh}-${origin.name}`"
>
<RouterLink
<XAction
v-if="types[origin.type]"
:to="{
name: 'policy-detail-view',
Expand All @@ -217,7 +199,7 @@
}"
>
{{ origin.name }}
</RouterLink>
</XAction>
<template
v-else
>
Expand Down Expand Up @@ -280,9 +262,9 @@ const props = defineProps<{

const ruleForCluster = (cluster: any, rule: ResourceRule) => {
return cluster.$resourceMeta.name === rule.name &&
cluster.$resourceMeta.namespace === rule.namespace &&
cluster.$resourceMeta.zone === rule.zone &&
(rule.resourceSectionName === '' || cluster.$resourceMeta.port === rule.port)
cluster.$resourceMeta.namespace === rule.namespace &&
cluster.$resourceMeta.zone === rule.zone &&
(rule.resourceSectionName === '' || cluster.$resourceMeta.port === rule.port)
}
</script>
<style lang="scss" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@
@reg-exp-mode-change="route.update({ codeRegExp: $event })"
>
<template #primary-actions>
<KButton
<XAction
action="refresh"
appearance="primary"
@click="refresh"
>
<RefreshIcon />

Refresh
</KButton>
</XAction>
</template>
</CodeBlock>
</DataCollection>
Expand All @@ -53,8 +52,6 @@
</RouteView>
</template>
<script lang="ts" setup>
import { RefreshIcon } from '@kong/icons'

import { StatsSource } from '../sources'
import CodeBlock from '@/app/common/code-block/CodeBlock.vue'
import type { DataplaneOverview } from '@/app/data-planes/data/'
Expand Down
12 changes: 6 additions & 6 deletions src/app/data-planes/components/BuiltinGatewayPolicies.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
>
<span>{{ policy.type }}</span>:

<RouterLink
<XAction
:to="{
name: 'policy-detail-view',
params: {
Expand All @@ -23,7 +23,7 @@
}"
>
{{ policy.name }}
</RouterLink>
</XAction>
</li>
</ul>

Expand Down Expand Up @@ -58,7 +58,7 @@
<div class="dataplane-policy-header">
<div>
<div>
<b>Route</b>: <RouterLink
<b>Route</b>: <XAction
:to="{
name: 'policy-detail-view',
params: {
Expand All @@ -69,7 +69,7 @@
}"
>
{{ routeEntry.route.name }}
</RouterLink>
</XAction>
</div>

<div>
Expand Down Expand Up @@ -102,7 +102,7 @@
>
{{ policy.type }}:

<RouterLink
<XAction
:to="{
name: 'policy-detail-view',
params: {
Expand All @@ -113,7 +113,7 @@
}"
>
{{ policy.name }}
</RouterLink>
</XAction>
</li>
</ul>
</template>
Expand Down
Loading