|
|
@@ -1,4 +1,4 @@
|
|
|
-import { For, Show, createEffect, on, onCleanup } from "solid-js"
|
|
|
+import { For, Show, createEffect, createMemo, on, onCleanup } from "solid-js"
|
|
|
import { ResearchReport } from "./report"
|
|
|
import { ResearchProgress } from "./progress"
|
|
|
import { ResearchIssue } from "./issue"
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
type PaasPlatform,
|
|
|
type PaasRequest,
|
|
|
} from "@/paas"
|
|
|
+import { groupPaasFiles } from "./file-groups"
|
|
|
import type { PaasPreviewFile } from "./preview"
|
|
|
|
|
|
const active = new Set([
|
|
|
@@ -202,6 +203,86 @@ export function PaasRunPanel(props: {
|
|
|
const name = paasText(file.name) || paasText(file.path)
|
|
|
return name ? [{ name, path: paasText(file.path) }] : []
|
|
|
})
|
|
|
+ const artifactGroups = createMemo(() => groupPaasFiles(artifacts()))
|
|
|
+ const workFileGroups = createMemo(() => groupPaasFiles(workFiles()))
|
|
|
+ const artifactRow = (file: ReturnType<typeof artifacts>[number]) => (
|
|
|
+ <div class="paas-actions">
|
|
|
+ <span>{file.name}</span>
|
|
|
+ <Show when={file.artifactID}>
|
|
|
+ <Show when={props.onPreviewFile}>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ aria-label={`预览 ${file.name}`}
|
|
|
+ disabled={!!state.busy}
|
|
|
+ onClick={() =>
|
|
|
+ props.onPreviewFile?.({
|
|
|
+ agentID: props.agentID,
|
|
|
+ runID: props.runID,
|
|
|
+ artifactID: file.artifactID,
|
|
|
+ name: file.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 预览
|
|
|
+ </button>
|
|
|
+ </Show>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ disabled={!!state.busy}
|
|
|
+ onClick={() =>
|
|
|
+ void perform("下载", {
|
|
|
+ action: "download",
|
|
|
+ agentID: props.agentID,
|
|
|
+ runID: props.runID,
|
|
|
+ artifactID: file.artifactID,
|
|
|
+ name: file.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 保存成果
|
|
|
+ </button>
|
|
|
+ </Show>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ const workFileRow = (file: ReturnType<typeof workFiles>[number]) => (
|
|
|
+ <div class="paas-actions paas-run-file">
|
|
|
+ <span>{file.name}</span>
|
|
|
+ <Show when={file.path} fallback={<span class="paas-muted">平台未返回可下载路径。</span>}>
|
|
|
+ <Show when={props.onPreviewFile}>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ aria-label={`预览 ${file.name}`}
|
|
|
+ disabled={!!state.busy}
|
|
|
+ onClick={() =>
|
|
|
+ props.onPreviewFile?.({
|
|
|
+ agentID: props.agentID,
|
|
|
+ runID: props.runID,
|
|
|
+ path: file.path,
|
|
|
+ name: file.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 预览
|
|
|
+ </button>
|
|
|
+ </Show>
|
|
|
+ <button
|
|
|
+ type="button"
|
|
|
+ disabled={!!state.busy}
|
|
|
+ onClick={() =>
|
|
|
+ void perform("下载", {
|
|
|
+ action: "download",
|
|
|
+ agentID: props.agentID,
|
|
|
+ runID: props.runID,
|
|
|
+ path: file.path,
|
|
|
+ name: file.name,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ >
|
|
|
+ 保存文件
|
|
|
+ </button>
|
|
|
+ </Show>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
|
|
|
return (
|
|
|
<section class="paas-panel" aria-label="任务进度与成果">
|
|
|
@@ -337,50 +418,17 @@ export function PaasRunPanel(props: {
|
|
|
</div>
|
|
|
</details>
|
|
|
</Show>
|
|
|
- <Show when={artifacts().length}>
|
|
|
+ <Show when={artifactGroups().files.length}>
|
|
|
<section class="paas-run-results" aria-label="成果">
|
|
|
- <h3>成果 · {artifacts().length}</h3>
|
|
|
- <For each={artifacts()}>
|
|
|
- {(file) => (
|
|
|
- <div class="paas-actions">
|
|
|
- <span>{file.name}</span>
|
|
|
- <Show when={file.artifactID}>
|
|
|
- <Show when={props.onPreviewFile}>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- aria-label={`预览 ${file.name}`}
|
|
|
- disabled={!!state.busy}
|
|
|
- onClick={() =>
|
|
|
- props.onPreviewFile?.({
|
|
|
- agentID: props.agentID,
|
|
|
- runID: props.runID,
|
|
|
- artifactID: file.artifactID,
|
|
|
- name: file.name,
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- 预览
|
|
|
- </button>
|
|
|
- </Show>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- disabled={!!state.busy}
|
|
|
- onClick={() =>
|
|
|
- void perform("下载", {
|
|
|
- action: "download",
|
|
|
- agentID: props.agentID,
|
|
|
- runID: props.runID,
|
|
|
- artifactID: file.artifactID,
|
|
|
- name: file.name,
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- 保存成果
|
|
|
- </button>
|
|
|
- </Show>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </For>
|
|
|
+ <h3>成果 · {artifactGroups().files.length}</h3>
|
|
|
+ <For each={artifactGroups().previewable}>{artifactRow}</For>
|
|
|
+ <Show when={artifactGroups().technical.length}>
|
|
|
+ <details class="paas-run-technical">
|
|
|
+ <summary>技术文件 · {artifactGroups().technical.length}</summary>
|
|
|
+ <p class="paas-muted">JSON、YAML、日志与中间产物;展开后仍可预览或保存。</p>
|
|
|
+ <For each={artifactGroups().technical}>{artifactRow}</For>
|
|
|
+ </details>
|
|
|
+ </Show>
|
|
|
</section>
|
|
|
</Show>
|
|
|
<div class="paas-actions paas-run-files">
|
|
|
@@ -406,47 +454,17 @@ export function PaasRunPanel(props: {
|
|
|
</details>
|
|
|
</div>
|
|
|
</Show>
|
|
|
- <For each={workFiles()}>
|
|
|
- {(file) => (
|
|
|
- <div class="paas-actions paas-run-file">
|
|
|
- <span>{file.name}</span>
|
|
|
- <Show when={file.path} fallback={<span class="paas-muted">平台未返回可下载路径。</span>}>
|
|
|
- <Show when={props.onPreviewFile}>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- aria-label={`预览 ${file.name}`}
|
|
|
- disabled={!!state.busy}
|
|
|
- onClick={() =>
|
|
|
- props.onPreviewFile?.({
|
|
|
- agentID: props.agentID,
|
|
|
- runID: props.runID,
|
|
|
- path: file.path,
|
|
|
- name: file.name,
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- 预览
|
|
|
- </button>
|
|
|
- </Show>
|
|
|
- <button
|
|
|
- type="button"
|
|
|
- disabled={!!state.busy}
|
|
|
- onClick={() =>
|
|
|
- void perform("下载", {
|
|
|
- action: "download",
|
|
|
- agentID: props.agentID,
|
|
|
- runID: props.runID,
|
|
|
- path: file.path,
|
|
|
- name: file.name,
|
|
|
- })
|
|
|
- }
|
|
|
- >
|
|
|
- 保存文件
|
|
|
- </button>
|
|
|
- </Show>
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </For>
|
|
|
+ <Show when={state.filesLoaded && !state.filesLoading && !state.filesError && workFileGroups().files.length}>
|
|
|
+ <h3 class="paas-run-files-heading">工作文件 · {workFileGroups().files.length}</h3>
|
|
|
+ <For each={workFileGroups().previewable}>{workFileRow}</For>
|
|
|
+ <Show when={workFileGroups().technical.length}>
|
|
|
+ <details class="paas-run-technical">
|
|
|
+ <summary>技术文件 · {workFileGroups().technical.length}</summary>
|
|
|
+ <p class="paas-muted">JSON、YAML、日志与中间产物;展开后仍可预览或保存。</p>
|
|
|
+ <For each={workFileGroups().technical}>{workFileRow}</For>
|
|
|
+ </details>
|
|
|
+ </Show>
|
|
|
+ </Show>
|
|
|
</section>
|
|
|
)
|
|
|
}
|