mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[i18n] Translate ML - File Datavisualizer (Part 2) (#25642)
translate file_datavisualizer folder of Machine Learning (Part 2)
This commit is contained in:
parent
7e2e450486
commit
af8147d98b
12 changed files with 421 additions and 92 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React, {
|
||||
Component,
|
||||
} from 'react';
|
||||
|
@ -129,7 +130,12 @@ export class FileDataVisualizerView extends Component {
|
|||
|
||||
if (serverSettings.format === 'xml') {
|
||||
throw {
|
||||
message: 'XML not currently supported'
|
||||
message: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileDatavisualizerView.xmlNotCurrentlySupportedErrorMessage"
|
||||
defaultMessage="XML not currently supported"
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -25,23 +26,42 @@ export function FileTooLarge({ fileSize, maxFileSize }) {
|
|||
if (fileSizeFormatted !== maxFileSizeFormatted) {
|
||||
errorText = (
|
||||
<p>
|
||||
The size of the file you selected for upload is {fileSizeFormatted} which
|
||||
exceeds the maximum permitted size of {maxFileSizeFormatted}
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeErrorMessage"
|
||||
defaultMessage="The size of the file you selected for upload is {fileSizeFormatted} which
|
||||
exceeds the maximum permitted size of {maxFileSizeFormatted}"
|
||||
values={{
|
||||
fileSizeFormatted,
|
||||
maxFileSizeFormatted,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
} else {
|
||||
const diffFormatted = numeral(fileSize - maxFileSize).format(FILE_SIZE_DISPLAY_FORMAT);
|
||||
errorText = (
|
||||
<p>
|
||||
The size of the file you selected for upload exceeds the maximum
|
||||
permitted size of {maxFileSizeFormatted} by {diffFormatted}
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeExceedsAllowedSizeByDiffFormatErrorMessage"
|
||||
defaultMessage="The size of the file you selected for upload exceeds the maximum
|
||||
permitted size of {maxFileSizeFormatted} by {diffFormatted}"
|
||||
values={{
|
||||
maxFileSizeFormatted,
|
||||
diffFormatted,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<EuiCallOut
|
||||
title="File size is too large"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileErrorCallouts.fileSizeTooLargeTitle"
|
||||
defaultMessage="File size is too large"
|
||||
/>
|
||||
}
|
||||
color="danger"
|
||||
iconType="cross"
|
||||
>
|
||||
|
@ -53,7 +73,12 @@ export function FileTooLarge({ fileSize, maxFileSize }) {
|
|||
export function FileCouldNotBeRead({ error, loaded }) {
|
||||
return (
|
||||
<EuiCallOut
|
||||
title="File could not be read"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileErrorCallouts.fileCouldNotBeReadTitle"
|
||||
defaultMessage="File could not be read"
|
||||
/>
|
||||
}
|
||||
color="danger"
|
||||
iconType="cross"
|
||||
>
|
||||
|
@ -63,7 +88,12 @@ export function FileCouldNotBeRead({ error, loaded }) {
|
|||
}
|
||||
{
|
||||
loaded &&
|
||||
<p>Reverting to previous settings</p>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.fileErrorCallouts.revertingToPreviousSettingsDescription"
|
||||
defaultMessage="Reverting to previous settings"
|
||||
/>
|
||||
</p>
|
||||
}
|
||||
</EuiCallOut>
|
||||
);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -34,17 +35,47 @@ export function ImportErrors({ errors, statuses }) {
|
|||
function title(statuses) {
|
||||
switch (IMPORT_STATUS.FAILED) {
|
||||
case statuses.readStatus:
|
||||
return 'Error reading file';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.readingFileErrorMessage"
|
||||
defaultMessage="Error reading file"
|
||||
/>
|
||||
);
|
||||
case statuses.indexCreatedStatus:
|
||||
return 'Error creating index';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.creatingIndexErrorMessage"
|
||||
defaultMessage="Error creating index"
|
||||
/>
|
||||
);
|
||||
case statuses.ingestPipelineCreatedStatus:
|
||||
return 'Error creating ingest pipeline';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.creatingIngestPipelineErrorMessage"
|
||||
defaultMessage="Error creating ingest pipeline"
|
||||
/>
|
||||
);
|
||||
case statuses.uploadStatus:
|
||||
return 'Error uploading data';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.uploadingDataErrorMessage"
|
||||
defaultMessage="Error uploading data"
|
||||
/>
|
||||
);
|
||||
case statuses.indexPatternCreatedStatus:
|
||||
return 'Error creating index pattern';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.creatingIndexPatternErrorMessage"
|
||||
defaultMessage="Error creating index pattern"
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return 'Error';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.defaultErrorMessage"
|
||||
defaultMessage="Error"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +90,12 @@ function ImportError(error, key) {
|
|||
{errorObj.more !== undefined &&
|
||||
<EuiAccordion
|
||||
id="more"
|
||||
buttonContent="More"
|
||||
buttonContent={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.moreButtonLabel"
|
||||
defaultMessage="More"
|
||||
/>
|
||||
}
|
||||
paddingSize="m"
|
||||
>
|
||||
{errorObj.more}
|
||||
|
@ -99,5 +135,12 @@ function toString(error) {
|
|||
}
|
||||
}
|
||||
|
||||
return { msg: 'Unknown error' };
|
||||
return {
|
||||
msg: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importErrors.unknownErrorMessage"
|
||||
defaultMessage="Unknown error"
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -19,7 +19,7 @@ export const IMPORT_STATUS = {
|
|||
FAILED: 'danger',
|
||||
};
|
||||
|
||||
export function ImportProgress({ statuses }) {
|
||||
export const ImportProgress = injectI18n(function ({ statuses, intl }) {
|
||||
|
||||
const {
|
||||
reading,
|
||||
|
@ -60,43 +60,115 @@ export function ImportProgress({ statuses }) {
|
|||
completedStep = 5;
|
||||
}
|
||||
|
||||
|
||||
let processFileTitle = 'Process file';
|
||||
let createIndexTitle = 'Create index';
|
||||
let createIngestPipelineTitle = 'Create ingest pipeline';
|
||||
let uploadingDataTitle = 'Upload data';
|
||||
let createIndexPatternTitle = 'Create index pattern';
|
||||
let processFileTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.processFileTitle',
|
||||
defaultMessage: 'Process file'
|
||||
});
|
||||
let createIndexTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.createIndexTitle',
|
||||
defaultMessage: 'Create index'
|
||||
});
|
||||
let createIngestPipelineTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.createIngestPipelineTitle',
|
||||
defaultMessage: 'Create ingest pipeline'
|
||||
});
|
||||
let uploadingDataTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.uploadDataTitle',
|
||||
defaultMessage: 'Upload data'
|
||||
});
|
||||
let createIndexPatternTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.createIndexPatternTitle',
|
||||
defaultMessage: 'Create index pattern'
|
||||
});
|
||||
|
||||
if (completedStep >= 0) {
|
||||
processFileTitle = 'Processing file';
|
||||
statusInfo = (<p>Processing file for import</p>);
|
||||
processFileTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.processingFileTitle',
|
||||
defaultMessage: 'Processing file'
|
||||
});
|
||||
statusInfo = (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importProgress.processingImportedFileDescription"
|
||||
defaultMessage="Processing file for import"
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (completedStep >= 1) {
|
||||
processFileTitle = 'File processed';
|
||||
createIndexTitle = 'Creating index';
|
||||
statusInfo = (<p>Creating index and ingest pipeline</p>);
|
||||
processFileTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.fileProcessedTitle',
|
||||
defaultMessage: 'File processed'
|
||||
});
|
||||
createIndexTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.creatingIndexTitle',
|
||||
defaultMessage: 'Creating index'
|
||||
});
|
||||
statusInfo = (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importProgress.stepTwoCreatingIndexIngestPipelineDescription"
|
||||
defaultMessage="Creating index and ingest pipeline"
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (completedStep >= 2) {
|
||||
createIndexTitle = 'Index created';
|
||||
createIngestPipelineTitle = 'Creating ingest pipeline';
|
||||
statusInfo = (<p>Creating index and ingest pipeline</p>);
|
||||
createIndexTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.indexCreatedTitle',
|
||||
defaultMessage: 'Index created'
|
||||
});
|
||||
createIngestPipelineTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.creatingIngestPipelineTitle',
|
||||
defaultMessage: 'Creating ingest pipeline'
|
||||
});
|
||||
statusInfo = (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importProgress.stepThreeCreatingIndexIngestPipelineDescription"
|
||||
defaultMessage="Creating index and ingest pipeline"
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (completedStep >= 3) {
|
||||
createIngestPipelineTitle = 'Ingest pipeline created';
|
||||
uploadingDataTitle = 'Uploading data';
|
||||
createIngestPipelineTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.ingestPipelineCreatedTitle',
|
||||
defaultMessage: 'Ingest pipeline created'
|
||||
});
|
||||
uploadingDataTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.uploadingDataTitle',
|
||||
defaultMessage: 'Uploading data'
|
||||
});
|
||||
statusInfo = (<UploadFunctionProgress progress={uploadProgress} />);
|
||||
}
|
||||
if (completedStep >= 4) {
|
||||
uploadingDataTitle = 'Data uploaded';
|
||||
uploadingDataTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.dataUploadedTitle',
|
||||
defaultMessage: 'Data uploaded'
|
||||
});
|
||||
if (createIndexPattern === true) {
|
||||
createIndexPatternTitle = 'Creating index pattern';
|
||||
statusInfo = (<p>Creating index pattern</p>);
|
||||
createIndexPatternTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternTitle',
|
||||
defaultMessage: 'Creating index pattern'
|
||||
});
|
||||
statusInfo = (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importProgress.creatingIndexPatternDescription"
|
||||
defaultMessage="Creating index pattern"
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
} else {
|
||||
statusInfo = null;
|
||||
}
|
||||
}
|
||||
if (completedStep >= 5) {
|
||||
createIndexPatternTitle = 'Index pattern created';
|
||||
createIndexPatternTitle = intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importProgress.indexPatternCreatedTitle',
|
||||
defaultMessage: 'Index pattern created'
|
||||
});
|
||||
statusInfo = null;
|
||||
}
|
||||
|
||||
|
@ -159,12 +231,17 @@ export function ImportProgress({ statuses }) {
|
|||
}
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function UploadFunctionProgress({ progress }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<p>Uploading data</p>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importProgress.uploadingDataDescription"
|
||||
defaultMessage="Uploading data"
|
||||
/>
|
||||
</p>
|
||||
{(progress < 100) &&
|
||||
<React.Fragment>
|
||||
<EuiSpacer size="s" />
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -19,7 +20,7 @@ import {
|
|||
import { MLJobEditor, EDITOR_MODE } from '../../../jobs/jobs_list/components/ml_job_editor';
|
||||
const EDITOR_HEIGHT = '300px';
|
||||
|
||||
export function AdvancedSettings({
|
||||
function AdvancedSettingsUi({
|
||||
index,
|
||||
indexPattern,
|
||||
initialized,
|
||||
|
@ -35,17 +36,26 @@ export function AdvancedSettings({
|
|||
onPipelineStringChange,
|
||||
indexNameError,
|
||||
indexPatternNameError,
|
||||
intl,
|
||||
}) {
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<EuiFormRow
|
||||
label="Index name"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.indexNameLabel"
|
||||
defaultMessage="Index name"
|
||||
/>
|
||||
}
|
||||
isInvalid={indexNameError !== ''}
|
||||
error={[indexNameError]}
|
||||
>
|
||||
<EuiFieldText
|
||||
placeholder="index name"
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.advancedImportSettings.indexNamePlaceholder',
|
||||
defaultMessage: 'index name'
|
||||
})}
|
||||
value={index}
|
||||
disabled={(initialized === true)}
|
||||
onChange={onIndexChange}
|
||||
|
@ -55,7 +65,12 @@ export function AdvancedSettings({
|
|||
|
||||
<EuiCheckbox
|
||||
id="createIndexPattern"
|
||||
label="Create index pattern"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.createIndexPatternLabel"
|
||||
defaultMessage="Create index pattern"
|
||||
/>
|
||||
}
|
||||
checked={(createIndexPattern === true)}
|
||||
disabled={(initialized === true)}
|
||||
onChange={onCreateIndexPatternChange}
|
||||
|
@ -64,7 +79,12 @@ export function AdvancedSettings({
|
|||
<EuiSpacer size="s" />
|
||||
|
||||
<EuiFormRow
|
||||
label="Index pattern name"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.indexPatternNameLabel"
|
||||
defaultMessage="Index pattern name"
|
||||
/>
|
||||
}
|
||||
disabled={(createIndexPattern === false || initialized === true)}
|
||||
isInvalid={indexPatternNameError !== ''}
|
||||
error={[indexPatternNameError]}
|
||||
|
@ -109,11 +129,18 @@ export function AdvancedSettings({
|
|||
);
|
||||
}
|
||||
|
||||
export const AdvancedSettings = injectI18n(AdvancedSettingsUi);
|
||||
|
||||
function IndexSettings({ initialized, data, onChange }) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<EuiFormRow
|
||||
label="Index settings"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.indexSettingsLabel"
|
||||
defaultMessage="Index settings"
|
||||
/>
|
||||
}
|
||||
disabled={(initialized === true)}
|
||||
fullWidth
|
||||
>
|
||||
|
@ -134,7 +161,12 @@ function Mappings({ initialized, data, onChange }) {
|
|||
return (
|
||||
<React.Fragment>
|
||||
<EuiFormRow
|
||||
label="Mappings"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.mappingsLabel"
|
||||
defaultMessage="Mappings"
|
||||
/>
|
||||
}
|
||||
disabled={(initialized === true)}
|
||||
fullWidth
|
||||
>
|
||||
|
@ -155,7 +187,12 @@ function IngestPipeline({ initialized, data, onChange }) {
|
|||
return (
|
||||
<React.Fragment>
|
||||
<EuiFormRow
|
||||
label="Ingest pipeline"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.advancedImportSettings.ingestPipelineLabel"
|
||||
defaultMessage="Ingest pipeline"
|
||||
/>
|
||||
}
|
||||
disabled={(initialized === true)}
|
||||
fullWidth
|
||||
>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -15,7 +15,7 @@ import {
|
|||
import { SimpleSettings } from './simple';
|
||||
import { AdvancedSettings } from './advanced';
|
||||
|
||||
export function ImportSettings({
|
||||
export const ImportSettings = injectI18n(function ({
|
||||
index,
|
||||
indexPattern,
|
||||
initialized,
|
||||
|
@ -30,12 +30,16 @@ export function ImportSettings({
|
|||
onMappingsStringChange,
|
||||
onPipelineStringChange,
|
||||
indexNameError,
|
||||
indexPatternNameError
|
||||
indexPatternNameError,
|
||||
intl
|
||||
}) {
|
||||
|
||||
const tabs = [{
|
||||
id: 'simple-settings',
|
||||
name: 'Simple',
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importSettings.simpleTabName',
|
||||
defaultMessage: 'Simple'
|
||||
}),
|
||||
content: (
|
||||
<React.Fragment>
|
||||
|
||||
|
@ -54,7 +58,10 @@ export function ImportSettings({
|
|||
},
|
||||
{
|
||||
id: 'advanced-settings',
|
||||
name: 'Advanced',
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.importSettings.advancedTabName',
|
||||
defaultMessage: 'Advanced'
|
||||
}),
|
||||
content: (
|
||||
<React.Fragment>
|
||||
|
||||
|
@ -90,4 +97,4 @@ export function ImportSettings({
|
|||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -13,23 +13,32 @@ import {
|
|||
EuiCheckbox,
|
||||
} from '@elastic/eui';
|
||||
|
||||
export function SimpleSettings({
|
||||
export const SimpleSettings = injectI18n(function ({
|
||||
index,
|
||||
initialized,
|
||||
onIndexChange,
|
||||
createIndexPattern,
|
||||
onCreateIndexPatternChange,
|
||||
indexNameError,
|
||||
intl,
|
||||
}) {
|
||||
return (
|
||||
<React.Fragment>
|
||||
<EuiFormRow
|
||||
label="Index name"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.simpleImportSettings.indexNameFormRowLabel"
|
||||
defaultMessage="Index name"
|
||||
/>
|
||||
}
|
||||
isInvalid={indexNameError !== ''}
|
||||
error={[indexNameError]}
|
||||
>
|
||||
<EuiFieldText
|
||||
placeholder="index name"
|
||||
placeholder={intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.simpleImportSettings.indexNamePlaceholder',
|
||||
defaultMessage: 'index name'
|
||||
})}
|
||||
value={index}
|
||||
disabled={(initialized === true)}
|
||||
onChange={onIndexChange}
|
||||
|
@ -39,11 +48,16 @@ export function SimpleSettings({
|
|||
|
||||
<EuiCheckbox
|
||||
id="createIndexPattern"
|
||||
label="Create index pattern"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.simpleImportSettings.createIndexPatternLabel"
|
||||
defaultMessage="Create index pattern"
|
||||
/>
|
||||
}
|
||||
checked={(createIndexPattern === true)}
|
||||
disabled={(initialized === true)}
|
||||
onChange={onCreateIndexPatternChange}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -36,7 +37,12 @@ export function ImportSummary({
|
|||
return (
|
||||
<React.Fragment>
|
||||
<EuiCallOut
|
||||
title="Import complete"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.importCompleteTitle"
|
||||
defaultMessage="Import complete"
|
||||
/>
|
||||
}
|
||||
color="success"
|
||||
iconType="check"
|
||||
>
|
||||
|
@ -51,13 +57,26 @@ export function ImportSummary({
|
|||
<React.Fragment>
|
||||
<EuiSpacer size="m" />
|
||||
<EuiCallOut
|
||||
title="Some documents could not be imported"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedTitle"
|
||||
defaultMessage="Some documents could not be imported"
|
||||
/>
|
||||
}
|
||||
color="warning"
|
||||
iconType="help"
|
||||
>
|
||||
<p>
|
||||
{importFailures.length} out of {docCount} documents could not be imported.
|
||||
This could be due to lines not matching the Grok pattern.
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.documentsCouldNotBeImportedDescription"
|
||||
defaultMessage="{importFailuresLength} out of {docCount} documents could not be imported.
|
||||
This could be due to lines not matching the Grok pattern."
|
||||
values={{
|
||||
importFailuresLength: importFailures.length,
|
||||
docCount,
|
||||
}}
|
||||
/>
|
||||
|
||||
</p>
|
||||
|
||||
<Failures failedDocs={importFailures} />
|
||||
|
@ -72,7 +91,12 @@ function Failures({ failedDocs }) {
|
|||
return (
|
||||
<EuiAccordion
|
||||
id="failureList"
|
||||
buttonContent="Failed documents"
|
||||
buttonContent={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.failedDocumentsButtonLabel"
|
||||
defaultMessage="Failed documents"
|
||||
/>
|
||||
}
|
||||
paddingSize="m"
|
||||
>
|
||||
<div className="failure-list">
|
||||
|
@ -100,32 +124,57 @@ function createDisplayItems(
|
|||
) {
|
||||
const items = [
|
||||
{
|
||||
title: 'Index',
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.indexTitle"
|
||||
defaultMessage="Index"
|
||||
/>
|
||||
),
|
||||
description: index,
|
||||
},
|
||||
{
|
||||
title: 'Documents ingested',
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.documentsIngestedTitle"
|
||||
defaultMessage="Documents ingested"
|
||||
/>
|
||||
),
|
||||
description: docCount - ((importFailures && importFailures.length) || 0),
|
||||
}
|
||||
];
|
||||
|
||||
if (createPipeline) {
|
||||
items.splice(1, 0, {
|
||||
title: 'Ingest pipeline',
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.ingestPipelineTitle"
|
||||
defaultMessage="Ingest pipeline"
|
||||
/>
|
||||
),
|
||||
description: ingestPipelineId,
|
||||
});
|
||||
}
|
||||
|
||||
if (createIndexPattern) {
|
||||
items.splice(1, 0, {
|
||||
title: 'Index pattern',
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.indexPatternTitle"
|
||||
defaultMessage="Index pattern"
|
||||
/>
|
||||
),
|
||||
description: indexPattern,
|
||||
});
|
||||
}
|
||||
|
||||
if (importFailures && importFailures.length > 0) {
|
||||
items.push({
|
||||
title: 'Failed documents',
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importSummary.failedDocumentsTitle"
|
||||
defaultMessage="Failed documents"
|
||||
/>
|
||||
),
|
||||
description: importFailures.length,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React, {
|
||||
Component,
|
||||
} from 'react';
|
||||
|
@ -363,9 +364,18 @@ export class ImportView extends Component {
|
|||
|
||||
<EuiTitle size="s">
|
||||
<h3>
|
||||
Import data
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.importDataTitle"
|
||||
defaultMessage="Import data"
|
||||
/>
|
||||
|
||||
<ExperimentalBadge
|
||||
tooltipContent="Experimental feature. We'd love to hear your feedback."
|
||||
tooltipContent={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.experimentalFeatureTooltip"
|
||||
defaultMessage="Experimental feature. We'd love to hear your feedback."
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</h3>
|
||||
</EuiTitle>
|
||||
|
@ -399,7 +409,10 @@ export class ImportView extends Component {
|
|||
iconSide="right"
|
||||
fill
|
||||
>
|
||||
Import
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.importButtonLabel"
|
||||
defaultMessage="Import"
|
||||
/>
|
||||
</EuiButton>
|
||||
}
|
||||
|
||||
|
@ -409,7 +422,10 @@ export class ImportView extends Component {
|
|||
<EuiButton
|
||||
onClick={this.clickReset}
|
||||
>
|
||||
Reset
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.resetButtonLabel"
|
||||
defaultMessage="Reset"
|
||||
/>
|
||||
</EuiButton>
|
||||
}
|
||||
|
||||
|
@ -519,7 +535,12 @@ function getDefaultState(state, results) {
|
|||
|
||||
function isIndexNameValid(name, indexNames) {
|
||||
if (indexNames.find(i => i === name)) {
|
||||
return 'Index name already exists';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.indexNameAlreadyExistsErrorMessage"
|
||||
defaultMessage="Index name already exists"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const reg = new RegExp('[\\\\/\*\?\"\<\>\|\\s\,\#]+');
|
||||
|
@ -529,7 +550,12 @@ function isIndexNameValid(name, indexNames) {
|
|||
name.match(/^[-_+]/) !== null || // name can't start with these chars
|
||||
name.match(reg) !== null // name can't contain these chars
|
||||
) {
|
||||
return 'Index name contains illegal characters';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.indexNameContainsIllegalCharactersErrorMessage"
|
||||
defaultMessage="Index name contains illegal characters"
|
||||
/>
|
||||
);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
@ -541,7 +567,12 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
|
|||
}
|
||||
|
||||
if (indexPatternNames.find(i => i === name)) {
|
||||
return 'Index pattern name already exists';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.indexPatternNameAlreadyExistsErrorMessage"
|
||||
defaultMessage="Index pattern name already exists"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
// escape . and + to stop the regex matching more than it should.
|
||||
|
@ -551,7 +582,12 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
|
|||
newName = newName.replace('*', '.*');
|
||||
const reg = new RegExp(`^${newName}$`);
|
||||
if (index.match(reg) === null) { // name should match index
|
||||
return 'Index pattern does not match index name';
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.importView.indexPatternDoesNotMatchIndexNameErrorMessage"
|
||||
defaultMessage="Index pattern does not match index name"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
import React, {
|
||||
Component,
|
||||
} from 'react';
|
||||
|
@ -90,7 +91,12 @@ export class ResultsLinks extends Component {
|
|||
<EuiFlexItem>
|
||||
<EuiCard
|
||||
icon={<EuiIcon size="xxl" type={`discoverApp`} />}
|
||||
title="View index in Discover"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsLinks.viewIndexInDiscoverTitle"
|
||||
defaultMessage="View index in Discover"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
href={`${uiChrome.getBasePath()}/app/kibana#/discover?&_a=(index:'${indexPatternId}')${_g}`}
|
||||
/>
|
||||
|
@ -100,7 +106,12 @@ export class ResultsLinks extends Component {
|
|||
<EuiFlexItem>
|
||||
<EuiCard
|
||||
icon={<EuiIcon size="xxl" type={`machineLearningApp`} />}
|
||||
title="Create new ML job"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsLinks.createNewMLJobTitle"
|
||||
defaultMessage="Create new ML job"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
href={`${uiChrome.getBasePath()}/app/ml#/jobs/new_job/step/job_type?index=${indexPatternId}${_g}`}
|
||||
/>
|
||||
|
@ -110,7 +121,12 @@ export class ResultsLinks extends Component {
|
|||
<EuiFlexItem>
|
||||
<EuiCard
|
||||
icon={<EuiIcon size="xxl" type={`dataVisualizer`} />}
|
||||
title="Open in Data Visualizer"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsLinks.openInDataVisualizerTitle"
|
||||
defaultMessage="Open in Data Visualizer"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
href={`${uiChrome.getBasePath()}/app/ml#/jobs/new_job/datavisualizer?index=${indexPatternId}${_g}`}
|
||||
/>
|
||||
|
@ -119,7 +135,12 @@ export class ResultsLinks extends Component {
|
|||
<EuiFlexItem>
|
||||
<EuiCard
|
||||
icon={<EuiIcon size="xxl" type={`managementApp`} />}
|
||||
title="Index Management"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsLinks.indexManagementTitle"
|
||||
defaultMessage="Index Management"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
href={`${uiChrome.getBasePath()}/app/kibana#/management/elasticsearch/index_management/home`}
|
||||
/>
|
||||
|
@ -128,7 +149,12 @@ export class ResultsLinks extends Component {
|
|||
<EuiFlexItem>
|
||||
<EuiCard
|
||||
icon={<EuiIcon size="xxl" type={`managementApp`} />}
|
||||
title="Index Pattern Management"
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsLinks.indexPatternManagementTitle"
|
||||
defaultMessage="Index Pattern Management"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
href={`${uiChrome.getBasePath()}/app/kibana#/management/kibana/indices/${indexPatternId}`}
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
|
@ -18,14 +18,17 @@ import { FileContents } from '../file_contents';
|
|||
import { AnalysisSummary } from '../analysis_summary';
|
||||
import { FieldsStats } from '../fields_stats';
|
||||
|
||||
export function ResultsView({ data, results, showEditFlyout }) {
|
||||
export const ResultsView = injectI18n(function ({ data, results, showEditFlyout, intl }) {
|
||||
|
||||
console.log(results);
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
id: 'file-stats',
|
||||
name: 'File stats',
|
||||
name: intl.formatMessage({
|
||||
id: 'xpack.ml.fileDatavisualizer.resultsView.fileStatsTabName',
|
||||
defaultMessage: 'File stats'
|
||||
}),
|
||||
content: <FieldsStats results={results} />,
|
||||
}
|
||||
];
|
||||
|
@ -50,7 +53,10 @@ export function ResultsView({ data, results, showEditFlyout }) {
|
|||
<EuiSpacer size="m" />
|
||||
|
||||
<EuiButton onClick={() => showEditFlyout()}>
|
||||
Override settings
|
||||
<FormattedMessage
|
||||
id="xpack.ml.fileDatavisualizer.resultsView.overrideSettingsButtonLabel"
|
||||
defaultMessage="Override settings"
|
||||
/>
|
||||
</EuiButton>
|
||||
</EuiPanel>
|
||||
|
||||
|
@ -66,4 +72,4 @@ export function ResultsView({ data, results, showEditFlyout }) {
|
|||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
import 'ngreact';
|
||||
import { injectI18nProvider } from '@kbn/i18n/react';
|
||||
|
||||
import { uiModules } from 'ui/modules';
|
||||
|
||||
|
@ -19,6 +20,7 @@ import { getMlNodeCount } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
|
|||
import { loadNewJobDefaults } from 'plugins/ml/jobs/new_job/utils/new_job_defaults';
|
||||
import { loadIndexPatterns } from '../util/index_utils';
|
||||
import { initPromise } from 'plugins/ml/util/promise';
|
||||
import { FileDataVisualizerPage } from './file_datavisualizer';
|
||||
|
||||
import uiRoutes from 'ui/routes';
|
||||
|
||||
|
@ -38,10 +40,6 @@ uiRoutes
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
import { FileDataVisualizerPage } from './file_datavisualizer';
|
||||
|
||||
module.directive('fileDatavisualizerPage', function ($injector) {
|
||||
const reactDirective = $injector.get('reactDirective');
|
||||
const indexPatterns = $injector.get('indexPatterns');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue