diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-18 18:36:34 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-18 18:36:34 +0800 |
| commit | b2c2f9db4b334427c34b2111a4b6609b7af0339b (patch) | |
| tree | 10aefefa7f7498fe1061cbd3a0febfac5296e172 /frontend/src/pages | |
| parent | ef81ecafcb5a07efd557e15fe686cb434cf45261 (diff) | |
| download | strategy-lab-b2c2f9db4b334427c34b2111a4b6609b7af0339b.tar.gz | |
[实现方案] 结果页默认折叠 Collapsible「技术口径」渲染 result.assumptions 键值对;warnings Alert 仅显示真实警告(无 assumptions 字段不渲染)
Diffstat (limited to 'frontend/src/pages')
| -rw-r--r-- | frontend/src/pages/ProjectBacktestTab.svelte | 18 | ||||
| -rw-r--r-- | frontend/src/pages/ProjectResultsTab.svelte | 19 |
2 files changed, 37 insertions, 0 deletions
diff --git a/frontend/src/pages/ProjectBacktestTab.svelte b/frontend/src/pages/ProjectBacktestTab.svelte index 7d5b172..dcde8d2 100644 --- a/frontend/src/pages/ProjectBacktestTab.svelte +++ b/frontend/src/pages/ProjectBacktestTab.svelte @@ -17,6 +17,7 @@ import type { Run, Dataset } from '../lib/types'; import { Alert } from '$lib/components/ui/alert'; import { Badge } from '$lib/components/ui/badge'; import * as Card from '$lib/components/ui/card'; + import * as Collapsible from '$lib/components/ui/collapsible'; import * as Textarea from '$lib/components/ui/textarea'; import * as Table from '$lib/components/ui/table'; import * as Select from '$lib/components/ui/select'; @@ -362,6 +363,23 @@ import * as Textarea from '$lib/components/ui/textarea'; </ul> </Alert> {/if} + {#if latest.result?.assumptions && Object.keys(latest.result.assumptions).length} + <Collapsible.Root> + <Collapsible.Trigger + class="flex w-full items-center justify-between p-4 text-sm font-medium hover:bg-muted/50" + data-testid="assumptions-toggle">技术口径</Collapsible.Trigger> + <Collapsible.Content class="px-4 pb-4"> + <dl class="text-xs" data-testid="assumptions-list"> + {#each Object.entries(latest.result.assumptions) as [k, v] (k)} + <div class="flex gap-4 py-1"> + <dt class="text-muted-foreground shrink-0">{k}</dt> + <dd>{v}</dd> + </div> + {/each} + </dl> + </Collapsible.Content> + </Collapsible.Root> + {/if} {#if latest.status === 'succeeded' && latest.result} <Button variant="outline" href={`#/projects/${projectId}/results?run=${latest.id}`} class="w-fit">查看完整结果与图表</Button> {/if} diff --git a/frontend/src/pages/ProjectResultsTab.svelte b/frontend/src/pages/ProjectResultsTab.svelte index 860fab2..2afb7c1 100644 --- a/frontend/src/pages/ProjectResultsTab.svelte +++ b/frontend/src/pages/ProjectResultsTab.svelte @@ -18,6 +18,7 @@ import { Alert } from '$lib/components/ui/alert'; import { Badge } from '$lib/components/ui/badge'; import * as Card from '$lib/components/ui/card'; + import * as Collapsible from '$lib/components/ui/collapsible'; import * as Table from '$lib/components/ui/table'; import * as Select from '$lib/components/ui/select'; import * as Tabs from '$lib/components/ui/tabs'; @@ -197,6 +198,24 @@ import type { Run, BacktestResult } from '../lib/types'; </Alert> {/if} + {#if result.assumptions && Object.keys(result.assumptions).length} + <Collapsible.Root> + <Collapsible.Trigger + class="flex w-full items-center justify-between p-4 text-sm font-medium hover:bg-muted/50" + data-testid="assumptions-toggle">技术口径</Collapsible.Trigger> + <Collapsible.Content class="px-4 pb-4"> + <dl class="text-xs" data-testid="assumptions-list"> + {#each Object.entries(result.assumptions) as [k, v] (k)} + <div class="flex gap-4 py-1"> + <dt class="text-muted-foreground shrink-0">{k}</dt> + <dd>{v}</dd> + </div> + {/each} + </dl> + </Collapsible.Content> + </Collapsible.Root> + {/if} + <Card.Root size="sm" class="p-4 flex flex-col gap-4"> {#if result.metrics} {@const mrow = result.metrics} |
