@@ -62,13 +62,13 @@ export const WorkflowNodeInputs = (props: { inputs: models.Inputs }) => {
62
62
< div className = 'white-box__details' >
63
63
{ parameters . length > 0 && [
64
64
< div className = 'row white-box__details-row' key = 'title' >
65
- < h6 > Parameters</ h6 >
65
+ < p > Parameters</ p >
66
66
</ div > ,
67
67
< AttributeRows key = 'attrs' attributes = { parameters } /> ,
68
68
] }
69
69
{ artifacts . length > 0 && [
70
70
< div className = 'row white-box__details-row' key = 'title' >
71
- < h6 > Artifacts</ h6 >
71
+ < p > Artifacts</ p >
72
72
</ div > ,
73
73
< AttributeRows key = 'attrs' attributes = { artifacts } /> ,
74
74
] }
@@ -77,7 +77,7 @@ export const WorkflowNodeInputs = (props: { inputs: models.Inputs }) => {
77
77
) ;
78
78
} ;
79
79
80
- export const WorkflowNodeContainer = ( props : { nodeId : string , container : models . Container , onShowContainerLogs : ( pod : string , container : string ) => any ; } ) => {
80
+ export const WorkflowNodeContainer = ( props : { nodeId : string , container : models . Container | models . Sidecar , onShowContainerLogs : ( pod : string , container : string ) => any ; } ) => {
81
81
const attributes = [
82
82
{ title : 'NAME' , value : props . container . name || 'main' } ,
83
83
{ title : 'IMAGE' , value : props . container . image } ,
@@ -98,29 +98,36 @@ export const WorkflowNodeContainer = (props: { nodeId: string, container: models
98
98
) ;
99
99
} ;
100
100
101
- export const WorkflowNodeContainers = ( props : Props ) = > {
102
- const template = props . workflow . spec . templates . find ( ( item ) => item . name === props . node . templateName ) ;
103
- if ( ! template || ! template . container ) {
104
- return < p > Step does not have containers </ p > ;
101
+ export class WorkflowNodeContainers extends React . Component < Props , { selectedSidecar : string } > {
102
+ constructor ( props : Props ) {
103
+ super ( props ) ;
104
+ this . state = { selectedSidecar : null } ;
105
105
}
106
- return (
107
- < div >
108
- < WorkflowNodeContainer nodeId = { props . node . id } container = { template . container } onShowContainerLogs = { props . onShowContainerLogs } />
109
- { template . sidecars && template . sidecars . length > 0 && (
110
- < div >
111
- < h6 > SIDECARS:</ h6 >
112
- { template . sidecars . map ( ( sidecar ) => (
113
- < div className = 'row' key = { sidecar . name } >
114
- < div className = 'columns small-3' >
115
- { sidecar . name }
106
+
107
+ public render ( ) {
108
+ const template = this . props . workflow . spec . templates . find ( ( item ) => item . name === this . props . node . templateName ) ;
109
+ if ( ! template || ! template . container ) {
110
+ return < p > Step does not have containers</ p > ;
111
+ }
112
+ const container = this . state . selectedSidecar && template . sidecars . find ( ( item ) => item . name === this . state . selectedSidecar ) || template . container ;
113
+ return (
114
+ < div className = 'workflow-node-info__containers' >
115
+ { this . state . selectedSidecar && < i className = 'fa fa-angle-left workflow-node-info__sidecar-back' onClick = { ( ) => this . setState ( { selectedSidecar : null } ) } /> }
116
+ < WorkflowNodeContainer nodeId = { this . props . node . id } container = { container } onShowContainerLogs = { this . props . onShowContainerLogs } />
117
+ { ! this . state . selectedSidecar && template . sidecars && template . sidecars . length > 0 && (
118
+ < div >
119
+ < p > SIDECARS:</ p >
120
+ { template . sidecars . map ( ( sidecar ) => (
121
+ < div className = 'workflow-node-info__sidecar' key = { sidecar . name } onClick = { ( ) => this . setState ( { selectedSidecar : sidecar . name } ) } >
122
+ < span > { sidecar . name } </ span > < i className = 'fa fa-angle-right' />
116
123
</ div >
117
- </ div >
118
- ) ) }
119
- </ div >
120
- ) }
121
- </ div >
122
- ) ;
123
- } ;
124
+ ) ) }
125
+ </ div >
126
+ ) }
127
+ </ div >
128
+ ) ;
129
+ }
130
+ }
124
131
125
132
export const WorkflowNodeArtifacts = ( props : Props ) => {
126
133
const artifacts = props . node . outputs && props . node . outputs . artifacts && props . node . outputs . artifacts . map ( ( artifact ) => Object . assign ( { } , artifact , {
0 commit comments