From 473b3935e1788e5b088a685836c254a7cd2b51e4 Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Thu, 29 Aug 2019 13:56:52 -0600 Subject: [PATCH 1/2] Set complete on index pattern creation --- .../public/components/json_upload_and_parse.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js b/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js index dca8c966deb03..2a4265d0d2099 100644 --- a/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js +++ b/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js @@ -154,7 +154,9 @@ export class JsonUploadAndParse extends Component { } // Indexing complete, update state & callback (if any) - this.setState({ currentIndexingStage: INDEXING_STAGE.INDEXING_COMPLETE }); + this.setState({ + currentIndexingStage: INDEXING_STAGE.INDEX_PATTERN_COMPLETE + }); if (onIndexingComplete) { onIndexingComplete({ indexDataResp, @@ -221,7 +223,9 @@ export class JsonUploadAndParse extends Component { importStage={currentIndexingStage} indexDataResp={indexDataResp} indexPatternResp={indexPatternResp} - complete={currentIndexingStage === INDEXING_STAGE.INDEXING_COMPLETE} + complete={ + currentIndexingStage === INDEXING_STAGE.INDEX_PATTERN_COMPLETE + } indexName={indexName} /> : ( From dfb47ed8755ad024bccf14f6281b94864e86cbe5 Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Mon, 9 Sep 2019 17:09:19 -0600 Subject: [PATCH 2/2] Set complete on error as well. Pass resp to callback function on timeout error --- .../public/components/json_upload_and_parse.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js b/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js index 2a4265d0d2099..d5f9a21d6454d 100644 --- a/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js +++ b/x-pack/legacy/plugins/file_upload/public/components/json_upload_and_parse.js @@ -24,13 +24,16 @@ const INDEXING_STAGE = { WRITING_TO_INDEX: i18n.translate( 'xpack.fileUpload.jsonUploadAndParse.writingToIndex', { defaultMessage: 'Writing to index' }), + INDEXING_COMPLETE: i18n.translate( + 'xpack.fileUpload.jsonUploadAndParse.indexingComplete', + { defaultMessage: 'Indexing complete' }), CREATING_INDEX_PATTERN: i18n.translate( 'xpack.fileUpload.jsonUploadAndParse.creatingIndexPattern', { defaultMessage: 'Creating index pattern' }), INDEX_PATTERN_COMPLETE: i18n.translate( 'xpack.fileUpload.jsonUploadAndParse.indexPatternComplete', { defaultMessage: 'Index pattern complete' }), - DATA_INDEXING_ERROR: i18n.translate( + INDEXING_ERROR: i18n.translate( 'xpack.fileUpload.jsonUploadAndParse.dataIndexingError', { defaultMessage: 'Data indexing error' }), INDEX_PATTERN_ERROR: i18n.translate( @@ -134,11 +137,11 @@ export class JsonUploadAndParse extends Component { indexedFile: null, indexDataResp, indexRequestInFlight: false, - currentIndexingStage: INDEXING_STAGE.INDEXING_COMPLETE, + currentIndexingStage: INDEXING_STAGE.INDEXING_ERROR, }); this._resetFileAndIndexSettings(); if (onIndexingComplete) { - onIndexingComplete(); + onIndexingComplete({ indexDataResp }); } return; } @@ -147,6 +150,7 @@ export class JsonUploadAndParse extends Component { this.setState({ indexDataResp, indexedFile: parsedFile, + currentIndexingStage: INDEXING_STAGE.INDEXING_COMPLETE, }); let indexPatternResp; if (boolCreateIndexPattern) { @@ -225,6 +229,7 @@ export class JsonUploadAndParse extends Component { indexPatternResp={indexPatternResp} complete={ currentIndexingStage === INDEXING_STAGE.INDEX_PATTERN_COMPLETE + || currentIndexingStage === INDEXING_STAGE.INDEXING_ERROR } indexName={indexName} />