mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-02 18:53:02 +00:00
fix: Formatted display of json content type (#219)
This commit is contained in:
parent
70df7605cb
commit
3ef790dc07
@ -23,7 +23,7 @@ limitations under the License. -->
|
||||
class="content mb-10"
|
||||
:readonly="true"
|
||||
v-else-if="item.label === 'content'"
|
||||
:value="currentLog[item.label]"
|
||||
:value="contentFormat(item.label)"
|
||||
/>
|
||||
<span v-else-if="item.label === 'tags'" class="g-sm-8 mb-10">
|
||||
<div v-for="(d, index) in logTags" :key="index">{{ d }}</div>
|
||||
@ -38,6 +38,7 @@ limitations under the License. -->
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { Option } from "@/types/app";
|
||||
import { dateFormat } from "@/utils/dateFormat";
|
||||
import { formatJson } from "@/utils/formatJson";
|
||||
|
||||
/*global defineProps */
|
||||
const props = defineProps({
|
||||
@ -53,6 +54,16 @@ limitations under the License. -->
|
||||
return `${d.key} = ${d.value}`;
|
||||
});
|
||||
});
|
||||
|
||||
function contentFormat(label: string) {
|
||||
try {
|
||||
return props.currentLog.contentType === "JSON"
|
||||
? formatJson(JSON.parse(props.currentLog[label]))
|
||||
: props.currentLog[label];
|
||||
} catch (e) {
|
||||
return props.currentLog[label];
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
|
Loading…
Reference in New Issue
Block a user