Skip to content

Commit

Permalink
feat(log-query): support display json field (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzdong authored Dec 31, 2024
1 parent 93e849d commit 9bacfe8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/views/dashboard/logs/query/FormView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@ a-descriptions(layout="vertical" bordered :column="1")
<script setup name="FormView" type="ts">
import useLogQueryStore from '@/store/modules/logquery';
const displayValue = (val, type) => {
switch (type) {
case 'json':
return JSON.stringify(val, null, 2)
default:
return val
}
}
const props = defineProps(['data'])
const { columns } = storeToRefs(useLogQueryStore())
const formData = computed(() => {
return Object.keys(props.data).filter((v) => v !== 'key').map((v) => {
const columnType = columns.value.filter(c => c.name === v)[0]?.data_type;
return {
label: v,
type: columns.value.filter(c => c.name === v)[0]?.data_type,
value: props.data[v]
type: columnType,
value: displayValue(props.data[v], columnType)
}
})
})
Expand Down

0 comments on commit 9bacfe8

Please sign in to comment.