@@ -13,23 +13,8 @@ import {
1313 refreshInputDocuments ,
1414 toggleInputDocumentsCollapsed ,
1515} from '../../modules/input-documents' ;
16- import {
17- gotoMergeResults ,
18- gotoOutResults ,
19- runOutStage ,
20- runStage ,
21- stageAdded ,
22- stageAddedAfter ,
23- stageChanged ,
24- stageCollapseToggled ,
25- stageDeleted ,
26- stageMoved ,
27- stageOperatorSelected ,
28- stageToggled ,
29- } from '../../modules/pipeline' ;
30- import { setIsModified } from '../../modules/is-modified' ;
3116import { openLink } from '../../modules/link' ;
32- import { projectionsChanged } from '../../modules/projections ' ;
17+ import { moveStage } from '../../modules/pipeline-builder/stage-editor ' ;
3318
3419const SortableStage = sortableElement ( ( { idx, ...props } ) => {
3520 return < Stage index = { idx } { ...props } > </ Stage > ;
@@ -43,36 +28,13 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
4328 static displayName = 'PipelineBuilderUIWorkspace' ;
4429
4530 static propTypes = {
31+ stageIds : PropTypes . array . isRequired ,
4632 editViewName : PropTypes . string ,
47- env : PropTypes . string . isRequired ,
48- isTimeSeries : PropTypes . bool . isRequired ,
49- isReadonly : PropTypes . bool . isRequired ,
50- sourceName : PropTypes . string ,
51- pipeline : PropTypes . array . isRequired ,
33+ inputDocuments : PropTypes . object . isRequired ,
34+ onStageMoveEnd : PropTypes . func . isRequired ,
5235 toggleInputDocumentsCollapsed : PropTypes . func . isRequired ,
5336 refreshInputDocuments : PropTypes . func . isRequired ,
54- stageAdded : PropTypes . func . isRequired ,
55- setIsModified : PropTypes . func . isRequired ,
56- openLink : PropTypes . func . isRequired ,
57- isCommenting : PropTypes . bool . isRequired ,
58- isAutoPreviewing : PropTypes . bool . isRequired ,
59- inputDocuments : PropTypes . object . isRequired ,
60- runStage : PropTypes . func . isRequired ,
61- runOutStage : PropTypes . func . isRequired ,
62- gotoOutResults : PropTypes . func . isRequired ,
63- gotoMergeResults : PropTypes . func . isRequired ,
64- serverVersion : PropTypes . string . isRequired ,
65- stageChanged : PropTypes . func . isRequired ,
66- stageCollapseToggled : PropTypes . func . isRequired ,
67- stageAddedAfter : PropTypes . func . isRequired ,
68- stageDeleted : PropTypes . func . isRequired ,
69- stageMoved : PropTypes . func . isRequired ,
70- stageOperatorSelected : PropTypes . func . isRequired ,
71- stageToggled : PropTypes . func . isRequired ,
72- fields : PropTypes . array . isRequired ,
73- projections : PropTypes . array . isRequired ,
74- projectionsChanged : PropTypes . func . isRequired ,
75- isAtlasDeployed : PropTypes . bool ,
37+ openLink : PropTypes . func . isRequired
7638 } ;
7739
7840 /**
@@ -82,10 +44,7 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
8244 * @param {Number } toIndex - The index to move to.
8345 */
8446 onStageMoved = ( { oldIndex, newIndex } ) => {
85- if ( oldIndex !== newIndex ) {
86- this . props . stageMoved ( oldIndex , newIndex ) ;
87- this . props . runStage ( 0 , true /* force execute */ ) ;
88- }
47+ this . props . onStageMoveEnd ( oldIndex , newIndex ) ;
8948 } ;
9049
9150 /**
@@ -99,60 +58,6 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
9958 }
10059 }
10160
102- /**
103- * Render a stage.
104- *
105- * @param {Object } stage - The current stage info.
106- * @param {Number } i - The current index.
107- * @param {Function } connectDragSource - The function to render a stage editor toolbar.
108- *
109- * @returns {Component } The component.
110- */
111- renderStage = ( stage , i ) => {
112- return (
113- < SortableStage
114- key = { stage . id }
115- idx = { i }
116- index = { i }
117- env = { this . props . env }
118- isTimeSeries = { this . props . isTimeSeries }
119- isReadonly = { this . props . isReadonly }
120- sourceName = { this . props . sourceName }
121- stage = { stage . stage ?? '' }
122- stageOperator = { stage . stageOperator }
123- error = { stage . error }
124- syntaxError = { stage . syntaxError }
125- isValid = { stage . isValid }
126- isEnabled = { stage . isEnabled }
127- isLoading = { stage . isLoading }
128- isComplete = { stage . isComplete }
129- isMissingAtlasOnlyStageSupport = { stage . isMissingAtlasOnlyStageSupport }
130- isExpanded = { stage . isExpanded }
131- isCommenting = { this . props . isCommenting }
132- isAutoPreviewing = { this . props . isAutoPreviewing }
133- previewDocuments = { stage . previewDocuments }
134- runStage = { this . props . runStage }
135- openLink = { this . props . openLink }
136- runOutStage = { this . props . runOutStage }
137- gotoOutResults = { this . props . gotoOutResults }
138- gotoMergeResults = { this . props . gotoMergeResults }
139- serverVersion = { this . props . serverVersion }
140- stageChanged = { this . props . stageChanged }
141- stageCollapseToggled = { this . props . stageCollapseToggled }
142- stageAddedAfter = { this . props . stageAddedAfter }
143- stageDeleted = { this . props . stageDeleted }
144- stageMoved = { this . props . stageMoved }
145- stageOperatorSelected = { this . props . stageOperatorSelected }
146- stageToggled = { this . props . stageToggled }
147- fields = { this . props . fields }
148- setIsModified = { this . props . setIsModified }
149- projections = { this . props . projections }
150- projectionsChanged = { this . props . projectionsChanged }
151- isAtlasDeployed = { this . props . isAtlasDeployed }
152- />
153- ) ;
154- } ;
155-
15661 /**
15762 * Render a stage list.
15863 *
@@ -174,8 +79,8 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
17479 // interactive elements in the handler toolbar component
17580 distance = { 10 }
17681 >
177- { this . props . pipeline . map ( ( stage , idx ) => {
178- return this . renderStage ( stage , idx ) ;
82+ { this . props . stageIds . map ( ( id , index ) => {
83+ return < SortableStage key = { id } idx = { index } index = { index } /> ;
17984 } ) }
18085 </ SortableContainer >
18186 ) ;
@@ -210,10 +115,7 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
210115 count = { inputDocuments . count }
211116 />
212117 { this . renderStageList ( ) }
213- < AddStage
214- stageAdded = { this . props . stageAdded }
215- setIsModified = { this . props . setIsModified }
216- />
118+ < AddStage />
217119 </ div >
218120 </ div >
219121 </ div >
@@ -226,39 +128,16 @@ export class PipelineBuilderUIWorkspace extends PureComponent {
226128 * @param {import('./../../modules/').RootState } state
227129 */
228130const mapState = ( state ) => ( {
131+ stageIds : state . pipelineBuilder . stageEditor . stageIds ,
229132 editViewName : state . editViewName ,
230- env : state . env ,
231- isTimeSeries : state . isTimeSeries ,
232- isReadonly : state . isReadonly ,
233- sourceName : state . sourceName ,
234- pipeline : state . pipeline ,
235- isCommenting : state . comments ,
236- isAutoPreviewing : state . autoPreview ,
237- inputDocuments : state . inputDocuments ,
238- serverVersion : state . serverVersion ,
239- fields : state . fields ,
240- projections : state . projections ,
241- isAtlasDeployed : state . isAtlasDeployed ,
133+ inputDocuments : state . inputDocuments
242134} ) ;
243135
244136const mapDispatch = {
137+ onStageMoveEnd : moveStage ,
245138 toggleInputDocumentsCollapsed,
246139 refreshInputDocuments,
247- stageAdded,
248- setIsModified,
249- openLink,
250- runStage,
251- runOutStage,
252- gotoOutResults,
253- gotoMergeResults,
254- stageChanged,
255- stageCollapseToggled,
256- stageAddedAfter,
257- stageDeleted,
258- stageMoved,
259- stageOperatorSelected,
260- stageToggled,
261- projectionsChanged,
140+ openLink
262141} ;
263142
264143export default connect ( mapState , mapDispatch ) ( PipelineBuilderUIWorkspace ) ;
0 commit comments