Skip to content

Commit 62d3b46

Browse files
authored
fix(entities-plugins): missing of action buttons [KM-547] (#1664)
1 parent e51eabf commit 62d3b46

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

packages/entities/entities-plugins/src/components/PluginForm.vue

+6-18
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,11 @@
5454
/>
5555

5656
<template #form-actions>
57-
<div
58-
:id="`plugin-form-default-actions-container-${(config as KongManagerPluginFormConfig).workspace || (config as KonnectPluginFormConfig).controlPlaneId}`"
59-
ref="actionsDivRef"
60-
/>
61-
6257
<!-- if isWizardStep is true we don't want any buttons displayed (default EntityBaseForm buttons included) -->
63-
<Teleport
64-
v-if="!isWizardStep && mounted"
65-
:to="actionsTeleportTarget ? actionsTeleportTarget : `#plugin-form-default-actions-container-${(config as KongManagerPluginFormConfig).workspace || (config as KonnectPluginFormConfig).controlPlaneId}`"
58+
<div v-if="isWizardStep" />
59+
<PluginFormActionsWrapper
60+
v-else
61+
:teleport-target="actionsTeleportTarget"
6662
>
6763
<div class="plugin-form-actions">
6864
<KButton
@@ -93,7 +89,7 @@
9389
{{ t('actions.save') }}
9490
</KButton>
9591
</div>
96-
</Teleport>
92+
</PluginFormActionsWrapper>
9793
</template>
9894
</EntityBaseForm>
9995

@@ -172,6 +168,7 @@ import {
172168
type PluginOrdering,
173169
} from '../types'
174170
import PluginEntityForm from './PluginEntityForm.vue'
171+
import PluginFormActionsWrapper from './PluginFormActionsWrapper.vue'
175172
176173
const emit = defineEmits<{
177174
(e: 'cancel'): void,
@@ -307,7 +304,6 @@ const treatAsCredential = computed((): boolean => !!(props.credential && props.c
307304
const record = ref<Record<string, any> | null>(null)
308305
const configResponse = ref<Record<string, any>>({})
309306
const formLoading = ref(false)
310-
const actionsDivRef = ref<HTMLDivElement | null>(null)
311307
const formFieldsOriginal = reactive<PluginFormFields>({
312308
enabled: true,
313309
protocols: [],
@@ -1237,14 +1233,6 @@ const schemaUrl = computed((): string => {
12371233
return url
12381234
})
12391235
1240-
// track when the actions div is mounted for Teleport
1241-
const mounted = ref(false)
1242-
watch(actionsDivRef, (newVal) => {
1243-
if (newVal) {
1244-
mounted.value = true
1245-
}
1246-
})
1247-
12481236
const credentialType = ref('')
12491237
const schemaLoading = ref(false)
12501238
const fetchSchemaError = ref('')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<Teleport
3+
v-if="teleportTarget"
4+
:to="teleportTarget"
5+
>
6+
<slot />
7+
</Teleport>
8+
<div v-else>
9+
<slot />
10+
</div>
11+
</template>
12+
13+
<script setup lang="ts">
14+
defineProps({
15+
teleportTarget: {
16+
type: String,
17+
default: '',
18+
},
19+
})
20+
</script>

0 commit comments

Comments
 (0)