11import { useMutation } from "@tanstack/react-query" ;
22import { useNavigate } from "@tanstack/react-router" ;
3+ import { useState } from "react" ;
34
45import { CopyText } from "@/components/shared/CopyText/CopyText" ;
56import { BlockStack , InlineStack } from "@/components/ui/layout" ;
@@ -25,10 +26,12 @@ import {
2526import type { PipelineRun } from "@/types/pipelineRun" ;
2627import { getInitialName } from "@/utils/getComponentName" ;
2728import { submitPipelineRun } from "@/utils/submitPipeline" ;
29+ import { componentSpecToText } from "@/utils/yaml" ;
2830
2931import { isAuthorizationRequired } from "../shared/Authentication/helpers" ;
3032import { useAuthLocalStorage } from "../shared/Authentication/useAuthLocalStorage" ;
3133import { useAwaitAuthorization } from "../shared/Authentication/useAwaitAuthorization" ;
34+ import { CodeViewer } from "../shared/CodeViewer" ;
3235import {
3336 ActionBlock ,
3437 type ActionOrReactNode ,
@@ -39,7 +42,6 @@ import { TextBlock } from "../shared/ContextPanel/Blocks/TextBlock";
3942import PipelineIO from "../shared/Execution/PipelineIO" ;
4043import { InfoBox } from "../shared/InfoBox" ;
4144import { StatusBar , StatusText } from "../shared/Status" ;
42- import { TaskImplementation } from "../shared/TaskDetails" ;
4345
4446export const RunDetails = ( ) => {
4547 const navigate = useNavigate ( ) ;
@@ -129,6 +131,8 @@ export const RunDetails = () => {
129131 onError,
130132 } ) ;
131133
134+ const [ isYamlFullscreen , setIsYamlFullscreen ] = useState ( false ) ;
135+
132136 const editorRoute = componentSpec . name
133137 ? `/editor/${ encodeURIComponent ( componentSpec . name ) } `
134138 : "" ;
@@ -209,11 +213,11 @@ export const RunDetails = () => {
209213 const annotations = componentSpec . metadata ?. annotations || { } ;
210214
211215 const actions : ActionOrReactNode [ ] = [
212- < TaskImplementation
213- displayName = { componentSpec . name ?? "Pipeline" }
214- componentSpec = { componentSpec }
215- showInlineContent = { false }
216- /> ,
216+ {
217+ label : "View YAML" ,
218+ icon : "FileCodeCorner" ,
219+ onClick : ( ) => setIsYamlFullscreen ( true ) ,
220+ } ,
217221 {
218222 label : "Inspect Pipeline" ,
219223 icon : "SquareMousePointer" ,
@@ -247,57 +251,68 @@ export const RunDetails = () => {
247251 ] ;
248252
249253 return (
250- < BlockStack gap = "6" className = "p-2 h-full" >
251- < CopyText className = "text-lg font-semibold" >
252- { componentSpec . name ?? "Unnamed Pipeline" }
253- </ CopyText >
254-
255- < ActionBlock actions = { actions } />
256-
257- { metadata && (
258- < ListBlock
259- title = "Run Info"
260- items = { [
261- { label : "Run Id" , value : metadata . id } ,
262- { label : "Execution Id" , value : metadata . root_execution_id } ,
263- { label : "Created by" , value : metadata . created_by ?? undefined } ,
264- {
265- label : "Created at" ,
266- value : metadata . created_at
267- ? new Date ( metadata . created_at ) . toLocaleString ( )
268- : undefined ,
269- } ,
270- ] }
271- marker = "none"
272- />
273- ) }
274-
275- { componentSpec . description && (
276- < TextBlock title = "Description" text = { componentSpec . description } />
277- ) }
278-
279- < ContentBlock title = "Status" >
280- < InlineStack gap = "2" blockAlign = "center" className = "mb-1" >
281- < Text size = "sm" weight = "semibold" >
282- { runStatus }
283- </ Text >
284- < StatusText statusCounts = { statusCounts } />
285- </ InlineStack >
286- < StatusBar statusCounts = { statusCounts } />
287- </ ContentBlock >
288-
289- { Object . keys ( annotations ) . length > 0 && (
290- < ListBlock
291- title = "Annotations"
292- items = { Object . entries ( annotations ) . map ( ( [ key , value ] ) => ( {
293- label : key ,
294- value : String ( value ) ,
295- } ) ) }
296- marker = "none"
254+ < >
255+ < BlockStack gap = "6" className = "p-2 h-full" >
256+ < CopyText className = "text-lg font-semibold" >
257+ { componentSpec . name ?? "Unnamed Pipeline" }
258+ </ CopyText >
259+
260+ < ActionBlock actions = { actions } />
261+
262+ { metadata && (
263+ < ListBlock
264+ title = "Run Info"
265+ items = { [
266+ { label : "Run Id" , value : metadata . id } ,
267+ { label : "Execution Id" , value : metadata . root_execution_id } ,
268+ { label : "Created by" , value : metadata . created_by ?? undefined } ,
269+ {
270+ label : "Created at" ,
271+ value : metadata . created_at
272+ ? new Date ( metadata . created_at ) . toLocaleString ( )
273+ : undefined ,
274+ } ,
275+ ] }
276+ marker = "none"
277+ />
278+ ) }
279+
280+ { componentSpec . description && (
281+ < TextBlock title = "Description" text = { componentSpec . description } />
282+ ) }
283+
284+ < ContentBlock title = "Status" >
285+ < InlineStack gap = "2" blockAlign = "center" className = "mb-1" >
286+ < Text size = "sm" weight = "semibold" >
287+ { runStatus }
288+ </ Text >
289+ < StatusText statusCounts = { statusCounts } />
290+ </ InlineStack >
291+ < StatusBar statusCounts = { statusCounts } />
292+ </ ContentBlock >
293+
294+ { Object . keys ( annotations ) . length > 0 && (
295+ < ListBlock
296+ title = "Annotations"
297+ items = { Object . entries ( annotations ) . map ( ( [ key , value ] ) => ( {
298+ label : key ,
299+ value : String ( value ) ,
300+ } ) ) }
301+ marker = "none"
302+ />
303+ ) }
304+
305+ < PipelineIO readOnly />
306+ </ BlockStack >
307+ { isYamlFullscreen && (
308+ < CodeViewer
309+ code = { componentSpecToText ( componentSpec ) }
310+ language = "yaml"
311+ filename = { componentSpec . name ?? "pipeline.yaml" }
312+ isFullscreen = { isYamlFullscreen }
313+ onClose = { ( ) => setIsYamlFullscreen ( false ) }
297314 />
298315 ) }
299-
300- < PipelineIO readOnly />
301- </ BlockStack >
316+ </ >
302317 ) ;
303318} ;
0 commit comments