Skip to content

Commit 16e6708

Browse files
committed
fix(entities-plugins): improve playground, adjust objectfield style
1 parent a1ac8b0 commit 16e6708

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

Diff for: packages/entities/entities-plugins/sandbox/pages/PluginFormPlayground.vue

+14-6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ import type {
8484
import { PluginForm } from '../../src'
8585
import { PLUGIN_METADATA } from '../../src/definitions/metadata'
8686
87+
function save(type: 'pluginType' | 'schema', value: unknown) {
88+
localStorage.setItem(`plugin-form-playground:${type}`, JSON.stringify(value))
89+
}
90+
91+
function load(type: 'pluginType' | 'schema', defaultValue?: unknown) {
92+
const stored = localStorage.getItem(`plugin-form-playground:${type}`)
93+
return stored ? JSON.parse(stored) : defaultValue
94+
}
95+
8796
const router = useRouter()
8897
const controlPlaneId = import.meta.env.VITE_KONNECT_CONTROL_PLANE_ID || ''
8998
@@ -95,8 +104,7 @@ const pluginTypes = [
95104
})),
96105
].sort((a, b) => a.label.localeCompare(b.label))
97106
98-
const storedPluginType =
99-
localStorage.getItem('plugin-form-playground:pluginType') || ''
107+
const storedPluginType = load('pluginType', '')
100108
const pluginType = ref<string>(
101109
pluginTypes.find(({ value }) => value === storedPluginType)
102110
? storedPluginType
@@ -108,8 +116,8 @@ const defaultSchema = {
108116
}
109117
const schemaOpen = ref(false)
110118
111-
const storedSchema = localStorage.getItem('plugin-form-playground:schema')
112-
const schemaText = ref(storedSchema || JSON.stringify(defaultSchema, null, 2))
119+
const storedSchema = load('schema', JSON.stringify(defaultSchema, null, 2))
120+
const schemaText = ref(storedSchema)
113121
114122
watch(schemaOpen, async (open) => {
115123
if (open) {
@@ -170,13 +178,13 @@ const onUpdate = (payload: Record<string, any>) => {
170178
}
171179
172180
watch(pluginType, () => {
173-
localStorage.setItem('plugin-form-playground:pluginType', pluginType.value)
181+
save('pluginType', pluginType.value)
174182
})
175183
176184
watch(schemaText, () => {
177185
renderError.value = ''
178186
179-
localStorage.setItem('plugin-form-playground:schema', schemaText.value)
187+
save('schema', schemaText.value)
180188
})
181189
182190
onErrorCaptured((error) => {

Diff for: packages/entities/entities-plugins/src/components/free-form/RequestCallout/ConfigForm.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import CacheForm from './CacheForm.vue'
1717
1818
const props = defineProps<{
1919
schema: Record<string, any>
20-
data: RequestCallout
20+
data?: RequestCallout
2121
}>()
2222
2323
const schemaHelpers = useSchemaHelpers(() => props.schema)

Diff for: packages/entities/entities-plugins/src/components/free-form/shared/ObjectField.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ watch(realAdded, (value) => {
120120
flex-direction: column;
121121
gap: $kui-space-80;
122122
margin-top: $kui-space-20;
123-
padding: $kui-space-60 $kui-space-40 $kui-space-20;
123+
padding: $kui-space-60 $kui-space-40 $kui-space-20 $kui-space-60;
124124
}
125125
126126
:deep(.k-tooltip p) {

0 commit comments

Comments
 (0)