Skip to content

Commit a26105a

Browse files
committed
changes based on review
1 parent d5b66ae commit a26105a

File tree

10 files changed

+115
-125
lines changed

10 files changed

+115
-125
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
.analysis-summary-list {
2-
.euiDescriptionList {
3-
.euiDescriptionList__title {
4-
flex-basis: 15%;
5-
}
6-
.euiDescriptionList__description {
7-
flex-basis: 85%;
8-
}
1+
.analysis-summary-list.euiDescriptionList {
2+
// adding overrides for title and desciption
3+
// these have to be overridden here as they are not
4+
// accessable as overrides in the EuiDescriptionList component
5+
.euiDescriptionList__title {
6+
flex-basis: 15%;
7+
}
8+
.euiDescriptionList__description {
9+
flex-basis: 85%;
910
}
1011
}

x-pack/plugins/ml/public/file_datavisualizer/components/analysis_summary/analysis_summary.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ export function AnalysisSummary({ results }) {
2424

2525
<EuiSpacer size="m" />
2626

27-
<div className="analysis-summary-list">
28-
<EuiDescriptionList
29-
type="column"
30-
listItems={items}
31-
/>
32-
</div>
27+
<EuiDescriptionList
28+
type="column"
29+
listItems={items}
30+
className="analysis-summary-list"
31+
/>
3332
</React.Fragment>
3433
);
3534
}

x-pack/plugins/ml/public/file_datavisualizer/components/import_errors/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function ImportErrors({ errors, statuses }) {
2323
>
2424
{
2525
errors.map((e, i) => (
26-
<Error error={e} key={i} />
26+
<ImportError error={e} key={i} />
2727
))
2828
}
2929

@@ -48,7 +48,7 @@ function title(statuses) {
4848
}
4949
}
5050

51-
function Error(error, key) {
51+
function ImportError(error, key) {
5252
const errorObj = toString(error);
5353
return (
5454
<React.Fragment>

x-pack/plugins/ml/public/file_datavisualizer/components/import_settings/import_settings.js

Lines changed: 68 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
*/
66

77

8-
import React, {
9-
Component,
10-
} from 'react';
8+
import React from 'react';
119

1210
import {
1311
EuiTabbedContent,
@@ -17,88 +15,79 @@ import {
1715
import { SimpleSettings } from './simple';
1816
import { AdvancedSettings } from './advanced';
1917

20-
export class ImportSettings extends Component {
21-
constructor(props) {
22-
super(props);
18+
export function ImportSettings({
19+
index,
20+
indexPattern,
21+
initialized,
22+
onIndexChange,
23+
createIndexPattern,
24+
onCreateIndexPatternChange,
25+
onIndexPatternChange,
26+
indexSettingsString,
27+
mappingsString,
28+
pipelineString,
29+
onIndexSettingsStringChange,
30+
onMappingsStringChange,
31+
onPipelineStringChange,
32+
indexNameError,
33+
indexPatternNameError
34+
}) {
2335

24-
this.state = {};
25-
}
26-
27-
render() {
28-
const {
29-
index,
30-
indexPattern,
31-
initialized,
32-
onIndexChange,
33-
createIndexPattern,
34-
onCreateIndexPatternChange,
35-
onIndexPatternChange,
36-
indexSettingsString,
37-
mappingsString,
38-
pipelineString,
39-
onIndexSettingsStringChange,
40-
onMappingsStringChange,
41-
onPipelineStringChange,
42-
indexNameError,
43-
indexPatternNameError
44-
} = this.props;
45-
46-
const tabs = [{
47-
id: 'simple-settings',
48-
name: 'Simple',
49-
content: (
50-
<React.Fragment>
36+
const tabs = [{
37+
id: 'simple-settings',
38+
name: 'Simple',
39+
content: (
40+
<React.Fragment>
5141

52-
<EuiSpacer size="m" />
42+
<EuiSpacer size="m" />
5343

54-
<SimpleSettings
55-
index={index}
56-
initialized={initialized}
57-
onIndexChange={onIndexChange}
58-
createIndexPattern={createIndexPattern}
59-
onCreateIndexPatternChange={onCreateIndexPatternChange}
60-
indexNameError={indexNameError}
61-
/>
62-
</React.Fragment>
63-
)
64-
},
65-
{
66-
id: 'advanced-settings',
67-
name: 'Advanced',
68-
content: (
69-
<React.Fragment>
44+
<SimpleSettings
45+
index={index}
46+
initialized={initialized}
47+
onIndexChange={onIndexChange}
48+
createIndexPattern={createIndexPattern}
49+
onCreateIndexPatternChange={onCreateIndexPatternChange}
50+
indexNameError={indexNameError}
51+
/>
52+
</React.Fragment>
53+
)
54+
},
55+
{
56+
id: 'advanced-settings',
57+
name: 'Advanced',
58+
content: (
59+
<React.Fragment>
7060

71-
<EuiSpacer size="m" />
61+
<EuiSpacer size="m" />
7262

73-
<AdvancedSettings
74-
index={index}
75-
indexPattern={indexPattern}
76-
initialized={initialized}
77-
onIndexChange={onIndexChange}
78-
createIndexPattern={createIndexPattern}
79-
onCreateIndexPatternChange={onCreateIndexPatternChange}
80-
onIndexPatternChange={onIndexPatternChange}
81-
indexSettingsString={indexSettingsString}
82-
mappingsString={mappingsString}
83-
pipelineString={pipelineString}
84-
onIndexSettingsStringChange={onIndexSettingsStringChange}
85-
onMappingsStringChange={onMappingsStringChange}
86-
onPipelineStringChange={onPipelineStringChange}
87-
indexNameError={indexNameError}
88-
indexPatternNameError={indexPatternNameError}
89-
/>
90-
</React.Fragment>
91-
)
92-
}
93-
];
94-
return (
95-
<React.Fragment>
96-
<EuiTabbedContent
97-
tabs={tabs}
98-
initialSelectedTab={tabs[0]}
99-
onTabClick={() => { }}
63+
<AdvancedSettings
64+
index={index}
65+
indexPattern={indexPattern}
66+
initialized={initialized}
67+
onIndexChange={onIndexChange}
68+
createIndexPattern={createIndexPattern}
69+
onCreateIndexPatternChange={onCreateIndexPatternChange}
70+
onIndexPatternChange={onIndexPatternChange}
71+
indexSettingsString={indexSettingsString}
72+
mappingsString={mappingsString}
73+
pipelineString={pipelineString}
74+
onIndexSettingsStringChange={onIndexSettingsStringChange}
75+
onMappingsStringChange={onMappingsStringChange}
76+
onPipelineStringChange={onPipelineStringChange}
77+
indexNameError={indexNameError}
78+
indexPatternNameError={indexPatternNameError}
10079
/>
10180
</React.Fragment>
102-
);
81+
)
10382
}
83+
];
84+
return (
85+
<React.Fragment>
86+
<EuiTabbedContent
87+
tabs={tabs}
88+
initialSelectedTab={tabs[0]}
89+
onTabClick={() => { }}
90+
/>
91+
</React.Fragment>
92+
);
10493
}

x-pack/plugins/ml/public/file_datavisualizer/components/import_summary/_import_sumary.scss

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
.import-summary-list {
2-
.euiDescriptionList {
3-
.euiDescriptionList__title {
4-
flex-basis: 15%;
5-
}
6-
.euiDescriptionList__description {
7-
flex-basis: 85%;
8-
}
1+
.import-summary-list.euiDescriptionList {
2+
// adding overrides for title and desciption
3+
// these have to be overridden here as they are not
4+
// accessable as overrides in the EuiDescriptionList component
5+
.euiDescriptionList__title {
6+
flex-basis: 15%;
7+
}
8+
.euiDescriptionList__description {
9+
flex-basis: 85%;
910
}
1011
}
1112

x-pack/plugins/ml/public/file_datavisualizer/components/import_summary/import_summary.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ export function ImportSummary({
3636
color="success"
3737
iconType="check"
3838
>
39-
<div className="import-summary-list">
40-
<EuiDescriptionList
41-
type="column"
42-
listItems={items}
43-
/>
44-
</div>
39+
<EuiDescriptionList
40+
type="column"
41+
listItems={items}
42+
className="import-summary-list"
43+
/>
4544
</EuiCallOut>
4645

4746
{(importFailures && importFailures.length > 0) &&

x-pack/plugins/ml/public/file_datavisualizer/components/import_view/import_view.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,14 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
483483
if (indexPatternNames.find(i => i === name)) {
484484
return 'Index pattern name already exists';
485485
}
486-
const newName = name.replace('*', '.*');
486+
487+
// escape . and + to stop the regex matching more than it should.
488+
let newName = name.replace('.', '\\.');
489+
newName = newName.replace('+', '\\+');
490+
// replace * with .* to make the wildcard match work.
491+
newName = newName.replace('*', '.*');
487492
const reg = new RegExp(`^${newName}$`);
488-
if ((
489-
name.match(/[\.\+]/g) !== null) || // avoid accidental .+ regexp matches
490-
(index.match(reg) === null) // name should match index
491-
) {
493+
if (index.match(reg) === null) { // name should match index
492494
return 'Index pattern does not match index name';
493495
}
494496

x-pack/plugins/ml/public/file_datavisualizer/components/import_view/importer/importer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ export class Importer {
9696
console.error(resp);
9797
success = false;
9898
error = resp.error;
99-
// debugger
10099
populateFailures(resp, failures, i);
101100
break;
102101
}

x-pack/plugins/ml/public/file_datavisualizer/components/results_links/results_links.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import moment from 'moment';
2020
import uiChrome from 'ui/chrome';
2121
import { ml } from '../../../services/ml_api_service';
2222

23-
const RECHECK_DELAY = 3000;
23+
const RECHECK_DELAY_MS = 3000;
2424

2525
export class ResultsLinks extends Component {
2626
constructor(props) {
@@ -31,18 +31,18 @@ export class ResultsLinks extends Component {
3131
to: 'now',
3232
};
3333

34-
this.reCheckTimeout = null;
34+
this.recheckTimeout = null;
3535
}
3636

3737
componentDidMount() {
3838
this.updateTimeValues();
3939
}
4040

4141
componentWillUnmount() {
42-
clearTimeout(this.reCheckTimeout);
42+
clearTimeout(this.recheckTimeout);
4343
}
4444

45-
async updateTimeValues(reCheck = true) {
45+
async updateTimeValues(recheck = true) {
4646
const {
4747
index,
4848
timeFieldName,
@@ -54,16 +54,16 @@ export class ResultsLinks extends Component {
5454
to: (to === null) ? this.state.to : to,
5555
});
5656

57-
// these links may have been drawn too quickly for he index to be ready
58-
// to give us the correct start and and times.
57+
// these links may have been drawn too quickly for the index to be ready
58+
// to give us the correct start and end times.
5959
// especially if the data was small.
6060
// so if the start and end were null, try again in 3s
6161
// the timeout is cleared when this component unmounts. just in case the user
6262
// resets the form or navigates away within 3s
63-
if (reCheck && (from === null || to === null)) {
64-
this.reCheckTimeout = setTimeout(() => {
63+
if (recheck && (from === null || to === null)) {
64+
this.recheckTimeout = setTimeout(() => {
6565
this.updateTimeValues(false);
66-
}, RECHECK_DELAY);
66+
}, RECHECK_DELAY_MS);
6767
}
6868
}
6969

x-pack/plugins/ml/server/models/file_data_visualizer/import_data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function importDataProvider(callWithRequest) {
4444
if (data.length && indexExits(index)) {
4545
const resp = await indexData(index, createdPipelineId, data);
4646
if (resp.success === false) {
47-
if (resp.ingestError/* || resp.failures.length === data.length*/) {
47+
if (resp.ingestError) {
4848
// all docs failed, abort
4949
throw resp;
5050
} else {

0 commit comments

Comments
 (0)