|
|
@@ -15,6 +15,7 @@ import {
|
|
|
type PaasPlatform,
|
|
|
type PaasRequest,
|
|
|
} from "@/paas"
|
|
|
+import type { PaasPreviewFile } from "./preview"
|
|
|
|
|
|
const active = new Set([
|
|
|
"running",
|
|
|
@@ -36,6 +37,7 @@ export function PaasRunPanel(props: {
|
|
|
runID: string
|
|
|
hideOutput?: boolean
|
|
|
onUpdate?: (run: Record<string, unknown>) => void
|
|
|
+ onPreviewFile?: (file: PaasPreviewFile) => void
|
|
|
}) {
|
|
|
const platform = usePlatform()
|
|
|
const [state, setState] = createStore({
|
|
|
@@ -343,6 +345,23 @@ export function PaasRunPanel(props: {
|
|
|
<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}
|
|
|
@@ -392,6 +411,23 @@ export function PaasRunPanel(props: {
|
|
|
<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}
|