Skip to content

Commit ea52907

Browse files
committed
fix(desk): SChart import error
1 parent d0065f8 commit ea52907

File tree

2 files changed

+52
-42
lines changed

2 files changed

+52
-42
lines changed

packages/desktop/modules/script/components/SChart.vue

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
import { onMounted, ref, watch } from 'vue'
32
import { useStore } from '@modules/script/store'
43
5-
import SOutput from './SOutput.vue'
6-
import MEditor from '@modules/monaco/components/MEditor.vue'
7-
import VChart from '@/components/v-chart.vue'
84
import EvaluationOutput from '@core/entities/evaluation-output'
95
6+
import VChart from '@components/VChart.vue'
7+
import MEditor from '@modules/monaco/components/MEditor.vue'
8+
import SOutput from './SOutput.vue'
9+
1010
// Props & Emits
1111
1212
defineProps({
@@ -48,17 +48,17 @@ const current = ref<'chart' | 'debug' | 'raw'>('chart')
4848
// execute script
4949
const store = useStore()
5050
51-
const output = ref<EvaluationOutput>({
52-
error: null,
53-
result: null,
54-
logs: [],
55-
})
51+
const output = ref(new EvaluationOutput())
5652
5753
async function execute() {
58-
output.value = await store.execute({
54+
const response = await store.execute({
5955
content: content.value,
6056
})
6157
58+
output.value.error = response.error
59+
output.value.result = response.result
60+
output.value.logs = response.logs
61+
6262
if (output.value.error || !output.value.result) {
6363
current.value = 'debug'
6464
}
@@ -72,13 +72,16 @@ const chart = ref({
7272
options: null,
7373
})
7474
75-
watch(output, (value) => {
76-
chart.value.loading = true
75+
watch(
76+
() => output.value.result,
77+
(value) => {
78+
chart.value.loading = true
7779
78-
chart.value.options = value.result
80+
chart.value.options = value
7981
80-
setTimeout(() => (chart.value.loading = false), 800)
81-
})
82+
setTimeout(() => (chart.value.loading = false), 800)
83+
}
84+
)
8285
8386
// refresh chart
8487
const chartRef = ref<InstanceType<typeof VChart> | null>()
@@ -102,19 +105,24 @@ function refresh() {
102105
{{ title }}
103106
</v-card-title>
104107

105-
<v-btn text size="sm" class="ml-auto text-t-secondary" @click="current = 'chart'">
108+
<v-btn
109+
mode="text"
110+
size="xs"
111+
class="ml-auto text-t-secondary"
112+
@click="current = 'chart'"
113+
>
106114
<v-icon name="chart-pie" />
107115
</v-btn>
108116

109-
<v-btn text size="sm" class="text-t-secondary" @click="refresh">
117+
<v-btn mode="text" size="xs" class="text-t-secondary" @click="refresh">
110118
<v-icon name="rotate" />
111119
</v-btn>
112120

113-
<v-btn text size="sm" class="text-t-secondary" @click="current = 'raw'">
121+
<v-btn mode="text" size="xs" class="text-t-secondary" @click="current = 'raw'">
114122
<v-icon name="code" />
115123
</v-btn>
116124

117-
<v-btn text size="sm" class="text-t-secondary" @click="current = 'debug'">
125+
<v-btn mode="text" size="xs" class="text-t-secondary" @click="current = 'debug'">
118126
<v-icon name="check-circle" />
119127
</v-btn>
120128
</v-card-head>

packages/examples/scripts/.is/menu.json

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,36 @@
44
"label": "Collections",
55
"icon": "code",
66
"isSection": true,
7-
"children": []
8-
},
9-
{
10-
"label": "Todos",
11-
"to": "/collections/todos/items",
12-
"children": [],
13-
"id": "4ef035fd-89a1-4509-aa55-2b575b25a141",
14-
"icon": "bookmark"
7+
"children": [
8+
{
9+
"label": "Todos",
10+
"to": "/collections/todos/items",
11+
"children": [],
12+
"id": "4ef035fd-89a1-4509-aa55-2b575b25a141",
13+
"icon": "bookmark"
14+
}
15+
]
1516
},
1617
{
1718
"id": "289.65503229275765",
1819
"label": "Scripts",
1920
"icon": "code",
2021
"isSection": true,
21-
"children": []
22-
},
23-
{
24-
"label": "create-item.ts",
25-
"to": "/entries/items/create-item.ts",
26-
"children": [],
27-
"id": "04372ef9-90e8-46f4-ae6e-1913436d2d16",
28-
"icon": "bookmark"
29-
},
30-
{
31-
"label": "create-multiple.ts",
32-
"to": "/entries/items/create-multiple.ts",
33-
"children": [],
34-
"id": "e6262730-0af1-42b8-abcc-fb0f05efdccb",
35-
"icon": "bookmark"
22+
"children": [
23+
{
24+
"label": "create-multiple.ts",
25+
"to": "/entries/items/create-multiple.ts",
26+
"children": [],
27+
"id": "e6262730-0af1-42b8-abcc-fb0f05efdccb",
28+
"icon": "bookmark"
29+
},
30+
{
31+
"label": "create-item.ts",
32+
"to": "/entries/items/create-item.ts",
33+
"children": [],
34+
"id": "04372ef9-90e8-46f4-ae6e-1913436d2d16",
35+
"icon": "bookmark"
36+
}
37+
]
3638
}
3739
]

0 commit comments

Comments
 (0)