-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Adding initial file analysis overrides #74376
Merged
jgowdyelastic
merged 8 commits into
elastic:master
from
jgowdyelastic:adding-initial-file-analysis-overrides
Aug 11, 2020
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
851fffb
[ML] Adding initial file analysis overrides
jgowdyelastic ff05982
using common default sample lines
jgowdyelastic 205d370
correcting bottom padding
jgowdyelastic 0a6c91b
adding missed padding
jgowdyelastic 1ea0ff8
code clean up
jgowdyelastic bde656c
Merge branch 'master' into adding-initial-file-analysis-overrides
elasticmachine afb02fb
Merge branch 'master' into adding-initial-file-analysis-overrides
elasticmachine 6421627
fixing translations
jgowdyelastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import { EditFlyout } from '../edit_flyout'; | |
import { ExplanationFlyout } from '../explanation_flyout'; | ||
import { ImportView } from '../import_view'; | ||
import { | ||
DEFAULT_LINES_TO_SAMPLE, | ||
getMaxBytes, | ||
readFile, | ||
createUrlOverrides, | ||
|
@@ -55,7 +56,9 @@ export class FileDataVisualizerView extends Component { | |
|
||
this.overrides = {}; | ||
this.previousOverrides = {}; | ||
this.originalSettings = {}; | ||
this.originalSettings = { | ||
linesToSample: DEFAULT_LINES_TO_SAMPLE, | ||
}; | ||
this.maxFileUploadBytes = getMaxBytes(); | ||
} | ||
|
||
|
@@ -129,7 +132,7 @@ export class FileDataVisualizerView extends Component { | |
const serverSettings = processResults(resp); | ||
const serverOverrides = resp.overrides; | ||
|
||
this.previousOverrides = this.overrides; | ||
this.previousOverrides = overrides; | ||
this.overrides = {}; | ||
|
||
if (serverSettings.format === 'xml') { | ||
|
@@ -185,9 +188,8 @@ export class FileDataVisualizerView extends Component { | |
serverError: error, | ||
}); | ||
|
||
// as long as the previous overrides are different to the current overrides, | ||
// reload the results with the previous overrides | ||
if (overrides !== undefined && isEqual(this.previousOverrides, overrides) === false) { | ||
if (isRetry === false) { | ||
this.setState({ | ||
loading: true, | ||
loaded: false, | ||
|
@@ -244,6 +246,11 @@ export class FileDataVisualizerView extends Component { | |
}; | ||
|
||
onCancel = () => { | ||
this.overrides = {}; | ||
this.previousOverrides = {}; | ||
this.originalSettings = { | ||
linesToSample: DEFAULT_LINES_TO_SAMPLE, | ||
}; | ||
this.changeMode(MODE.READ); | ||
this.onFilePickerChange([]); | ||
}; | ||
|
@@ -276,8 +283,12 @@ export class FileDataVisualizerView extends Component { | |
return ( | ||
<div> | ||
{mode === MODE.READ && ( | ||
<React.Fragment> | ||
{!loading && !loaded && <AboutPanel onFilePickerChange={this.onFilePickerChange} />} | ||
<> | ||
{!loading && !loaded && ( | ||
<> | ||
<AboutPanel onFilePickerChange={this.onFilePickerChange} /> | ||
</> | ||
)} | ||
|
||
{loading && <LoadingPanel />} | ||
|
||
|
@@ -286,10 +297,14 @@ export class FileDataVisualizerView extends Component { | |
)} | ||
|
||
{fileCouldNotBeRead && loading === false && ( | ||
<React.Fragment> | ||
<FileCouldNotBeRead error={serverError} loaded={loaded} /> | ||
<> | ||
<FileCouldNotBeRead | ||
error={serverError} | ||
loaded={loaded} | ||
showEditFlyout={() => this.showEditFlyout()} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does |
||
/> | ||
<EuiSpacer size="l" /> | ||
</React.Fragment> | ||
</> | ||
)} | ||
|
||
{loaded && ( | ||
|
@@ -317,19 +332,20 @@ export class FileDataVisualizerView extends Component { | |
)} | ||
|
||
{bottomBarVisible && loaded && ( | ||
<BottomBar | ||
mode={MODE.READ} | ||
onChangeMode={this.changeMode} | ||
onCancel={this.onCancel} | ||
disableImport={hasPermissionToImport === false} | ||
/> | ||
<> | ||
<BottomBar | ||
mode={MODE.READ} | ||
onChangeMode={this.changeMode} | ||
onCancel={this.onCancel} | ||
disableImport={hasPermissionToImport === false} | ||
/> | ||
<BottomPadding /> | ||
</> | ||
)} | ||
|
||
<BottomPadding /> | ||
</React.Fragment> | ||
</> | ||
)} | ||
{mode === MODE.IMPORT && ( | ||
<React.Fragment> | ||
<> | ||
<ImportView | ||
results={results} | ||
fileName={fileName} | ||
|
@@ -342,15 +358,16 @@ export class FileDataVisualizerView extends Component { | |
/> | ||
|
||
{bottomBarVisible && ( | ||
<BottomBar | ||
mode={MODE.IMPORT} | ||
onChangeMode={this.changeMode} | ||
onCancel={this.onCancel} | ||
/> | ||
<> | ||
<BottomBar | ||
mode={MODE.IMPORT} | ||
onChangeMode={this.changeMode} | ||
onCancel={this.onCancel} | ||
/> | ||
<BottomPadding /> | ||
</> | ||
)} | ||
|
||
<BottomPadding /> | ||
</React.Fragment> | ||
</> | ||
)} | ||
</div> | ||
); | ||
|
@@ -360,10 +377,10 @@ export class FileDataVisualizerView extends Component { | |
function BottomPadding() { | ||
// padding for the BottomBar | ||
return ( | ||
<React.Fragment> | ||
<> | ||
<EuiSpacer size="m" /> | ||
<EuiSpacer size="l" /> | ||
<EuiSpacer size="l" /> | ||
</React.Fragment> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ export { | |
readFile, | ||
getMaxBytes, | ||
getMaxBytesFormatted, | ||
DEFAULT_LINES_TO_SAMPLE, | ||
} from './utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this fragment wrapper can be removed since it's only one element on the inside, maybe a leftover from refactoring?