Skip to content

Commit 7d885a3

Browse files
committed
chore: removed field example logic from frontend
1 parent 76225a9 commit 7d885a3

7 files changed

Lines changed: 1 addition & 82 deletions

File tree

frontend/src/modules/events/components/EventDetailsCard.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@ import { Button } from '@/shared/ui/button'
66
import { Badge } from '@/shared/ui/badge'
77
import { Icon } from '@iconify/vue'
88
import EventFieldsTable from './EventFieldsTable.vue'
9-
import JsonPreview from '@/shared/components/JsonPreview.vue'
109
import DetailsCardLayout from '@/shared/components/layout/DetailsCardLayout.vue'
1110
import DetailsCardAttribute from '@/shared/components/layout/DetailsCardAttribute.vue'
1211
import { getEventFieldsColumns } from '@/modules/events/components/eventFieldsColumns'
1312
import TagScrollArea from '@/modules/tags/components/TagScrollArea.vue'
14-
import { useEventExample } from '@/modules/events/composables/useEventExample'
1513
import EventLinks from '@/modules/events/components/EventLinks.vue'
1614
1715
const props = defineProps<{
1816
event: Event
1917
}>()
2018
21-
const eventExample = useEventExample(props.event.fields)
22-
2319
const emit = defineEmits<{
2420
(e: 'edit'): void
2521
(e: 'delete'): void
@@ -79,13 +75,6 @@ const columns = getEventFieldsColumns()
7975
</template>
8076
</DetailsCardAttribute>
8177

82-
<!-- Example -->
83-
<DetailsCardAttribute class="hidden sm:flex" icon="radix-icons:file-text" label="Example">
84-
<template #value>
85-
<JsonPreview :value="eventExample" />
86-
</template>
87-
</DetailsCardAttribute>
88-
8978
<!-- Links -->
9079
<DetailsCardAttribute
9180
v-if="event.links && event.links.length > 0"

frontend/src/modules/events/components/SwaggerExportModal.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const props = defineProps<{
2424
2525
const settings = reactive({
2626
includeDescriptions: true,
27-
includeExamples: true,
2827
additionalProperties: true,
2928
format: 'yaml' as 'yaml' | 'json',
3029
})
@@ -37,7 +36,6 @@ const { isLoading, refetch } = useQuery({
3736
queryFn: async () => {
3837
const params = {
3938
include_descriptions: settings.includeDescriptions,
40-
include_examples: settings.includeExamples,
4139
additional_properties: settings.additionalProperties,
4240
}
4341
const format = settings.format
@@ -100,11 +98,6 @@ watch(
10098
<Switch id="includeDescriptions" v-model="settings.includeDescriptions" />
10199
</div>
102100

103-
<div class="flex items-center justify-between">
104-
<Label for="includeExamples">Include examples</Label>
105-
<Switch id="includeExamples" v-model="settings.includeExamples" />
106-
</div>
107-
108101
<div class="flex items-center justify-between">
109102
<Label for="additionalProperties">Allow additional properties</Label>
110103
<Switch id="additionalProperties" v-model="settings.additionalProperties" />

frontend/src/modules/events/composables/useEventExample.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

frontend/src/modules/fields/components/FieldDetailsCard.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import type { Field } from '@/modules/fields/types'
33
import { Button } from '@/shared/ui/button'
44
import { Icon } from '@iconify/vue'
5-
import JsonPreview from '@/shared/components/JsonPreview.vue'
65
import DetailsCardLayout from '@/shared/components/layout/DetailsCardLayout.vue'
76
import DetailsCardAttribute from '@/shared/components/layout/DetailsCardAttribute.vue'
87
import FieldTypeBadge from '@/modules/fields/components/FieldTypeBadge.vue'
@@ -34,12 +33,6 @@ const emit = defineEmits(['edit-clicked', 'delete-clicked'])
3433
<template #attributes>
3534
<DetailsCardAttribute icon="radix-icons:id-card" label="ID" :value="field.id.toString()" />
3635

37-
<DetailsCardAttribute v-if="field.example" icon="radix-icons:file-text" label="Example">
38-
<template #value>
39-
<JsonPreview :value="field.example" />
40-
</template>
41-
</DetailsCardAttribute>
42-
4336
<DetailsCardAttribute icon="radix-icons:bar-chart" label="Used in">
4437
<template #value>
4538
{{ `${field.event_count || 0} events` }}

frontend/src/modules/fields/types.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,11 @@ export enum FieldType {
77
OBJECT = 'object',
88
}
99

10-
type FieldExampleMap = {
11-
[FieldType.STRING]: string
12-
[FieldType.INTEGER]: number
13-
[FieldType.NUMBER]: number
14-
[FieldType.BOOLEAN]: boolean
15-
[FieldType.ARRAY]: unknown[]
16-
[FieldType.OBJECT]: Record<string, unknown>
17-
}
18-
19-
export type JsonValue =
20-
| string
21-
| number
22-
| boolean
23-
| null
24-
| JsonValue[]
25-
| { [key: string]: JsonValue }
26-
2710
export type Field = {
2811
id: number
2912
name: string
3013
description: string | null
3114
field_type: FieldType
32-
example: JsonValue
3315
created_at: string
3416
updated_at: string
3517
event_count?: number
@@ -39,12 +21,10 @@ export type FieldFormData = {
3921
name: string
4022
description?: string | null
4123
field_type: FieldType
42-
example?: FieldExampleMap[FieldType]
4324
}
4425

4526
export type FieldValidationErrors = {
4627
name?: string[]
4728
description?: string[]
4829
field_type?: string[]
49-
example?: string[]
5030
}

frontend/src/modules/fields/validation/fieldSchema.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@ export const fieldSchema = z.object({
1111
.nullable(),
1212

1313
field_type: z.nativeEnum(FieldType),
14-
15-
example: z
16-
.custom(val => {
17-
if (val === null || val === undefined) return true
18-
try {
19-
if (typeof val === 'string') JSON.parse(val)
20-
return true
21-
} catch {
22-
return false
23-
}
24-
}, 'Example must be valid JSON')
25-
.optional()
26-
.nullable(),
2714
})
2815

2916
// Inferred TypeScript type from schema

frontend/src/modules/switchboard/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export interface ImportBundle {
99
fields: {
1010
name: string
1111
description?: string | null
12-
field_type: string // could use enum if available
13-
example?: unknown
12+
field_type: string
1413
}[]
1514

1615
events: {

0 commit comments

Comments
 (0)