Skip to content

Commit

Permalink
chore(*): update entity docs link
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Sep 8, 2023
1 parent 62dd4a3 commit 76da8a8
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 21 deletions.
19 changes: 9 additions & 10 deletions src/composables/useDocsLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ import { formatVersion } from '@/utils'
import { config } from 'config'

export const useDocsLink = (entity: string) => {
const edition = config.GATEWAY_EDITION ?? 'community'
const version = computed(() => {
if (!config.GATEWAY_VERSION) {
return 'latest'
}

return `${formatVersion(config.GATEWAY_VERSION)}.x`
return edition === 'enterprise'
// For Enterprise, the version has a pattern of <major>.<minor>.0.x where the 3rd digit
// will always be 0 regardless of the actual patch version
? `${formatVersion(config.GATEWAY_VERSION)}.0.x`
// For OSS, the version has a pattern of <major>.<minor>.x
: `${formatVersion(config.GATEWAY_VERSION)}.x`
})

const docsBase = computed(() => `https://docs.konghq.com/gateway/${version.value}/admin-api`)
const docsLink = computed(() => {
switch (entity) {
case 'key-set':
return `${docsBase.value}/#key-sets-entity`
default:
return `${docsBase.value}/#${entity}-object`
}
})
const docsBase = computed(() => `https://docs.konghq.com/gateway/api/admin-${edition === 'enterprise' ? 'ee' : 'oss'}/${version.value}/#/`)
const docsLink = computed(() => `${docsBase.value}${entity}`)

return docsLink
}
2 changes: 1 addition & 1 deletion src/pages/ca-certificates/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('ca-certificate')
const docsLink = useDocsLink('CA Certificates')
const createRoute = computed(() => {
return { name: 'ca-certificate-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/certificates/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('certificate')
const docsLink = useDocsLink('Certificates')
const createRoute = computed(() => {
return { name: 'certificate-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/consumers/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('consumer')
const docsLink = useDocsLink('Consumers')
const createRoute = computed(() => {
return { name: 'consumer-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/key-sets/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('key-set')
const docsLink = useDocsLink('Key-sets')
const filterSchema = computed<FilterSchema>(() => {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/keys/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const route = useRoute()
const { t } = useI18n()
const docsLink = useDocsLink('keys')
const docsLink = useDocsLink('Keys')
const keySetId = computed(() => (route.params?.id ?? '') as string)
const cacheIdentifier = computed(() => `routes-${keySetId.value}`)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/plugins/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('plugin')
const docsLink = useDocsLink('Plugins')
const route = useRoute()
const cacheIdentifier = computed(() => `plugins-${route.params?.id}`)
const entityType = computed(() => route.meta?.scopedIn as EntityType)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/routes/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defineOptions({ name: 'RouteList' })
const toaster = useToaster()
const route = useRoute()
const { t } = useI18n()
const docsLink = useDocsLink('route')
const docsLink = useDocsLink('Routes')
const { createRedirectRouteQuery } = useListRedirect()
const serviceId = computed(() => (route.params?.id ?? '') as string)
Expand Down
2 changes: 1 addition & 1 deletion src/pages/services/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('service')
const docsLink = useDocsLink('Services')
const createRoute = computed(() => {
return { name: 'service-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/snis/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('sni')
const docsLink = useDocsLink('SNIs')
const createRoute = computed(() => {
return { name: 'sni-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/upstreams/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('upstream')
const docsLink = useDocsLink('Upstreams')
const createRoute = computed(() => {
return { name: 'upstream-create' }
Expand Down
2 changes: 1 addition & 1 deletion src/pages/vaults/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ defineOptions({
const { createRedirectRouteQuery } = useListRedirect()
const toaster = useToaster()
const { t } = useI18n()
const docsLink = useDocsLink('vaults')
const docsLink = useDocsLink('Vaults')
const createRoute = computed(() => {
return { name: 'vault-create' }
Expand Down

0 comments on commit 76da8a8

Please sign in to comment.