Skip to content

Commit

Permalink
chore: Several small cleanup amends around K named components
Browse files Browse the repository at this point in the history
Signed-off-by: John Cowen <[email protected]>
  • Loading branch information
johncowen committed Jan 22, 2025
1 parent f80108f commit 000f12b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 79 deletions.
8 changes: 2 additions & 6 deletions packages/kuma-gui/docs/1-tldr.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,15 @@ For more detail see:
## GUI Components

Apart from our `Data*` components we also have a set of `X*` components which
are generic GUI specific components. We also use the
[Kongponents](https://kongponents.konghq.com/) component library which
use `K*` a naming scheme.
are generic GUI specific components.

These 'x' components are generally 'thin wrappers' over either native Vue
components or Kongponents to make them easier to work with.

We globally import our generic GUI `X*`, our `Data*` components and `K*`
[Kongponents](https://kongponents.konghq.com/)
We globally import our generic GUI `X*` and our `Data*` components.

Links:

- K\* Kongponents <https://kongponents.konghq.com/>
- X\* components [These docs](/src/app/x/README)
- Data\* Components [These docs](/src/app/application/components/data-source/README)
- Design Tokens from <https://github.com/Kong/design-tokens>
Expand Down
74 changes: 23 additions & 51 deletions packages/kuma-gui/src/app/data-planes/views/DataPlaneDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
</template>

<template #body>
<div class="status-with-reason">
<XLayout
type="separated"
>
<StatusBadge :status="props.data.status" />
<DataCollection
v-if="props.data.dataplaneType === 'standard'"
Expand All @@ -62,26 +64,20 @@
:empty="false"
v-slot="{ items : unhealthyInbounds }"
>
<KTooltip
class="reason-tooltip"
<XIcon
name="info"
>
<InfoIcon
:color="KUI_COLOR_BACKGROUND_NEUTRAL"
:size="KUI_ICON_SIZE_30"
/>
<template #content>
<ul>
<li
v-for="inbound in unhealthyInbounds"
:key="`${inbound.service}:${inbound.port}`"
>
{{ t('data-planes.routes.item.unhealthy_inbound', { service: inbound.service, port: inbound.port }) }}
</li>
</ul>
</template>
</KTooltip>
<ul>
<li
v-for="inbound in unhealthyInbounds"
:key="`${inbound.service}:${inbound.port}`"
>
{{ t('data-planes.routes.item.unhealthy_inbound', { service: inbound.service, port: inbound.port }) }}
</li>
</ul>
</XIcon>
</DataCollection>
</div>
</XLayout>
</template>
</DefinitionCard>

Expand Down Expand Up @@ -176,12 +172,10 @@
>
<ConnectionTraffic>
<template #title>
<ForwardIcon
display="inline-block"
decorative
:size="KUI_ICON_SIZE_30"
/>
Inbounds
<XLayout type="separated">
<XIcon name="inbound" />
<span>Inbounds</span>
</XLayout>
</template>
<!-- if we are a builtin gateway proxy i.e. a 'gateway' proxy -->
<!-- use its first and only inbounds as a template -->
Expand Down Expand Up @@ -306,12 +300,10 @@
</XAction>
</template>
<template #title>
<GatewayIcon
display="inline-block"
decorative
:size="KUI_ICON_SIZE_30"
/>
<span>Outbounds</span>
<XLayout type="separated">
<XIcon name="outbound" />
<span>Outbounds</span>
</XLayout>
</template>
<!-- we don't want to show an error here -->
<!-- instead we show a No Data EmptyState -->
Expand Down Expand Up @@ -589,8 +581,6 @@
</template>

<script lang="ts" setup>
import { KUI_COLOR_BACKGROUND_NEUTRAL, KUI_ICON_SIZE_30 } from '@kong/design-tokens'
import { InfoIcon, ForwardIcon, GatewayIcon } from '@kong/icons'
import { computed } from 'vue'
import type { DataplaneOverview, DataplaneInbound } from '../data'
Expand Down Expand Up @@ -640,22 +630,4 @@ const warnings = computed(() => props.data.warnings.concat(...(props.data.isCert
background: none;
}
}
.status-with-reason {
display: flex;
align-items: center;
gap: $kui-space-50;
}
.reason-tooltip :deep(.kong-icon) {
display: flex;
align-items: center;
}
.inbound-list > * + * {
border: 1px solid red;
margin-block-start: $kui-space-60;
border-top: $kui-border-width-10 solid $kui-color-border;
padding-block-start: $kui-space-60;
}
</style>
4 changes: 2 additions & 2 deletions packages/kuma-gui/src/app/kuma/views/KumaNotFoundView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
<AppView>
<div class="overview">
<KEmptyState>
<XEmptyState>
<template #icon>
<XIcon
name="warning"
Expand All @@ -30,7 +30,7 @@
Go Home
</XAction>
</template>
</KEmptyState>
</XEmptyState>
</div>
</AppView>
</RouteView>
Expand Down
4 changes: 3 additions & 1 deletion packages/kuma-gui/src/app/x/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ section: Packages
Our application level UI components.

These 'x' components are generally 'thin wrappers' over either native Vue
components or Kongponents to make them easier to work with.
components or [Kongponents](https://kongponents.konghq.com/) to make them
easier to work with.


For example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
class="x-empty-state"
data-testid="empty-block"
>
<template
#icon
>
<slot name="icon" />
</template>
<template
#title
>
Expand Down
5 changes: 5 additions & 0 deletions packages/kuma-gui/src/app/x/components/x-icon/XIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<component
:is="slots.default ? KTooltip : XAnonymous"
:placement="props.placement"
max-width="400"
>
<!-- we hardcode decorative to false for the moment due to an issue with kong/icons -->
<component
Expand Down Expand Up @@ -31,6 +32,8 @@
<script lang="ts" setup>
import { KUI_ICON_SIZE_30 } from '@kong/design-tokens'
import {
ForwardIcon,
GatewayIcon,
WarningIcon,
PortalIcon,
MeshIcon,
Expand Down Expand Up @@ -62,6 +65,8 @@ const attrs = useAttrs()
const icons = {
standard: 'span',
'policy-role-producer': 'span',
inbound: ForwardIcon,
outbound: GatewayIcon,
builtin: PortalIcon,
delegated: PortalIcon,
warning: WarningIcon,
Expand Down
24 changes: 5 additions & 19 deletions packages/kuma-gui/src/app/zones/views/ZoneDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,13 @@
<template
v-if="version?.outdated === true"
>
<KTooltip
max-width="300"
<XIcon
name="info"
>
<InfoIcon
:color="KUI_COLOR_BACKGROUND_NEUTRAL"
:size="KUI_ICON_SIZE_30"
<div
v-html="t('zone-cps.routes.item.version_warning')"
/>
<template #content>
<div
v-html="t('zone-cps.routes.item.version_warning')"
/>
</template>
</KTooltip>
</XIcon>
</template>
</XLayout>
</template>
Expand Down Expand Up @@ -206,9 +200,6 @@
</template>

<script lang="ts" setup>
import { KUI_COLOR_BACKGROUND_NEUTRAL, KUI_ICON_SIZE_30 } from '@kong/design-tokens'
import { InfoIcon } from '@kong/icons'
import type { ZoneOverview } from '../data'
import AppCollection from '@/app/application/components/app-collection/AppCollection.vue'
import DefinitionCard from '@/app/common/DefinitionCard.vue'
Expand All @@ -220,8 +211,3 @@ const props = defineProps<{
data: ZoneOverview
}>()
</script>
<style lang="scss" scoped>
.version.outdated :deep(.definition-card-container) {
color: #{$kui-color-text-warning};
}
</style>

0 comments on commit 000f12b

Please sign in to comment.