@@ -58,7 +58,7 @@ export const StepNode: React.FunctionComponent<StepProps> = ({ element }) => {
5858 ) : null ;
5959
6060 return (
61- < TaskNode element = { element } status = { data ?. status } >
61+ < TaskNode element = { element } selected = { data ?. selected } status = { data ?. status } onSelect = { ( ) => data ?. onSelect ?. ( ) } >
6262 { whenDecorator }
6363 </ TaskNode >
6464 ) ;
@@ -89,9 +89,11 @@ const pipelineComponentFactory = (kind: ModelKind, type: string) => {
8989
9090export type FlowCollectorPipelineProps = {
9191 existing : K8sResourceKind | null ;
92+ selectedTypes : string [ ] ;
93+ setSelectedTypes : ( types : string [ ] ) => void ;
9294} ;
9395
94- export const Pipeline : React . FC < FlowCollectorPipelineProps > = ( { existing } ) => {
96+ export const Pipeline : React . FC < FlowCollectorPipelineProps > = ( { existing, selectedTypes , setSelectedTypes } ) => {
9597 const containerRef = React . createRef < HTMLDivElement > ( ) ;
9698 const [ controller , setController ] = React . useState < Visualization > ( ) ;
9799
@@ -128,23 +130,32 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
128130 const steps : Step [ ] = [ ] ;
129131
130132 if ( existing ?. spec ?. agent ?. type === 'eBPF' ) {
133+ const types = [ 'Ready' ] ;
131134 steps . push ( {
132135 id : 'ebpf' ,
133136 label : 'eBPF agents' ,
134137 data : {
135- status : getStatus ( [ 'Ready' ] , K8sResourceConditionStatus . True )
138+ status : getStatus ( types , K8sResourceConditionStatus . True ) ,
139+ selected : _ . some ( selectedTypes , t => types . includes ( t ) ) ,
140+ onSelect : ( ) => setSelectedTypes ( types )
136141 }
137142 } ) ;
138143 }
139144
140145 const flpStatuses = [ 'WaitingFLPParent' , 'WaitingFLPMonolith' ] ;
141146 if ( existing ?. spec ?. deploymentModel === 'Kafka' ) {
147+ const types = [ 'WaitingFLPTransformer' ] ;
142148 steps . push ( {
143149 id : 'kafka' ,
144150 label : 'Kafka' ,
145- runAfterTasks : [ 'ebpf' ]
151+ runAfterTasks : [ 'ebpf' ] ,
152+ data : {
153+ status : getStatus ( types , K8sResourceConditionStatus . False ) ,
154+ selected : _ . some ( selectedTypes , t => types . includes ( t ) ) ,
155+ onSelect : ( ) => setSelectedTypes ( types )
156+ }
146157 } ) ;
147- flpStatuses . push ( 'WaitingFLPTransformer' ) ;
158+ flpStatuses . push ( ... types ) ;
148159 }
149160
150161 if ( existing ?. spec ) {
@@ -153,19 +164,24 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
153164 label : 'Flowlogs pipeline' ,
154165 runAfterTasks : [ _ . last ( steps ) ! . id ] ,
155166 data : {
156- status : getStatus ( flpStatuses , K8sResourceConditionStatus . False )
167+ status : getStatus ( flpStatuses , K8sResourceConditionStatus . False ) ,
168+ selected : _ . some ( selectedTypes , t => flpStatuses . includes ( t ) ) ,
169+ onSelect : ( ) => setSelectedTypes ( flpStatuses )
157170 }
158171 } ) ;
159172 }
160173
161174 const cpRunAfter : string [ ] = [ ] ;
162175 if ( existing ?. spec ?. loki ?. enable ) {
176+ const types = [ 'LokiIssue' ] ;
163177 steps . push ( {
164178 id : 'loki' ,
165179 label : 'Loki' ,
166180 runAfterTasks : [ 'flp' ] ,
167181 data : {
168- status : getStatus ( [ 'LokiIssue' ] , 'NoIssue' ) // TODO: NoIssue / Unknown is not a valid status. That should be False.
182+ status : getStatus ( types , 'NoIssue' ) , // TODO: NoIssue / Unknown is not a valid status. That should be False.
183+ selected : _ . some ( selectedTypes , t => types . includes ( t ) ) ,
184+ onSelect : ( ) => setSelectedTypes ( types )
169185 }
170186 } ) ;
171187 cpRunAfter . push ( 'loki' ) ;
@@ -175,7 +191,10 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
175191 steps . push ( {
176192 id : 'prom' ,
177193 label : 'Prometheus' ,
178- runAfterTasks : [ 'flp' ]
194+ runAfterTasks : [ 'flp' ] ,
195+ data : {
196+ onSelect : ( ) => setSelectedTypes ( [ ] )
197+ }
179198 } ) ;
180199 cpRunAfter . push ( 'prom' ) ;
181200 }
@@ -185,7 +204,10 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
185204 steps . push ( {
186205 id : `exporter-${ i } ` ,
187206 label : exporter . type || t ( 'Unknown' ) ,
188- runAfterTasks : [ 'flp' ]
207+ runAfterTasks : [ 'flp' ] ,
208+ data : {
209+ onSelect : ( ) => setSelectedTypes ( [ ] )
210+ }
189211 } ) ;
190212 } ) ;
191213 }
@@ -194,7 +216,10 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
194216 steps . push ( {
195217 id : 'plugin' ,
196218 label : 'Console plugin' ,
197- runAfterTasks : cpRunAfter
219+ runAfterTasks : cpRunAfter ,
220+ data : {
221+ onSelect : ( ) => setSelectedTypes ( [ ] )
222+ }
198223 } ) ;
199224 }
200225
@@ -207,7 +232,7 @@ export const Pipeline: React.FC<FlowCollectorPipelineProps> = ({ existing }) =>
207232 } ,
208233 ...s
209234 } ) ) as PipelineNodeModel [ ] ;
210- } , [ existing , getStatus ] ) ;
235+ } , [ existing , getStatus , selectedTypes , setSelectedTypes ] ) ;
211236
212237 React . useEffect ( ( ) => {
213238 if ( containerRef . current ) {
0 commit comments