* WIP for using json all the time * Updates to render * adds a new component for json * Updates styles * Adds nesting * Adds field list * Adds expanding * Adds new composable for event source * Creates an add button * Removes unused code * Adds and removes fields with defaults * Fixes jumping when adding new fields * Returns JSON correctly * Fixes little bugs * Fixes js tests * Adds vscode * Fixes json buffer error * Fixes extra line * Fixes tests * Fixes tests and adds support for search * Refactors visible payload keys to a composable * Fixes typescript errors and refactors * Fixes visible keys by ComputedRef<Ref> * Fixes search bugs * Updates tests * Fixes go tests * Fixes scroll view * Fixes vue tsc errors * Fixes EOF error * Fixes build error * Uses application/ld+json * Fixes arrays and records * Marks for json too
56 lines
1.3 KiB
Vue
56 lines
1.3 KiB
Vue
<template>
|
|
<ul class="fields" @click="expanded = !expanded">
|
|
<li v-for="(value, name) in logEntry.payload">
|
|
<template v-if="value">
|
|
<span class="has-text-grey">{{ name }}=</span>
|
|
<span class="has-text-weight-bold" v-html="markSearch(value)"></span>
|
|
</template>
|
|
</li>
|
|
</ul>
|
|
<field-list :fields="logEntry.unfilteredPayload" :expanded="expanded" :visible-keys="visibleKeys"></field-list>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { useSearchFilter } from "@/composables/search";
|
|
import { VisibleLogEntry } from "@/types/VisibleLogEntry";
|
|
|
|
import { PropType, ref } from "vue";
|
|
|
|
const { markSearch } = useSearchFilter();
|
|
|
|
defineProps({
|
|
logEntry: {
|
|
type: Object as PropType<VisibleLogEntry>,
|
|
required: true,
|
|
},
|
|
visibleKeys: {
|
|
type: Array as PropType<string[][]>,
|
|
default: [],
|
|
},
|
|
});
|
|
|
|
const expanded = ref(false);
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.fields {
|
|
display: inline-block;
|
|
list-style: none;
|
|
|
|
&:hover {
|
|
cursor: pointer;
|
|
&::after {
|
|
content: "expand json";
|
|
color: var(--secondary-color);
|
|
display: inline-block;
|
|
margin-left: 0.5em;
|
|
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
|
}
|
|
}
|
|
|
|
li {
|
|
display: inline-block;
|
|
margin-left: 1em;
|
|
}
|
|
}
|
|
</style>
|