1- import React from 'react' ;
1+ import React , { useEffect , useState } from 'react' ;
22import DetailCard from '../DetailCard' ;
33import styles from '../index.module.scss' ;
44import { Paragraph } from '../../typographies' ;
5- import { Run } from '../../../../api/types' ;
5+ import { PipelineBuild , Run } from '../../../../api/types' ;
6+ import axios from 'axios' ;
7+ import { useSelector } from 'react-redux' ;
8+ import { sessionSelectors } from '../../../../redux/selectors' ;
69
710interface OrchestratorCardProps {
811 run : Run ;
912}
1013
1114const OrchestratorCard = ( { run } : OrchestratorCardProps ) => {
15+ const authToken = useSelector ( sessionSelectors . authenticationToken ) ;
16+ const [ pipelineBuild , setPipelineBuild ] = useState < PipelineBuild | null > (
17+ null ,
18+ ) ;
19+ async function fetchPipelineBuild ( id : string ) {
20+ try {
21+ const response = await axios . get (
22+ `${ process . env . REACT_APP_BASE_API_URL } /pipeline_builds/${ id } ` ,
23+ {
24+ headers : {
25+ Authorization : `bearer ${ authToken } ` ,
26+ } ,
27+ } ,
28+ ) ;
29+ setPipelineBuild ( response . data ) ;
30+ } catch ( e ) {
31+ console . log ( e ) ;
32+ }
33+ }
34+
35+ useEffect ( ( ) => {
36+ if ( run . body ?. build ?. id ) {
37+ fetchPipelineBuild ( run . body ?. build . id ) ;
38+ }
39+ // eslint-disable-next-line react-hooks/exhaustive-deps
40+ } , [ ] ) ;
41+
1242 return (
1343 < DetailCard isInitiallyOpen = { true } heading = "Orchestrator" >
1444 < div >
1545 < Paragraph className = { styles . card__key } > Orchestrator Run ID</ Paragraph >
1646 < Paragraph className = { styles . card__value } >
17- { /* @ts -ignore */ }
1847 { run . metadata ?. orchestrator_run_id }
1948 </ Paragraph >
2049 </ div >
2150 < div >
2251 < Paragraph className = { styles . card__key } > URL</ Paragraph >
2352 < Paragraph className = { styles . card__value } >
24- { /* @ts -ignore */ }
25- { run . metadata ?. orchestrator_url ?. value ? (
53+ { ( run . metadata ?. run_metadata ?. orchestrator_url as {
54+ [ key : string ] : any ;
55+ } ) ?. body ?. value ? (
2656 < a
2757 rel = "noopener noreferrer"
28- // @ts -ignore
29- href = { run . metadata ?. orchestrator_url ?. value }
58+ href = {
59+ ( run . metadata ?. run_metadata ?. orchestrator_url as {
60+ [ key : string ] : any ;
61+ } ) ?. body ?. value
62+ }
3063 target = "_blank"
3164 >
32- { /* @ts -ignore */ }
33- { run . metadata ?. orchestrator_url ?. value }
65+ {
66+ ( run . metadata ?. run_metadata ?. orchestrator_url as {
67+ [ key : string ] : any ;
68+ } ) ?. body ?. value
69+ }
3470 </ a >
3571 ) : (
3672 'n/a'
3773 ) }
3874 </ Paragraph >
3975 </ div >
40- { /* @ts -ignore */ }
41- { run . build ?. images ?. orchestrator && (
76+
77+ { pipelineBuild ?. metadata ?. images ?. orchestrator && (
4278 < >
4379 < div >
4480 < Paragraph className = { styles . card__key } > Image</ Paragraph >
4581 < Paragraph className = { styles . card__value } >
46- { /* @ts -ignore */ }
47- { run . build ?. images ?. orchestrator ?. image }
82+ {
83+ ( pipelineBuild . metadata ?. images ?. orchestrator as {
84+ [ key : string ] : any ;
85+ } ) ?. image
86+ }
4887 </ Paragraph >
4988 </ div >
50- { /* @ts -ignore */ }
51- { run . build ?. images ?. orchestrator ?. dockerfile ? (
89+
90+ { ( pipelineBuild . metadata ?. images ?. orchestrator as {
91+ [ key : string ] : any ;
92+ } ) ?. dockerfile ? (
5293 < div >
5394 < details >
5495 < summary className = { styles . card__summary } >
@@ -60,13 +101,13 @@ const OrchestratorCard = ({ run }: OrchestratorCardProps) => {
60101 </ Paragraph >
61102 </ summary >
62103 < div className = { styles . card__detailsContainer } >
63- { /* @ts -ignore */ }
64104 < Paragraph
65105 style = { { whiteSpace : 'pre-wrap' } }
66106 className = { styles . card__value }
67107 >
68- { /* @ts -ignore */ }
69- { run . build ?. images ?. orchestrator ?. dockerfile || 'n/a' }
108+ { ( pipelineBuild . metadata ?. images ?. orchestrator as {
109+ [ key : string ] : any ;
110+ } ) ?. dockerfile || 'n/a' }
70111 </ Paragraph >
71112 </ div >
72113 </ details >
@@ -82,8 +123,9 @@ const OrchestratorCard = ({ run }: OrchestratorCardProps) => {
82123 </ Paragraph >
83124 </ div >
84125 ) }
85- { /* @ts -ignore */ }
86- { run . build ?. images ?. orchestrator ?. requirements ? (
126+ { ( pipelineBuild . metadata ?. images ?. orchestrator as {
127+ [ key : string ] : any ;
128+ } ) ?. requirements ? (
87129 < div >
88130 < details >
89131 < summary className = { styles . card__summary } >
@@ -95,13 +137,13 @@ const OrchestratorCard = ({ run }: OrchestratorCardProps) => {
95137 </ Paragraph >
96138 </ summary >
97139 < div className = { styles . card__detailsContainer } >
98- { /* @ts -ignore */ }
99140 < Paragraph
100141 style = { { whiteSpace : 'pre-wrap' } }
101142 className = { styles . card__value }
102143 >
103- { /* @ts -ignore */ }
104- { run . build ?. images ?. orchestrator ?. requirements || 'n/a' }
144+ { ( pipelineBuild . metadata ?. images ?. orchestrator as {
145+ [ key : string ] : any ;
146+ } ) ?. requirements || 'n/a' }
105147 </ Paragraph >
106148 </ div >
107149 </ details >
@@ -120,15 +162,13 @@ const OrchestratorCard = ({ run }: OrchestratorCardProps) => {
120162 < div >
121163 < Paragraph className = { styles . card__key } > ZenML Version</ Paragraph >
122164 < Paragraph className = { styles . card__value } >
123- { /* @ts -ignore */ }
124- { run . build ?. zenml_version || 'n/a' }
165+ { pipelineBuild . metadata ?. zenml_version || 'n/a' }
125166 </ Paragraph >
126167 </ div >
127168 < div >
128169 < Paragraph className = { styles . card__key } > Python Version</ Paragraph >
129170 < Paragraph className = { styles . card__value } >
130- { /* @ts -ignore */ }
131- { run . build ?. python_version || 'n/a' }
171+ { pipelineBuild . metadata ?. python_version || 'n/a' }
132172 </ Paragraph >
133173 </ div >
134174 </ >
0 commit comments