@@ -34,40 +34,70 @@ export function ImportProgress({ statuses }) {
3434
3535 let statusInfo = null ;
3636
37- let processFileTitle = 'Process file' ;
37+ let completedStep = 0 ;
38+
3839 if ( reading === true && readStatus === IMPORT_STATUS . INCOMPLETE ) {
39- processFileTitle = 'Processing file' ;
40- statusInfo = ( < p > Converting file for import</ p > ) ;
41- } else if ( reading === false && readStatus === IMPORT_STATUS . COMPLETE ) {
42- processFileTitle = 'File processed' ;
40+ completedStep = 0 ;
41+ }
42+ if (
43+ readStatus === IMPORT_STATUS . COMPLETE &&
44+ indexCreatedStatus === IMPORT_STATUS . INCOMPLETE &&
45+ ingestPipelineCreatedStatus === IMPORT_STATUS . INCOMPLETE
46+ ) {
47+ completedStep = 1 ;
4348 }
44-
45- let createIndexTitle = 'Create index' ;
4649 if ( indexCreatedStatus === IMPORT_STATUS . COMPLETE ) {
47- createIndexTitle = 'Index created' ;
50+ completedStep = 2 ;
4851 }
49-
50- let createIngestPipelineTitle = 'Create ingest pipeline' ;
5152 if ( ingestPipelineCreatedStatus === IMPORT_STATUS . COMPLETE ) {
52- createIngestPipelineTitle = 'Ingest pipeline created' ;
53+ completedStep = 3 ;
54+ }
55+ if ( uploadStatus === IMPORT_STATUS . COMPLETE ) {
56+ completedStep = 4 ;
5357 }
58+ if ( indexPatternCreatedStatus === IMPORT_STATUS . COMPLETE ) {
59+ completedStep = 5 ;
60+ }
61+
5462
63+ let processFileTitle = 'Process file' ;
64+ let createIndexTitle = 'Create index' ;
65+ let createIngestPipelineTitle = 'Create ingest pipeline' ;
5566 let uploadingDataTitle = 'Upload data' ;
56- if ( uploadProgress > 0 && uploadStatus === IMPORT_STATUS . INCOMPLETE ) {
57- uploadingDataTitle = 'Uploading data' ;
67+ let createIndexPatternTitle = 'Create index pattern' ;
5868
69+ if ( completedStep >= 0 ) {
70+ processFileTitle = 'Processing file' ;
71+ statusInfo = ( < p > Converting file for import</ p > ) ;
72+ }
73+ if ( completedStep >= 1 ) {
74+ processFileTitle = 'File processed' ;
75+ createIndexTitle = 'Creating index' ;
76+ statusInfo = ( < p > Creating index and ingest pipeline</ p > ) ;
77+ }
78+ if ( completedStep >= 2 ) {
79+ createIndexTitle = 'Index created' ;
80+ createIngestPipelineTitle = 'Creating ingest pipeline' ;
81+ statusInfo = ( < p > Creating index and ingest pipeline</ p > ) ;
82+ }
83+ if ( completedStep >= 3 ) {
84+ createIngestPipelineTitle = 'Ingest pipeline created' ;
85+ uploadingDataTitle = 'Uploading data' ;
5986 statusInfo = ( < UploadFunctionProgress progress = { uploadProgress } /> ) ;
60- } else if ( uploadStatus === IMPORT_STATUS . COMPLETE ) {
87+ }
88+ if ( completedStep >= 4 ) {
6189 uploadingDataTitle = 'Data uploaded' ;
90+ if ( createIndexPattern === true ) {
91+ createIndexPatternTitle = 'Creating index pattern' ;
92+ statusInfo = ( < p > Creating index pattern</ p > ) ;
93+ }
6294 }
63-
64- let createIndexPatternTitle = 'Create index pattern' ;
65- if ( indexPatternCreatedStatus === IMPORT_STATUS . FAILED ) {
95+ if ( completedStep >= 5 ) {
6696 createIndexPatternTitle = 'Index pattern created' ;
6797 statusInfo = null ;
6898 }
6999
70- const firstSetOfSteps = [
100+ const steps = [
71101 {
72102 title : processFileTitle ,
73103 isSelected : true ,
@@ -91,15 +121,15 @@ export function ImportProgress({ statuses }) {
91121 } ,
92122 {
93123 title : uploadingDataTitle ,
94- isSelected : ( indexCreatedStatus === IMPORT_STATUS . COMPLETE ) ,
124+ isSelected : ( indexCreatedStatus === IMPORT_STATUS . COMPLETE && ingestPipelineCreatedStatus === IMPORT_STATUS . COMPLETE ) ,
95125 isComplete : ( uploadStatus === IMPORT_STATUS . COMPLETE ) ,
96126 status : uploadStatus ,
97127 onClick : ( ) => { } ,
98128 }
99129 ] ;
100130
101131 if ( createIndexPattern === true ) {
102- firstSetOfSteps . push ( {
132+ steps . push ( {
103133 title : createIndexPatternTitle ,
104134 isSelected : ( uploadStatus === IMPORT_STATUS . COMPLETE ) ,
105135 isComplete : ( indexPatternCreatedStatus === IMPORT_STATUS . COMPLETE ) ,
@@ -111,9 +141,14 @@ export function ImportProgress({ statuses }) {
111141 return (
112142 < React . Fragment >
113143 < EuiStepsHorizontal
114- steps = { firstSetOfSteps }
144+ steps = { steps }
115145 />
116- { statusInfo }
146+ { statusInfo &&
147+ < React . Fragment >
148+ < EuiSpacer size = "m" />
149+ { statusInfo }
150+ </ React . Fragment >
151+ }
117152 </ React . Fragment >
118153 ) ;
119154}
0 commit comments