support self-check
This commit is contained in:
parent
13673d798b
commit
8a6d555da1
@ -7,25 +7,27 @@
|
|||||||
<div class="item-desc">{{ props.dataView.tool.description }}</div>
|
<div class="item-desc">{{ props.dataView.tool.description }}</div>
|
||||||
|
|
||||||
<div v-if="props.dataView.function !== undefined" class="item-result">
|
<div v-if="props.dataView.function !== undefined" class="item-result">
|
||||||
<span class="item-label">Function</span>
|
<div class="item-label">Function</div>
|
||||||
<pre class="item-json">{{ props.dataView.function.name }}</pre>
|
<div class="item-json">{{ props.dataView.function.name }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="props.dataView.function !== undefined" class="item-result">
|
||||||
<span class="item-label">Arguments</span>
|
<span class="item-label">Arguments</span>
|
||||||
<pre class="item-json">{{ formatJson(props.dataView.function.arguments) }}</pre>
|
<json-render :json="props.dataView.function.arguments" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="props.dataView.result !== undefined" class="item-result">
|
<div v-if="props.dataView.result !== undefined" class="item-result">
|
||||||
<span class="item-label">Result</span>
|
<span class="item-label">Result</span>
|
||||||
<template v-if="Array.isArray(props.dataView.result)">
|
<template v-if="Array.isArray(props.dataView.result)">
|
||||||
<div
|
<div v-for="(item, idx) in props.dataView.result" :key="idx" class="result-block"
|
||||||
v-for="(item, idx) in props.dataView.result"
|
:class="[props.dataView.status]">
|
||||||
:key="idx"
|
<pre class="item-json"
|
||||||
class="result-block"
|
v-if="typeof item === 'object' && item.text !== undefined">{{ item.text }}</pre>
|
||||||
>
|
|
||||||
<pre class="item-json" v-if="typeof item === 'object' && item.text !== undefined">{{ item.text }}</pre>
|
|
||||||
<pre class="item-json" v-else>{{ formatJson(item) }}</pre>
|
<pre class="item-json" v-else>{{ formatJson(item) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<pre class="item-json" v-else-if="typeof props.dataView.result === 'string'">{{ props.dataView.result }}</pre>
|
<pre class="item-json"
|
||||||
|
v-else-if="typeof props.dataView.result === 'string'">{{ props.dataView.result }}</pre>
|
||||||
<pre class="item-json" v-else>{{ formatJson(props.dataView.result) }}</pre>
|
<pre class="item-json" v-else>{{ formatJson(props.dataView.result) }}</pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -41,6 +43,8 @@
|
|||||||
import type { PropType } from 'vue';
|
import type { PropType } from 'vue';
|
||||||
import type { NodeDataView } from './diagram';
|
import type { NodeDataView } from './diagram';
|
||||||
|
|
||||||
|
import JsonRender from '@/components/json-render/index.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataView: {
|
dataView: {
|
||||||
type: Object as PropType<NodeDataView | undefined | null>,
|
type: Object as PropType<NodeDataView | undefined | null>,
|
||||||
@ -87,11 +91,26 @@ function formatJson(obj: any) {
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
.item-status.running { color: #2196f3; }
|
|
||||||
.item-status.success { color: #43a047; }
|
.item-status.running {
|
||||||
.item-status.error { color: #e53935; }
|
color: #2196f3;
|
||||||
.item-status.waiting { color: #aaa; }
|
}
|
||||||
.item-status.default { color: #888; }
|
|
||||||
|
.item-status.success {
|
||||||
|
color: #43a047;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-status.error {
|
||||||
|
color: #e53935;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-status.waiting {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-status.default {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
.item-desc {
|
.item-desc {
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
@ -108,11 +127,6 @@ function formatJson(obj: any) {
|
|||||||
.item-json {
|
.item-json {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
font-size: 13px;
|
|
||||||
font-family: var(--code-font-family, monospace);
|
|
||||||
margin: 2px 0 8px 0;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-result {
|
.item-result {
|
||||||
@ -122,6 +136,14 @@ function formatJson(obj: any) {
|
|||||||
.result-block {
|
.result-block {
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
border-radius: .5em;
|
border-radius: .5em;
|
||||||
background-color: rgba(245, 108, 108, 0.3);
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-block.error {
|
||||||
|
background-color: rgba(245, 108, 108, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-block.success {
|
||||||
|
background-color: rgba(67, 160, 71, 0.5);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
x
Reference in New Issue
Block a user