-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(redis): list and detail components
- Loading branch information
Showing
25 changed files
with
958 additions
and
179 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
9 changes: 0 additions & 9 deletions
9
packages/entities/entities-redis-configurations/sandbox/pages/HomePage.vue
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
packages/entities/entities-redis-configurations/sandbox/pages/RedisConfigurationDetail.vue
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,39 @@ | ||
<template> | ||
<h2>Konnect API</h2> | ||
<RedisConfigurationConfigCard | ||
:config="konnectConfig" | ||
/> | ||
|
||
<h2>Kong Manager API</h2> | ||
<RedisConfigurationConfigCard | ||
:config="kongManagerConfig" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useRoute } from 'vue-router' | ||
import { RedisConfigurationConfigCard } from '../../src' | ||
import type { | ||
KonnectRedisConfigurationEntityConfig, | ||
KongManagerRedisConfigurationEntityConfig, | ||
} from '../../src' | ||
const route = useRoute() | ||
const controlPlaneId = import.meta.env.VITE_KONNECT_CONTROL_PLANE_ID || '' | ||
const konnectConfig: KonnectRedisConfigurationEntityConfig = { | ||
app: 'konnect', | ||
apiBaseUrl: '/us/kong-api', | ||
controlPlaneId, | ||
entityId: route.params.id as string, | ||
} | ||
const kongManagerConfig: KongManagerRedisConfigurationEntityConfig = { | ||
app: 'kongManager', | ||
workspace: 'default', | ||
apiBaseUrl: '/kong-manager', // For local dev server proxy | ||
entityId: route.params.id as 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
61 changes: 61 additions & 0 deletions
61
packages/entities/entities-redis-configurations/src/components/LinkedPluginList.vue
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,61 @@ | ||
<template> | ||
<KTableData | ||
:fetcher="fetcher" | ||
:headers="headers" | ||
:pagination-attributes="{ totalCount: tableData.length, disablePageJump: true }" | ||
> | ||
<template #name="{ rowValue }"> | ||
<PluginName :plugin-name="rowValue" /> | ||
</template> | ||
|
||
<template #action-items="{ row }"> | ||
<KDropdownItem @click="() => $emit('view-plugin', row.id)"> | ||
{{ t('actions.view_plugin') }} | ||
</KDropdownItem> | ||
</template> | ||
</KTableData> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import composables from '../composables' | ||
import PluginName from './PluginItem.vue' | ||
import type { TableViewHeader } from '@kong/kongponents/dist/types' | ||
import type { RedisConfigurationLinkedPlugin } from '../types' | ||
defineProps({ | ||
redisConfigurationId: { | ||
type: String, | ||
required: true, | ||
}, | ||
}) | ||
defineEmits<{ | ||
(e: 'view-plugin', pluginId: string): void | ||
}>() | ||
const { i18n: { t } } = composables.useI18n() | ||
const headers: TableViewHeader[] = [ | ||
{ key: 'name', label: t('linked_plugins_modal.headers.plugin') }, | ||
{ key: 'actions', hideLabel: true }, | ||
] | ||
const tableData: RedisConfigurationLinkedPlugin[] = [ | ||
{ name: 'rate-limiting-advanced', instance_name: 'my-rla-1', id: '90ffda46-273c-4c20-8ad5-2b7a169c1818' }, | ||
{ name: 'rate-limiting', instance_name: 'my-rla-1', id: '62dc8be8-c75a-4211-ad41-ff4f3b6caacb' }, | ||
] | ||
const fetcher = async (): Promise<any> => { | ||
// const { rows } = tableData.value | ||
// isLoading.value = false | ||
await new Promise((resolve) => setTimeout(resolve, 1000)) | ||
return { | ||
total: Number(tableData.length) || 0, | ||
data: tableData, | ||
} | ||
} | ||
</script> |
74 changes: 74 additions & 0 deletions
74
packages/entities/entities-redis-configurations/src/components/LinkedPluginListModal.vue
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,74 @@ | ||
<template> | ||
<div class="linked-plugins-modal"> | ||
<KModal | ||
:action-button-text="t('actions.done')" | ||
hide-cancel-button | ||
:title="title" | ||
:visible="visible" | ||
@cancel="cancel" | ||
@proceed="proceed" | ||
> | ||
<LinkedPluginList | ||
:redis-configuration-id="redisConfigurationId" | ||
@view-plugin="($event) => emit('view-plugin', $event)" | ||
/> | ||
</KModal> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import composables from '../composables' | ||
import LinkedPluginList from './LinkedPluginList.vue' | ||
defineProps({ | ||
redisConfigurationId: { | ||
type: String, | ||
required: true, | ||
}, | ||
visible: { | ||
type: Boolean, | ||
required: true, | ||
default: false, | ||
}, | ||
}) | ||
const emit = defineEmits<{ | ||
(e: 'cancel'): void | ||
(e: 'proceed'): void | ||
(e: 'view-plugin', pluginId: string): void | ||
}>() | ||
const { i18n: { t } } = composables.useI18n() | ||
const title = computed(() => t('linked_plugins_modal.title', { count: 100 })) | ||
const cancel = () => { | ||
emit('cancel') | ||
} | ||
const proceed = () => { | ||
emit('proceed') | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.linked-plugins-modal { | ||
:deep(.k-table-view) { | ||
background-color: transparent; | ||
} | ||
:deep(.modal-container) { | ||
min-width: 640px; | ||
} | ||
} | ||
@media (max-width: $kui-breakpoint-mobile) { | ||
.linked-plugins-modal { | ||
:deep(.modal-container) { | ||
min-width: 100%; | ||
} | ||
} | ||
} | ||
</style> |
28 changes: 28 additions & 0 deletions
28
packages/entities/entities-redis-configurations/src/components/LinkedPluginsInline.vue
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,28 @@ | ||
<template> | ||
<div class="linked-plugins"> | ||
<PluginIcon | ||
name="rate-limiting-advanced" | ||
:size="24" | ||
/> | ||
<PluginIcon | ||
name="rate-limiting" | ||
:size="24" | ||
/> | ||
<KBadge appearance="info"> | ||
+5 | ||
</KBadge> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { PluginIcon } from '@kong-ui-public/entities-plugins' | ||
</script> | ||
|
||
|
||
<style scoped lang="scss"> | ||
.linked-plugins { | ||
display: flex; | ||
gap: $kui-space-40; | ||
} | ||
</style> |
28 changes: 28 additions & 0 deletions
28
packages/entities/entities-redis-configurations/src/components/PluginItem.vue
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,28 @@ | ||
<template> | ||
<div class="plugin-item"> | ||
<PluginIcon | ||
:name="pluginName" | ||
:size="24" | ||
/> | ||
<span>{{ pluginName }}</span> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { PluginIcon } from '@kong-ui-public/entities-plugins' | ||
defineProps({ | ||
pluginName: { | ||
type: String, | ||
required: true, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.plugin-item { | ||
align-items: center; | ||
display: flex; | ||
gap: $kui-space-40; | ||
} | ||
</style> |
Oops, something went wrong.