diff --git a/packages/entities/entities-plugins/sandbox/pages/PluginSelectPage.vue b/packages/entities/entities-plugins/sandbox/pages/PluginSelectPage.vue index 0749368b81..b07aa92160 100644 --- a/packages/entities/entities-plugins/sandbox/pages/PluginSelectPage.vue +++ b/packages/entities/entities-plugins/sandbox/pages/PluginSelectPage.vue @@ -37,6 +37,14 @@ const konnectConfig = ref({ control_plane_id: controlPlaneId.value, plugin, }, + query: { + cancelRoute: JSON.stringify({ + name: 'select-plugin', + query: { + anchor: plugin, + }, + }), + }, }), // custom plugins createCustomRoute: { name: 'create-custom-plugin' }, diff --git a/packages/entities/entities-plugins/src/components/PluginForm.vue b/packages/entities/entities-plugins/src/components/PluginForm.vue index 1be426bd32..3b05de1e8e 100644 --- a/packages/entities/entities-plugins/src/components/PluginForm.vue +++ b/packages/entities/entities-plugins/src/components/PluginForm.vue @@ -150,7 +150,7 @@ import type { Tab } from '@kong/kongponents' import type { AxiosError, AxiosResponse } from 'axios' import { marked, type MarkedOptions } from 'marked' import { computed, onBeforeMount, reactive, ref, watch, type PropType } from 'vue' -import { useRouter } from 'vue-router' +import { useRoute, useRouter } from 'vue-router' import composables from '../composables' import { CREDENTIAL_METADATA, CREDENTIAL_SCHEMAS, PLUGIN_METADATA } from '../definitions/metadata' import { ArrayInputFieldSchema } from '../definitions/schemas/ArrayInputFieldSchema' @@ -276,6 +276,7 @@ const props = defineProps({ }) const router = useRouter() +const route = useRoute() const { i18n: { t } } = composables.useI18n() const { customSchemas, typedefs } = composables.useSchemas({ app: props.config.app, credential: props.credential }) const { formatPluginFieldLabel } = composables.usePluginHelpers() @@ -1101,7 +1102,10 @@ watch([entityMap, initialized], (newData, oldData) => { * --------------- */ const handleClickCancel = (): void => { - if (props.config.cancelRoute) { + if (route?.query?.cancelRoute) { + const cancelRoute = JSON.parse(route.query.cancelRoute as string) + router.push(cancelRoute) + } else if (props.config.cancelRoute) { router.push(props.config.cancelRoute) } else { emit('cancel') diff --git a/packages/entities/entities-plugins/src/components/PluginSelect.vue b/packages/entities/entities-plugins/src/components/PluginSelect.vue index 1acee0519a..67d9f35e0f 100644 --- a/packages/entities/entities-plugins/src/components/PluginSelect.vue +++ b/packages/entities/entities-plugins/src/components/PluginSelect.vue @@ -124,7 +124,7 @@ diff --git a/packages/entities/entities-plugins/src/components/select/PluginSelectCard.vue b/packages/entities/entities-plugins/src/components/select/PluginSelectCard.vue index d5f94b3a6f..60aa785701 100644 --- a/packages/entities/entities-plugins/src/components/select/PluginSelectCard.vue +++ b/packages/entities/entities-plugins/src/components/select/PluginSelectCard.vue @@ -1,5 +1,8 @@