Skip to content
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] File datavisualizer initial commit #22828

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Sep 7, 2018

Initial commit of the File Datavisualizer.
This allows the user to upload a file which is passed to the new find_file_structure endpoint.
The results are then displayed on the page.

image

The page can be found here:
<kibana address>/app/ml#/filedatavisualizer
The default max upload size is pretty small. I added this to my kibana.dev.yml file:
server.maxPayloadBytes: 104857600 # 100MB

@elasticmachine
Copy link
Contributor

💔 Build Failed

@sophiec20 sophiec20 added the :ml label Sep 7, 2018
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial comments. Looks good so far!

@@ -0,0 +1,88 @@
.card-container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could any of these settings be used in the existing index based datavisualizer once that is converted to sass? Just wondering if some of these should be moved to a higher level scss file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i imagine there will be common rules which can be moved to a shared location once the big sass conversion has happened

<div className="card-contents">
<div className="stats">
<div className="stat">
<i className="fa fa-files-o" aria-hidden="true" /> {field.count} documents ({percent}%)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add a check for 1 document here and switch documents to document

<i className="fa fa-files-o" aria-hidden="true" /> {field.count} documents ({percent}%)
</div>
<div className="stat">
<i className="fa fa-cubes" aria-hidden="true" /> {field.cardinality} distinct values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above - check cardinality and output values or value

);
}

function getTypeColor(type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be done in css instead, using the same styles as used in /ml/public/components/field_data_card/styles/main.less ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it can and makes the code simpler.

super(props);

this.fields = createFields(this.props.results);
console.log(this.fields);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this console.log in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i'm leaving logging in as it's a work in progress

function createDisplayItems(results) {
const items = [
{
title: 'Number of lines analysed',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be analyzed!

import fs from 'fs';
import os from 'os';
const util = require('util');
// const readFile = util.promisify(fs.readFile);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out line still needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm leaving this commented code in as this is a work in progress and will eventually be used.

const writeFile = util.promisify(fs.writeFile);

export function fileDataVisualizerProvider(callWithRequest) {
async function analyseFile(data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be analyzeFile for consistency with DataVisualizer I think, and the route which is analyzeFile

}
}

// async function cacheData2(data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking you want to keep this commented out code for now?

import { wrapError } from '../client/errors';
import { fileDataVisualizerProvider } from '../models/file_data_visualizer';

function analyseFiles(callWithRequest, data) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To analyzeFiles ?

@jgowdyelastic jgowdyelastic force-pushed the file-datavisualizer-initial-commit branch from 1ca213b to 9bd18a7 Compare September 11, 2018 12:12
@elasticmachine
Copy link
Contributor

💔 Build Failed

@jgowdyelastic jgowdyelastic changed the base branch from feature/file-datavisualizer to master September 11, 2018 12:25
@jgowdyelastic jgowdyelastic changed the base branch from master to feature/file-datavisualizer September 11, 2018 12:25

if (data !== null) {
try {
const resp = await ml.analyseFile(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total nit, double space

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM at this stage - further on might be worth looking into reducing redundancy with original data visualizer.

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor comments. Otherwise all your changes LGTM.

<div style={{ textAlign: 'center' }} >
<EuiFilePicker
id="filePicker"
initialPromptText="Select or drag and drop a log file"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should just say 'Select or drag and drop a file'? Do we need the word 'log' in there?

export function MLJobEditor({ value, height = '500px', width = '100%', mode = 'json', readOnly = false, onChange = () => {} }) {
export const EDITOR_MODE = { TEXT: 'text', JSON: 'json' };

export function MLJobEditor({ value, height = '500px', width = '100%', mode = EDITOR_MODE.JSON, readOnly = false, onChange = () => {} }) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be split over multiple lines to help readability I think

@elasticmachine
Copy link
Contributor

💔 Build Failed

@jgowdyelastic
Copy link
Member Author

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jgowdyelastic jgowdyelastic merged commit 0ffb032 into elastic:feature/file-datavisualizer Sep 11, 2018
jgowdyelastic added a commit that referenced this pull request Oct 23, 2018
* [ML] File datavisualizer initial commit (#22828)

* [ML] File datavisualizer initial commit

* removing mocked data and adding initial stats

* adding card styling to fields

* Revert "". accidentally added with no commit message

This reverts commit d762d20b706e6a770e631f863b9e7d8879bb7ee6.

* adding date type to timestamp field

* renaming FileStats to FieldsStats

* code clean up

* changes based on review

* changes to error handling

* [ML] Adding file datavisualizer overrides (#23194)

* [ML] Adding file datavisualizer overrides

* improvements to overrides

* removing comment

* small refactor

* removing accidentally added file

* updates based on review

* fixing broken test

* adding missing grok pattern override

* fixing test

* [ML] Refactoring override option lists (#23424)

* [ML] Refactoring override option lists

* moving lists out of class

* updating test snapshot

* [ML] Fixing field editing (#23500)

* [ML] Changes to timestamp formats (#23498)

* [ML] Changes to timestamp formats

* updating test snapshot

* [ML] Allow Datavisualizer use on basic license (#23748)

* [ML] Allow ML use on basic license

* removing timeout change

* adding permission checks

* updating tests

* removing unnecessary checks

* [ML] Adds new page for choosing file or index based data visualizer (#23763)

* [ML] Adding license check to datavisualizer landing page (#23809)

* [ML] Adding license check to datavisualizer landing page

* removing comments

* updating redirect to landing page

* [ML] Adding ability to upload data to elasticsearch from datavisualizer  (#24042)

* [ML] Initial work for delimited file upload

* adding results links cards

* adding nav menu

* removing accidental debugger

* initial work for importing semi structured text

* using ingest pipeline for import

* adding json importer and better error reporting

* better progress steps

* time range added to results links

* first import only creates index and pipeline

* adding status constants

* using status constants

* adding explanation comment

* updating yarn.lock

* changes based on review

* fixing space

* fixing space again, stort it out git

* removing oversized background container causing constant scrollbar

* [ML] Adding basic license check when loading privileges (#24173)

* [ML] Adding basic license check

* missing import

* [ML] Adds an About panel to the file data visualizer landing page (#24260)

* [ML] Adds an About panel to the file data visualizer landing page

* [ML] Remove unnecessary style from file data visualizer scss

* [ML] Adding better error reporting for reading and importing data (#24269)

* [ML] Adding better error reporting for reading and importing data

* changes to endpoint errors

* displaying errors

* step logic refactor

* removing log statements

* [ML] Switch file data visualizer to use Papa Parse for CSV parsing (#24329)

* [ML] Fixes layout of Data Visualizer selector page for IE (#24387)

* [ML] Adding ability to override various settings when importing data (#24346)

* [ML] Adding ability to override various settings when importing data

* second commit with most of the outstanding code

* improving index pattern name validation

* better index pattern matching

* adding comments

* adding empty index pattern check

* changes based on review

* fixing test
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Oct 23, 2018
* [ML] File datavisualizer initial commit (elastic#22828)

* [ML] File datavisualizer initial commit

* removing mocked data and adding initial stats

* adding card styling to fields

* Revert "". accidentally added with no commit message

This reverts commit d762d20b706e6a770e631f863b9e7d8879bb7ee6.

* adding date type to timestamp field

* renaming FileStats to FieldsStats

* code clean up

* changes based on review

* changes to error handling

* [ML] Adding file datavisualizer overrides (elastic#23194)

* [ML] Adding file datavisualizer overrides

* improvements to overrides

* removing comment

* small refactor

* removing accidentally added file

* updates based on review

* fixing broken test

* adding missing grok pattern override

* fixing test

* [ML] Refactoring override option lists (elastic#23424)

* [ML] Refactoring override option lists

* moving lists out of class

* updating test snapshot

* [ML] Fixing field editing (elastic#23500)

* [ML] Changes to timestamp formats (elastic#23498)

* [ML] Changes to timestamp formats

* updating test snapshot

* [ML] Allow Datavisualizer use on basic license (elastic#23748)

* [ML] Allow ML use on basic license

* removing timeout change

* adding permission checks

* updating tests

* removing unnecessary checks

* [ML] Adds new page for choosing file or index based data visualizer (elastic#23763)

* [ML] Adding license check to datavisualizer landing page (elastic#23809)

* [ML] Adding license check to datavisualizer landing page

* removing comments

* updating redirect to landing page

* [ML] Adding ability to upload data to elasticsearch from datavisualizer  (elastic#24042)

* [ML] Initial work for delimited file upload

* adding results links cards

* adding nav menu

* removing accidental debugger

* initial work for importing semi structured text

* using ingest pipeline for import

* adding json importer and better error reporting

* better progress steps

* time range added to results links

* first import only creates index and pipeline

* adding status constants

* using status constants

* adding explanation comment

* updating yarn.lock

* changes based on review

* fixing space

* fixing space again, stort it out git

* removing oversized background container causing constant scrollbar

* [ML] Adding basic license check when loading privileges (elastic#24173)

* [ML] Adding basic license check

* missing import

* [ML] Adds an About panel to the file data visualizer landing page (elastic#24260)

* [ML] Adds an About panel to the file data visualizer landing page

* [ML] Remove unnecessary style from file data visualizer scss

* [ML] Adding better error reporting for reading and importing data (elastic#24269)

* [ML] Adding better error reporting for reading and importing data

* changes to endpoint errors

* displaying errors

* step logic refactor

* removing log statements

* [ML] Switch file data visualizer to use Papa Parse for CSV parsing (elastic#24329)

* [ML] Fixes layout of Data Visualizer selector page for IE (elastic#24387)

* [ML] Adding ability to override various settings when importing data (elastic#24346)

* [ML] Adding ability to override various settings when importing data

* second commit with most of the outstanding code

* improving index pattern name validation

* better index pattern matching

* adding comments

* adding empty index pattern check

* changes based on review

* fixing test
jgowdyelastic added a commit that referenced this pull request Oct 24, 2018
* [ML] File datavisualizer initial commit (#22828)

* [ML] File datavisualizer initial commit

* removing mocked data and adding initial stats

* adding card styling to fields

* Revert "". accidentally added with no commit message

This reverts commit d762d20b706e6a770e631f863b9e7d8879bb7ee6.

* adding date type to timestamp field

* renaming FileStats to FieldsStats

* code clean up

* changes based on review

* changes to error handling

* [ML] Adding file datavisualizer overrides (#23194)

* [ML] Adding file datavisualizer overrides

* improvements to overrides

* removing comment

* small refactor

* removing accidentally added file

* updates based on review

* fixing broken test

* adding missing grok pattern override

* fixing test

* [ML] Refactoring override option lists (#23424)

* [ML] Refactoring override option lists

* moving lists out of class

* updating test snapshot

* [ML] Fixing field editing (#23500)

* [ML] Changes to timestamp formats (#23498)

* [ML] Changes to timestamp formats

* updating test snapshot

* [ML] Allow Datavisualizer use on basic license (#23748)

* [ML] Allow ML use on basic license

* removing timeout change

* adding permission checks

* updating tests

* removing unnecessary checks

* [ML] Adds new page for choosing file or index based data visualizer (#23763)

* [ML] Adding license check to datavisualizer landing page (#23809)

* [ML] Adding license check to datavisualizer landing page

* removing comments

* updating redirect to landing page

* [ML] Adding ability to upload data to elasticsearch from datavisualizer  (#24042)

* [ML] Initial work for delimited file upload

* adding results links cards

* adding nav menu

* removing accidental debugger

* initial work for importing semi structured text

* using ingest pipeline for import

* adding json importer and better error reporting

* better progress steps

* time range added to results links

* first import only creates index and pipeline

* adding status constants

* using status constants

* adding explanation comment

* updating yarn.lock

* changes based on review

* fixing space

* fixing space again, stort it out git

* removing oversized background container causing constant scrollbar

* [ML] Adding basic license check when loading privileges (#24173)

* [ML] Adding basic license check

* missing import

* [ML] Adds an About panel to the file data visualizer landing page (#24260)

* [ML] Adds an About panel to the file data visualizer landing page

* [ML] Remove unnecessary style from file data visualizer scss

* [ML] Adding better error reporting for reading and importing data (#24269)

* [ML] Adding better error reporting for reading and importing data

* changes to endpoint errors

* displaying errors

* step logic refactor

* removing log statements

* [ML] Switch file data visualizer to use Papa Parse for CSV parsing (#24329)

* [ML] Fixes layout of Data Visualizer selector page for IE (#24387)

* [ML] Adding ability to override various settings when importing data (#24346)

* [ML] Adding ability to override various settings when importing data

* second commit with most of the outstanding code

* improving index pattern name validation

* better index pattern matching

* adding comments

* adding empty index pattern check

* changes based on review

* fixing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants