Aye10032 commited on
Commit
d39d8f0
·
1 Parent(s): be721a5

feat: Replace result node with analysis sidebar

Browse files
front/src/components/{ResultNodeComponent.vue → AnalysisResultSidebar.vue} RENAMED
@@ -1,27 +1,29 @@
1
  <template>
2
- <div class="result-node-component" :class="{ selected: isSelected }">
3
- <!-- 输入连接点 -->
4
- <Handle
5
- id="input"
6
- type="target"
7
- :position="Position.Left"
8
- class="node-handle node-handle-input"
9
- />
10
-
11
- <div class="node-header node-header--unified">
12
- <div class="node-title">
13
- <span class="header-icon-ring" aria-hidden="true" v-html="resultIconHtml"></span>
14
- <span class="node-label">{{ data.label || t('common.analysisResult') }}</span>
 
 
 
 
 
 
 
 
 
15
  </div>
16
- <button class="header-delete-btn delete-btn--unified" @click.stop="handleDelete" :title="t('common.delete')">
17
- <svg viewBox="0 0 24 24" fill="none">
18
- <path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
19
- </svg>
20
- </button>
21
- </div>
22
-
23
- <div class="node-body node-body--unified">
24
- <div class="result-content image-content">
25
  <div v-if="plotEntries.length" class="plot-grid">
26
  <button
27
  v-for="p in plotEntries"
@@ -45,7 +47,7 @@
45
  </div>
46
  </div>
47
  </div>
48
- </div>
49
 
50
  <!-- 图片预览(点击遮罩关闭) -->
51
  <div v-if="preview.url" class="img-preview-mask" @click.self="closePreview">
@@ -65,6 +67,7 @@
65
  <script setup lang="ts">
66
  import { computed, ref } from 'vue'
67
  import { useI18n } from 'vue-i18n'
 
68
 
69
  const { t, te } = useI18n()
70
 
@@ -72,38 +75,33 @@ const plotLabel = (key: string) => {
72
  const path = `result.plotTypes.${key}`
73
  return te(path) ? t(path) : key
74
  }
75
- import { Handle, Position } from '@vue-flow/core'
76
- import type { NodeProps } from '@vue-flow/core'
77
- import { paletteIconSvg } from '../utils/paletteIcons'
78
 
79
  const resultIconHtml = paletteIconSvg('result')
80
 
81
- interface NodeData {
82
  label?: string
83
- displayMode?: 'image' | 'table' | 'text'
84
- headerColor?: string
85
  plots?: Record<string, string>
86
  analyses?: unknown
87
  message?: string
88
  exportId?: string
89
  }
90
 
91
- interface Props extends NodeProps {
92
- data: NodeData
 
93
  }
94
 
95
  const props = defineProps<Props>()
96
 
97
- const emit = defineEmits<{
98
- delete: [id: string]
 
99
  }>()
100
 
101
- const isSelected = computed(() => props.selected || false)
102
-
103
  const preview = ref<{ url: string; label: string }>({ url: '', label: '' })
104
 
105
  const plotEntries = computed(() => {
106
- const plots = props.data.plots ?? {}
107
  return Object.entries(plots)
108
  .filter(([, url]) => Boolean(url))
109
  .map(([key, url]) => ({
@@ -120,82 +118,55 @@ const openPreview = (p: { url: string; label: string }) => {
120
  const closePreview = () => {
121
  preview.value = { url: '', label: '' }
122
  }
123
-
124
- const handleDelete = () => {
125
- emit('delete', props.id)
126
- }
127
  </script>
128
 
129
  <style scoped>
130
- .result-node-component {
131
- background: #ffffff !important;
132
- border: 1px solid #e5e7eb !important;
133
- width: 560px !important;
134
- height: 420px !important;
135
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
136
- transition: all 0.2s ease;
137
- overflow: visible !important;
138
- position: relative;
139
- z-index: 1;
140
- cursor: default;
141
  display: flex;
142
  flex-direction: column;
143
- outline: none !important;
144
- }
145
-
146
- .result-node-component:hover {
147
- box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.1) !important;
148
- transform: translateY(-2px);
149
- }
150
-
151
- .result-node-component.selected {
152
- box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 3px 6px rgba(0, 0, 0, 0.12) !important;
153
- transform: translateY(-2px);
154
- outline: none !important;
155
- }
156
-
157
- .node-handle {
158
- width: 12px !important;
159
- height: 12px !important;
160
- border: 2px solid white !important;
161
- border-radius: 50% !important;
162
- cursor: crosshair !important;
163
- transition: all 0.2s ease !important;
164
  }
165
 
166
- .node-handle-input {
167
- left: -6px !important;
168
- background: #10b981 !important;
169
  }
170
 
171
- .node-handle-output {
172
- right: -6px !important;
 
 
 
 
 
 
 
 
 
173
  }
174
 
175
- .node-handle:hover {
176
- transform: scale(1.3);
177
- box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.15);
 
 
178
  }
179
 
180
- .node-header--unified {
181
- padding: 10px 12px;
182
- background: #ffffff !important;
183
- color: #0f172a;
184
- font-size: 13px;
185
- font-weight: 500;
186
- display: flex;
187
- align-items: center;
188
- justify-content: space-between;
189
- position: relative;
190
- transition: all 0.2s ease;
191
- flex: 0 0 auto;
192
- min-height: 40px;
193
- border-bottom: 1px solid #e5e7eb;
194
  }
195
 
196
  .header-icon-ring {
197
- width: 32px;
198
- height: 32px;
199
  border-radius: 50%;
200
  background: #f1f5f9;
201
  display: inline-flex;
@@ -205,98 +176,140 @@ const handleDelete = () => {
205
  }
206
 
207
  .header-icon-ring :deep(svg) {
208
- width: 18px;
209
- height: 18px;
210
  }
211
 
212
- .node-title {
213
  display: flex;
214
- align-items: center;
215
- gap: 0.75rem;
216
  flex: 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  min-width: 0;
218
  }
219
 
220
  .node-label {
221
- flex: 1;
222
- min-width: 0;
 
223
  overflow: hidden;
224
  text-overflow: ellipsis;
225
  white-space: nowrap;
226
- letter-spacing: 0.01em;
227
- font-weight: 600;
228
- font-size: 14px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  color: #0f172a;
230
  }
231
 
232
- .header-delete-btn {
233
- width: 20px !important;
234
- height: 20px !important;
235
- min-width: 20px !important;
236
- min-height: 20px !important;
237
- padding: 0 !important;
238
- margin: 0 !important;
239
- background: transparent !important;
240
- border: none !important;
241
- border-radius: 4px !important;
242
- display: flex !important;
243
- align-items: center !important;
244
- justify-content: center !important;
245
- cursor: pointer !important;
246
- transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
247
- color: #64748b !important;
248
- opacity: 1;
249
- position: relative;
250
- z-index: 2000 !important;
251
- visibility: visible !important;
252
- flex-shrink: 0 !important;
253
- }
254
-
255
- .delete-btn--unified:hover {
256
- background: #f1f5f9 !important;
257
- color: #0f172a !important;
258
- }
259
-
260
- .header-delete-btn svg {
261
  width: 14px;
262
  height: 14px;
263
  }
264
 
265
- .node-body--unified {
266
- padding: 12px;
267
- position: relative;
268
- z-index: 1;
269
  flex: 1;
270
- display: flex;
271
- flex-direction: column;
272
  min-height: 0;
273
  overflow-y: auto;
274
- background: #f8fafc !important;
 
275
  }
276
 
277
- .result-content {
278
- flex: 1;
 
 
 
 
 
279
  display: flex;
280
  flex-direction: column;
281
- min-height: 0;
 
 
 
 
 
282
  }
283
 
284
- .image-content {
285
- display: flex;
286
- align-items: center;
287
- justify-content: center;
288
- min-height: 200px;
289
  }
290
 
291
- .plot-grid {
292
- display: grid;
293
- grid-template-columns: repeat(2, minmax(0, 1fr));
294
- gap: 0.5rem;
295
  width: 100%;
296
- height: 100%;
297
- overflow: auto;
298
- padding-right: 2px;
299
- align-content: start;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  }
301
 
302
  /* 大图预览遮罩 */
@@ -381,64 +394,4 @@ const handleDelete = () => {
381
  object-fit: contain;
382
  background: #0b1220;
383
  }
384
-
385
- .plot-card {
386
- display: flex;
387
- flex-direction: column;
388
- border: 1px solid rgba(148, 163, 184, 0.35);
389
- background: rgba(255, 255, 255, 0.85);
390
- border-radius: 2px;
391
- padding: 0.35rem;
392
- cursor: pointer;
393
- text-align: left;
394
- }
395
-
396
- .plot-card:hover {
397
- border-color: rgba(59, 130, 246, 0.55);
398
- background: rgba(255, 255, 255, 1);
399
- }
400
-
401
- .plot-thumb {
402
- width: 100%;
403
- height: 118px;
404
- object-fit: cover;
405
- border-radius: 2px;
406
- border: 1px solid rgba(226, 232, 240, 1);
407
- background: #fff;
408
- }
409
-
410
- .plot-caption {
411
- margin-top: 0.35rem;
412
- font-size: 0.78rem;
413
- color: rgba(15, 23, 42, 0.75);
414
- line-height: 1.2;
415
- overflow: hidden;
416
- text-overflow: ellipsis;
417
- white-space: nowrap;
418
- }
419
-
420
- .image-placeholder {
421
- width: 100%;
422
- text-align: center;
423
- color: #64748b;
424
- }
425
-
426
- .image-placeholder svg {
427
- width: 48px;
428
- height: 48px;
429
- margin: 0 auto 0.5rem;
430
- color: #94a3b8;
431
- }
432
-
433
- .image-placeholder p {
434
- margin: 0.25rem 0;
435
- font-size: 13px;
436
- }
437
-
438
- .hint {
439
- font-size: 11px !important;
440
- color: #94a3b8 !important;
441
- margin-top: 0.5rem !important;
442
- }
443
  </style>
444
-
 
1
  <template>
2
+ <aside class="result-sidebar" :class="{ collapsed: !open }">
3
+ <button
4
+ type="button"
5
+ class="result-sidebar-toggle"
6
+ :title="open ? t('common.close') : (data?.label || t('common.analysisResult'))"
7
+ @click="$emit('toggle')"
8
+ >
9
+ <span class="header-icon-ring" aria-hidden="true" v-html="resultIconHtml"></span>
10
+ <span v-if="!open" class="toggle-label-vertical">{{ data?.label || t('common.analysisResult') }}</span>
11
+ </button>
12
+
13
+ <div v-if="open" class="result-sidebar-body">
14
+ <div class="result-sidebar-header">
15
+ <div class="result-sidebar-title">
16
+ <span class="header-icon-ring" aria-hidden="true" v-html="resultIconHtml"></span>
17
+ <span class="node-label">{{ data?.label || t('common.analysisResult') }}</span>
18
+ </div>
19
+ <button class="header-close-btn" type="button" @click="$emit('close')" :title="t('common.close')">
20
+ <svg viewBox="0 0 24 24" fill="none">
21
+ <path d="M18 6L6 18M6 6l12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
22
+ </svg>
23
+ </button>
24
  </div>
25
+
26
+ <div class="result-sidebar-content">
 
 
 
 
 
 
 
27
  <div v-if="plotEntries.length" class="plot-grid">
28
  <button
29
  v-for="p in plotEntries"
 
47
  </div>
48
  </div>
49
  </div>
50
+ </aside>
51
 
52
  <!-- 图片预览(点击遮罩关闭) -->
53
  <div v-if="preview.url" class="img-preview-mask" @click.self="closePreview">
 
67
  <script setup lang="ts">
68
  import { computed, ref } from 'vue'
69
  import { useI18n } from 'vue-i18n'
70
+ import { paletteIconSvg } from '../utils/paletteIcons'
71
 
72
  const { t, te } = useI18n()
73
 
 
75
  const path = `result.plotTypes.${key}`
76
  return te(path) ? t(path) : key
77
  }
 
 
 
78
 
79
  const resultIconHtml = paletteIconSvg('result')
80
 
81
+ interface ResultData {
82
  label?: string
 
 
83
  plots?: Record<string, string>
84
  analyses?: unknown
85
  message?: string
86
  exportId?: string
87
  }
88
 
89
+ interface Props {
90
+ data: ResultData | null
91
+ open: boolean
92
  }
93
 
94
  const props = defineProps<Props>()
95
 
96
+ defineEmits<{
97
+ close: []
98
+ toggle: []
99
  }>()
100
 
 
 
101
  const preview = ref<{ url: string; label: string }>({ url: '', label: '' })
102
 
103
  const plotEntries = computed(() => {
104
+ const plots = props.data?.plots ?? {}
105
  return Object.entries(plots)
106
  .filter(([, url]) => Boolean(url))
107
  .map(([key, url]) => ({
 
118
  const closePreview = () => {
119
  preview.value = { url: '', label: '' }
120
  }
 
 
 
 
121
  </script>
122
 
123
  <style scoped>
124
+ .result-sidebar {
125
+ flex-shrink: 0;
126
+ width: 420px;
127
+ background: #ffffff;
128
+ border-left: 1px solid #e5e7eb;
 
 
 
 
 
 
129
  display: flex;
130
  flex-direction: column;
131
+ overflow: hidden;
132
+ transition: width 0.2s ease;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
 
135
+ .result-sidebar.collapsed {
136
+ width: 44px;
 
137
  }
138
 
139
+ .result-sidebar-toggle {
140
+ flex-shrink: 0;
141
+ display: flex;
142
+ align-items: center;
143
+ gap: 0.5rem;
144
+ padding: 10px 12px;
145
+ background: #f8fafc;
146
+ border: none;
147
+ border-bottom: 1px solid #e5e7eb;
148
+ cursor: pointer;
149
+ width: 100%;
150
  }
151
 
152
+ .result-sidebar.collapsed .result-sidebar-toggle {
153
+ flex-direction: column;
154
+ padding: 12px 6px;
155
+ height: 100%;
156
+ border-bottom: none;
157
  }
158
 
159
+ .toggle-label-vertical {
160
+ writing-mode: vertical-rl;
161
+ font-size: 12px;
162
+ font-weight: 600;
163
+ color: #475569;
164
+ white-space: nowrap;
 
 
 
 
 
 
 
 
165
  }
166
 
167
  .header-icon-ring {
168
+ width: 28px;
169
+ height: 28px;
170
  border-radius: 50%;
171
  background: #f1f5f9;
172
  display: inline-flex;
 
176
  }
177
 
178
  .header-icon-ring :deep(svg) {
179
+ width: 16px;
180
+ height: 16px;
181
  }
182
 
183
+ .result-sidebar-body {
184
  display: flex;
185
+ flex-direction: column;
186
+ min-height: 0;
187
  flex: 1;
188
+ }
189
+
190
+ .result-sidebar-header {
191
+ padding: 10px 12px;
192
+ background: #ffffff;
193
+ display: flex;
194
+ align-items: center;
195
+ justify-content: space-between;
196
+ border-bottom: 1px solid #e5e7eb;
197
+ flex: 0 0 auto;
198
+ }
199
+
200
+ .result-sidebar-title {
201
+ display: flex;
202
+ align-items: center;
203
+ gap: 0.6rem;
204
  min-width: 0;
205
  }
206
 
207
  .node-label {
208
+ font-weight: 600;
209
+ font-size: 14px;
210
+ color: #0f172a;
211
  overflow: hidden;
212
  text-overflow: ellipsis;
213
  white-space: nowrap;
214
+ }
215
+
216
+ .header-close-btn {
217
+ width: 24px;
218
+ height: 24px;
219
+ padding: 0;
220
+ background: transparent;
221
+ border: none;
222
+ border-radius: 4px;
223
+ display: flex;
224
+ align-items: center;
225
+ justify-content: center;
226
+ cursor: pointer;
227
+ color: #64748b;
228
+ flex-shrink: 0;
229
+ }
230
+
231
+ .header-close-btn:hover {
232
+ background: #f1f5f9;
233
  color: #0f172a;
234
  }
235
 
236
+ .header-close-btn svg {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  width: 14px;
238
  height: 14px;
239
  }
240
 
241
+ .result-sidebar-content {
 
 
 
242
  flex: 1;
 
 
243
  min-height: 0;
244
  overflow-y: auto;
245
+ padding: 12px;
246
+ background: #f8fafc;
247
  }
248
 
249
+ .plot-grid {
250
+ display: grid;
251
+ grid-template-columns: repeat(1, minmax(0, 1fr));
252
+ gap: 0.6rem;
253
+ }
254
+
255
+ .plot-card {
256
  display: flex;
257
  flex-direction: column;
258
+ border: 1px solid rgba(148, 163, 184, 0.35);
259
+ background: rgba(255, 255, 255, 0.9);
260
+ border-radius: 3px;
261
+ padding: 0.4rem;
262
+ cursor: pointer;
263
+ text-align: left;
264
  }
265
 
266
+ .plot-card:hover {
267
+ border-color: rgba(59, 130, 246, 0.55);
268
+ background: rgba(255, 255, 255, 1);
 
 
269
  }
270
 
271
+ .plot-thumb {
 
 
 
272
  width: 100%;
273
+ height: 160px;
274
+ object-fit: cover;
275
+ border-radius: 2px;
276
+ border: 1px solid rgba(226, 232, 240, 1);
277
+ background: #fff;
278
+ }
279
+
280
+ .plot-caption {
281
+ margin-top: 0.35rem;
282
+ font-size: 0.8rem;
283
+ color: rgba(15, 23, 42, 0.75);
284
+ line-height: 1.2;
285
+ overflow: hidden;
286
+ text-overflow: ellipsis;
287
+ white-space: nowrap;
288
+ }
289
+
290
+ .image-placeholder {
291
+ width: 100%;
292
+ text-align: center;
293
+ color: #64748b;
294
+ padding: 2rem 0;
295
+ }
296
+
297
+ .image-placeholder svg {
298
+ width: 48px;
299
+ height: 48px;
300
+ margin: 0 auto 0.5rem;
301
+ color: #94a3b8;
302
+ }
303
+
304
+ .image-placeholder p {
305
+ margin: 0.25rem 0;
306
+ font-size: 13px;
307
+ }
308
+
309
+ .hint {
310
+ font-size: 11px !important;
311
+ color: #94a3b8 !important;
312
+ margin-top: 0.5rem !important;
313
  }
314
 
315
  /* 大图预览遮罩 */
 
394
  object-fit: contain;
395
  background: #0b1220;
396
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  </style>
 
front/src/components/NodeEditor.vue CHANGED
@@ -296,6 +296,15 @@
296
  <MiniMap />
297
  </VueFlow>
298
  </div>
 
 
 
 
 
 
 
 
 
299
  </div>
300
  </div>
301
  </div>
@@ -316,7 +325,7 @@ import '@vue-flow/core/dist/theme-default.css'
316
  import '@vue-flow/controls/dist/style.css'
317
  import '@vue-flow/minimap/dist/style.css'
318
  import WorkflowNodeComponent from './WorkflowNodeComponent.vue'
319
- import ResultNodeComponent from './ResultNodeComponent.vue'
320
 
321
  const { t } = useI18n()
322
  const et = (key: string) => i18n.global.t(key) as string
@@ -419,7 +428,6 @@ interface WorkflowNode {
419
  options?: Array<{ label: string; value: any }>
420
  }>
421
  headerColor?: string
422
- displayMode?: 'image' | 'table' | 'text'
423
  status?: 'ready' | 'pending' | 'error'
424
  showSettings?: boolean
425
  tabs?: Array<{ id: string; label: string }>
@@ -486,8 +494,7 @@ watch(edges, (newEdges) => {
486
  // 注册自定义节点类型(使用通用节点组件)
487
  const nodeTypes: any = computed(() => {
488
  const types = {
489
- 'default': markRaw(WorkflowNodeComponent),
490
- 'result': markRaw(ResultNodeComponent)
491
  }
492
  console.log('Node types registered:', Object.keys(types), types)
493
  return types
@@ -526,6 +533,17 @@ const showRunButton = computed(() => {
526
  return nodes.value.length > 0
527
  })
528
 
 
 
 
 
 
 
 
 
 
 
 
529
  const updateResultNodeFromResp = (resp: any) => {
530
  // plots 需要拼接成可访问的完整 URL
531
  const plots: Record<string, string> = {}
@@ -535,27 +553,14 @@ const updateResultNodeFromResp = (resp: any) => {
535
  plots[k] = url.startsWith('http') ? url : `${mediaBaseUrl}${url}`
536
  })
537
 
538
- const existing = nodes.value.find(n => n.type === 'result')
539
- const resultData = {
540
  label: t('common.analysisResult'),
541
- displayMode: 'image' as const,
542
- headerColor: '#0f172a',
543
  plots,
544
  analyses: resp?.result?.analyses ?? resp?.analyses ?? null,
545
  message: resp?.message ?? resp?.result?.message ?? '',
546
  exportId: String(resp?.result?.artifacts?.export_id ?? resp?.result?.export_id ?? resp?.export_id ?? '').trim() || undefined
547
  }
548
-
549
- if (existing) {
550
- existing.data = { ...(existing.data ?? {}), ...resultData }
551
- } else {
552
- nodes.value.push({
553
- id: `node-${++nodeIdCounter.value}`,
554
- type: 'result',
555
- position: { x: 820, y: 180 },
556
- data: resultData
557
- } as any)
558
- }
559
  }
560
 
561
  const buildPlotsFromResp = (resp: any): Record<string, string> => {
@@ -605,12 +610,12 @@ const onAnalysisLeafClick = async (leafType: string) => {
605
 
606
  const showDownloadButton = computed(() => {
607
  if (!projectId.value) return false
608
- const resultNode: any = nodes.value.find(n => n.type === 'result')
609
- if (!resultNode) return false
610
- const plots = resultNode?.data?.plots ?? {}
611
  const hasPlots = typeof plots === 'object' && plots && Object.keys(plots).length > 0
612
- const hasAnalyses = Boolean(resultNode?.data?.analyses)
613
- const hasMessage = Boolean(String(resultNode?.data?.message ?? '').trim())
614
  return hasPlots || hasAnalyses || hasMessage
615
  })
616
 
 
296
  <MiniMap />
297
  </VueFlow>
298
  </div>
299
+
300
+ <!-- 右侧分析结果侧边栏 -->
301
+ <AnalysisResultSidebar
302
+ v-if="analysisResult"
303
+ :data="analysisResult"
304
+ :open="showResultSidebar"
305
+ @close="showResultSidebar = false"
306
+ @toggle="showResultSidebar = !showResultSidebar"
307
+ />
308
  </div>
309
  </div>
310
  </div>
 
325
  import '@vue-flow/controls/dist/style.css'
326
  import '@vue-flow/minimap/dist/style.css'
327
  import WorkflowNodeComponent from './WorkflowNodeComponent.vue'
328
+ import AnalysisResultSidebar from './AnalysisResultSidebar.vue'
329
 
330
  const { t } = useI18n()
331
  const et = (key: string) => i18n.global.t(key) as string
 
428
  options?: Array<{ label: string; value: any }>
429
  }>
430
  headerColor?: string
 
431
  status?: 'ready' | 'pending' | 'error'
432
  showSettings?: boolean
433
  tabs?: Array<{ id: string; label: string }>
 
494
  // 注册自定义节点类型(使用通用节点组件)
495
  const nodeTypes: any = computed(() => {
496
  const types = {
497
+ 'default': markRaw(WorkflowNodeComponent)
 
498
  }
499
  console.log('Node types registered:', Object.keys(types), types)
500
  return types
 
533
  return nodes.value.length > 0
534
  })
535
 
536
+ interface AnalysisResultData {
537
+ label?: string
538
+ plots?: Record<string, string>
539
+ analyses?: unknown
540
+ message?: string
541
+ exportId?: string
542
+ }
543
+
544
+ const analysisResult = ref<AnalysisResultData | null>(null)
545
+ const showResultSidebar = ref(false)
546
+
547
  const updateResultNodeFromResp = (resp: any) => {
548
  // plots 需要拼接成可访问的完整 URL
549
  const plots: Record<string, string> = {}
 
553
  plots[k] = url.startsWith('http') ? url : `${mediaBaseUrl}${url}`
554
  })
555
 
556
+ analysisResult.value = {
 
557
  label: t('common.analysisResult'),
 
 
558
  plots,
559
  analyses: resp?.result?.analyses ?? resp?.analyses ?? null,
560
  message: resp?.message ?? resp?.result?.message ?? '',
561
  exportId: String(resp?.result?.artifacts?.export_id ?? resp?.result?.export_id ?? resp?.export_id ?? '').trim() || undefined
562
  }
563
+ showResultSidebar.value = true
 
 
 
 
 
 
 
 
 
 
564
  }
565
 
566
  const buildPlotsFromResp = (resp: any): Record<string, string> => {
 
610
 
611
  const showDownloadButton = computed(() => {
612
  if (!projectId.value) return false
613
+ const result = analysisResult.value
614
+ if (!result) return false
615
+ const plots = result.plots ?? {}
616
  const hasPlots = typeof plots === 'object' && plots && Object.keys(plots).length > 0
617
+ const hasAnalyses = Boolean(result.analyses)
618
+ const hasMessage = Boolean(String(result.message ?? '').trim())
619
  return hasPlots || hasAnalyses || hasMessage
620
  })
621