@@ -20,6 +20,7 @@ import { EditFlyout } from '../edit_flyout';
2020import { ExplanationFlyout } from '../explanation_flyout' ;
2121import { ImportView } from '../import_view' ;
2222import {
23+ DEFAULT_LINES_TO_SAMPLE ,
2324 getMaxBytes ,
2425 readFile ,
2526 createUrlOverrides ,
@@ -55,7 +56,9 @@ export class FileDataVisualizerView extends Component {
5556
5657 this . overrides = { } ;
5758 this . previousOverrides = { } ;
58- this . originalSettings = { } ;
59+ this . originalSettings = {
60+ linesToSample : DEFAULT_LINES_TO_SAMPLE ,
61+ } ;
5962 this . maxFileUploadBytes = getMaxBytes ( ) ;
6063 }
6164
@@ -129,7 +132,7 @@ export class FileDataVisualizerView extends Component {
129132 const serverSettings = processResults ( resp ) ;
130133 const serverOverrides = resp . overrides ;
131134
132- this . previousOverrides = this . overrides ;
135+ this . previousOverrides = overrides ;
133136 this . overrides = { } ;
134137
135138 if ( serverSettings . format === 'xml' ) {
@@ -185,9 +188,8 @@ export class FileDataVisualizerView extends Component {
185188 serverError : error ,
186189 } ) ;
187190
188- // as long as the previous overrides are different to the current overrides,
189191 // reload the results with the previous overrides
190- if ( overrides !== undefined && isEqual ( this . previousOverrides , overrides ) === false ) {
192+ if ( isRetry === false ) {
191193 this . setState ( {
192194 loading : true ,
193195 loaded : false ,
@@ -244,6 +246,11 @@ export class FileDataVisualizerView extends Component {
244246 } ;
245247
246248 onCancel = ( ) => {
249+ this . overrides = { } ;
250+ this . previousOverrides = { } ;
251+ this . originalSettings = {
252+ linesToSample : DEFAULT_LINES_TO_SAMPLE ,
253+ } ;
247254 this . changeMode ( MODE . READ ) ;
248255 this . onFilePickerChange ( [ ] ) ;
249256 } ;
@@ -276,7 +283,7 @@ export class FileDataVisualizerView extends Component {
276283 return (
277284 < div >
278285 { mode === MODE . READ && (
279- < React . Fragment >
286+ < >
280287 { ! loading && ! loaded && < AboutPanel onFilePickerChange = { this . onFilePickerChange } /> }
281288
282289 { loading && < LoadingPanel /> }
@@ -286,10 +293,14 @@ export class FileDataVisualizerView extends Component {
286293 ) }
287294
288295 { fileCouldNotBeRead && loading === false && (
289- < React . Fragment >
290- < FileCouldNotBeRead error = { serverError } loaded = { loaded } />
296+ < >
297+ < FileCouldNotBeRead
298+ error = { serverError }
299+ loaded = { loaded }
300+ showEditFlyout = { this . showEditFlyout }
301+ />
291302 < EuiSpacer size = "l" />
292- </ React . Fragment >
303+ </ >
293304 ) }
294305
295306 { loaded && (
@@ -298,8 +309,8 @@ export class FileDataVisualizerView extends Component {
298309 explanation = { explanation }
299310 fileName = { fileName }
300311 data = { fileContents }
301- showEditFlyout = { ( ) => this . showEditFlyout ( ) }
302- showExplanationFlyout = { ( ) => this . showExplanationFlyout ( ) }
312+ showEditFlyout = { this . showEditFlyout }
313+ showExplanationFlyout = { this . showExplanationFlyout }
303314 disableButtons = { isEditFlyoutVisible || isExplanationFlyoutVisible }
304315 />
305316 ) }
@@ -317,19 +328,20 @@ export class FileDataVisualizerView extends Component {
317328 ) }
318329
319330 { bottomBarVisible && loaded && (
320- < BottomBar
321- mode = { MODE . READ }
322- onChangeMode = { this . changeMode }
323- onCancel = { this . onCancel }
324- disableImport = { hasPermissionToImport === false }
325- />
331+ < >
332+ < BottomBar
333+ mode = { MODE . READ }
334+ onChangeMode = { this . changeMode }
335+ onCancel = { this . onCancel }
336+ disableImport = { hasPermissionToImport === false }
337+ />
338+ < BottomPadding />
339+ </ >
326340 ) }
327-
328- < BottomPadding />
329- </ React . Fragment >
341+ </ >
330342 ) }
331343 { mode === MODE . IMPORT && (
332- < React . Fragment >
344+ < >
333345 < ImportView
334346 results = { results }
335347 fileName = { fileName }
@@ -342,15 +354,16 @@ export class FileDataVisualizerView extends Component {
342354 />
343355
344356 { bottomBarVisible && (
345- < BottomBar
346- mode = { MODE . IMPORT }
347- onChangeMode = { this . changeMode }
348- onCancel = { this . onCancel }
349- />
357+ < >
358+ < BottomBar
359+ mode = { MODE . IMPORT }
360+ onChangeMode = { this . changeMode }
361+ onCancel = { this . onCancel }
362+ />
363+ < BottomPadding />
364+ </ >
350365 ) }
351-
352- < BottomPadding />
353- </ React . Fragment >
366+ </ >
354367 ) }
355368 </ div >
356369 ) ;
@@ -360,10 +373,10 @@ export class FileDataVisualizerView extends Component {
360373function BottomPadding ( ) {
361374 // padding for the BottomBar
362375 return (
363- < React . Fragment >
376+ < >
364377 < EuiSpacer size = "m" />
365378 < EuiSpacer size = "l" />
366379 < EuiSpacer size = "l" />
367- </ React . Fragment >
380+ </ >
368381 ) ;
369382}
0 commit comments