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

Feature/translate ml-jobs-jobs_list(part_1) #25466

Merged
merged 29 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c7ec189
Merge pull request #1 from elastic/master
Nox911 Sep 24, 2018
fa01b88
Merge pull request #2 from elastic/master
Nox911 Sep 27, 2018
70f6c7e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 27, 2018
68587a0
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Sep 28, 2018
42aa7d3
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
efeaefe
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 2, 2018
8a054ed
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 8, 2018
b0d1660
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 16, 2018
62b6ad1
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 17, 2018
acbad4b
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 18, 2018
a850650
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 22, 2018
0a200ce
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 25, 2018
b2a8244
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 29, 2018
b4b979e
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 30, 2018
d349a4f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Oct 31, 2018
ae285b9
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 2, 2018
3051641
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 5, 2018
6231971
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 8, 2018
f86a3d4
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 9, 2018
982f2f4
Translate ml -> jobsList(part_1)
Nox911 Nov 9, 2018
1916ce5
Fi issues
Nox911 Nov 12, 2018
8dbfa99
Add one translation for edit job flyout
Nox911 Nov 12, 2018
0394b92
Fix minor issues
Nox911 Nov 12, 2018
1b7bf38
Fix issues
Nox911 Nov 12, 2018
cf813c7
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 13, 2018
aca0e82
Merge branch 'master' into feature/translate-ml-jobs
Nox911 Nov 13, 2018
1aba03f
Merge branch 'master' of https://github.com/elastic/kibana
Nox911 Nov 14, 2018
8351efd
Merge branch 'master' into feature/translate-ml-jobs
Nox911 Nov 14, 2018
d9b935a
Merge branch 'master' into feature/translate-ml-jobs
pavel06081991 Dec 6, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"xpack.idxMgmt": "x-pack/plugins/index_management",
"xpack.infra": "x-pack/plugins/infra",
"xpack.licenseMgmt": "x-pack/plugins/license_management",
"xpack.ml": "x-pack/plugins/ml",
"xpack.logstash": "x-pack/plugins/logstash",
"xpack.monitoring": "x-pack/plugins/monitoring",
"xpack.reporting": "x-pack/plugins/reporting",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '@elastic/eui';

import { deleteJobs } from '../utils';
import { FormattedMessage } from '@kbn/i18n/react';

export class DeleteJobModal extends Component {
constructor(props) {
Expand Down Expand Up @@ -79,26 +80,46 @@ export class DeleteJobModal extends Component {
if (this.el && this.state.deleting === true) {
// work around to disable the modal's buttons if the jobs are being deleted
this.el.confirmButton.style.display = 'none';
this.el.cancelButton.textContent = 'Close';
this.el.cancelButton.textContent = (<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.closeButtonLabel"
defaultMessage="Close"
/>);
}

const title = `Delete ${(this.state.jobs.length > 1) ? `${this.state.jobs.length} jobs` : this.state.jobs[0].id}`;
const title = (
<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.deleteJobsTitle"
defaultMessage="Delete {jobsCount, plural, one {{jobId}} other {# jobs}}"
Nox911 marked this conversation as resolved.
Show resolved Hide resolved
values={{
jobsCount: this.state.jobs.length,
jobId: this.state.jobs[0].id
}}
/>);
modal = (
<EuiOverlayMask>
<EuiConfirmModal
ref={this.setEL}
title={title}
onCancel={this.closeModal}
onConfirm={this.deleteJob}
cancelButtonText="Cancel"
confirmButtonText="Delete"
cancelButtonText={(<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.cancelButtonLabel"
defaultMessage="Cancel"
/>)}
confirmButtonText={(<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.deleteButtonLabel"
defaultMessage="Delete"
/>)}
buttonColor="danger"
defaultFocusedButton={EUI_MODAL_CONFIRM_BUTTON}
className="eui-textBreakWord"
>
{(this.state.deleting === true) &&
<div>
Deleting jobs
<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.deletingJobsStatusLabel"
defaultMessage="Deleting jobs"
/>
<EuiSpacer />
<div style={{ textAlign: 'center' }}>
<EuiLoadingSpinner size="l"/>
Expand All @@ -108,10 +129,22 @@ export class DeleteJobModal extends Component {

{(this.state.deleting === false) &&
<React.Fragment>
<p>Are you sure you want to delete {(this.state.jobs.length > 1) ? 'these jobs' : 'this job'}?</p>
<p>
<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.deleteJobsDescription"
defaultMessage="Are you sure you want to delete {jobsCount, plural, one {this job} other {these jobs}}?"
values={{
jobsCount: this.state.jobs.length
}}
/>
</p>
{(this.state.jobs.length > 1) &&
<p>Deleting multiple jobs can be time consuming.
They will be deleted in the background and may not disappear from the jobs list instantly
<p>
<FormattedMessage
id="xpack.ml.jobsList.deleteJobModal.deleteMultipleJobsDescription"
defaultMessage="Deleting multiple jobs can be time consuming.
They will be deleted in the background and may not disappear from the jobs list instantly"
/>
</p>
}
</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ import {
isValidCustomUrls } from '../validate_job';
import { mlMessageBarService } from '../../../../components/messagebar/messagebar_service';
import { toastNotifications } from 'ui/notify';
import { FormattedMessage, injectI18n } from '@kbn/i18n/react';

export class EditJobFlyout extends Component {
class EditJobFlyoutUI extends Component {
constructor(props) {
super(props);

Expand Down Expand Up @@ -134,7 +135,10 @@ export class EditJobFlyout extends Component {

if (jobDetails.jobGroups !== undefined) {
if (jobDetails.jobGroups.some(j => this.props.allJobIds.includes(j))) {
jobGroupsValidationError = 'A job with this ID already exists. Groups and jobs cannot use the same ID.';
jobGroupsValidationError = this.props.intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.groupsAndJobsHasSameIdErrorMessage',
defaultMessage: 'A job with this ID already exists. Groups and jobs cannot use the same ID.'
});
} else {
jobGroupsValidationError = validateGroupNames(jobDetails.jobGroups).message;
}
Expand Down Expand Up @@ -185,13 +189,21 @@ export class EditJobFlyout extends Component {

saveJob(this.state.job, newJobData)
.then(() => {
toastNotifications.addSuccess(`Changes to ${this.state.job.job_id} saved`);
toastNotifications.addSuccess(this.props.intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.changesSavedNotificationMessage',
defaultMessage: 'Changes to {jobId} saved' }, {
jobId: this.state.job.job_id }
));
this.refreshJobs();
this.closeFlyout();
})
.catch((error) => {
console.error(error);
toastNotifications.addDanger(`Could not save changes to ${this.state.job.job_id}`);
toastNotifications.addDanger(this.props.intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.changesNotSavedNotificationMessage',
defaultMessage: 'Could not save changes to {jobId}' }, {
jobId: this.state.job.job_id }
));
mlMessageBarService.notify.error(error);
});
}
Expand Down Expand Up @@ -219,9 +231,14 @@ export class EditJobFlyout extends Component {
isValidJobCustomUrls,
} = this.state;

const { intl } = this.props;

const tabs = [{
id: 'job-details',
name: 'Job details',
name: intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.jobDetailsTitle',
defaultMessage: 'Job details'
}),
content: <JobDetails
jobDescription={jobDescription}
jobGroups={jobGroups}
Expand All @@ -232,15 +249,21 @@ export class EditJobFlyout extends Component {
/>,
}, {
id: 'detectors',
name: 'Detectors',
name: intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.detectorsTitle',
defaultMessage: 'Detectors'
}),
content: <Detectors
jobDetectors={jobDetectors}
jobDetectorDescriptions={jobDetectorDescriptions}
setDetectorDescriptions={this.setDetectorDescriptions}
/>,
}, {
id: 'datafeed',
name: 'Datafeed',
name: intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.datafeedTitle',
defaultMessage: 'Datafeed'
}),
content: <Datafeed
datafeedQuery={datafeedQuery}
datafeedQueryDelay={datafeedQueryDelay}
Expand All @@ -251,7 +274,10 @@ export class EditJobFlyout extends Component {
/>,
}, {
id: 'custom-urls',
name: 'Custom URLs',
name: intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrlsTitle',
defaultMessage: 'Custom URLs'
}),
content: <CustomUrls
job={job}
jobCustomUrls={jobCustomUrls}
Expand All @@ -269,7 +295,11 @@ export class EditJobFlyout extends Component {
<EuiFlyoutHeader>
<EuiTitle>
<h2>
Edit {job.id}
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.pageTitle"
defaultMessage="Edit {jobId}"
values={{ jobId: job.id }}
/>
</h2>
</EuiTitle>
</EuiFlyoutHeader>
Expand All @@ -290,7 +320,10 @@ export class EditJobFlyout extends Component {
onClick={this.closeFlyout}
flush="left"
>
Close
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.closeButtonLabel"
defaultMessage="Close"
/>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand All @@ -299,7 +332,10 @@ export class EditJobFlyout extends Component {
fill
isDisabled={(isValidJobDetails === false) || (isValidJobCustomUrls === false)}
>
Save
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.saveButtonLabel"
defaultMessage="Save"
/>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
Expand All @@ -317,9 +353,11 @@ export class EditJobFlyout extends Component {
}
}

EditJobFlyout.propTypes = {
EditJobFlyoutUI.propTypes = {
setShowFunction: PropTypes.func.isRequired,
unsetShowFunction: PropTypes.func.isRequired,
refreshJobs: PropTypes.func.isRequired,
allJobIds: PropTypes.array.isRequired,
};

export const EditJobFlyout = injectI18n(EditJobFlyoutUI);
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ import {
loadIndexPatterns,
} from '../edit_utils';

import { FormattedMessage, injectI18n } from '@kbn/i18n/react';

const MAX_NUMBER_DASHBOARDS = 1000;
const MAX_NUMBER_INDEX_PATTERNS = 1000;

export class CustomUrls extends Component {
class CustomUrlsUI extends Component {
constructor(props) {
super(props);

Expand All @@ -65,13 +67,18 @@ export class CustomUrls extends Component {
}

componentDidMount() {
const { intl } = this.props;

loadSavedDashboards(MAX_NUMBER_DASHBOARDS)
.then((dashboards)=> {
this.setState({ dashboards });
})
.catch((resp) => {
console.log('Error loading list of dashboards:', resp);
toastNotifications.addDanger('An error occurred loading the list of saved Kibana dashboards');
toastNotifications.addDanger(intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.loadSavedDashboardsErrorNotificationMessage',
defaultMessage: 'An error occurred loading the list of saved Kibana dashboards'
}));
});

loadIndexPatterns(MAX_NUMBER_INDEX_PATTERNS)
Expand All @@ -80,7 +87,10 @@ export class CustomUrls extends Component {
})
.catch((resp) => {
console.log('Error loading list of dashboards:', resp);
toastNotifications.addDanger('An error occurred loading the list of saved index patterns');
toastNotifications.addDanger(intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.loadIndexPatternsErrorNotificationMessage',
defaultMessage: 'An error occurred loading the list of saved index patterns'
}));
});
}

Expand Down Expand Up @@ -111,12 +121,16 @@ export class CustomUrls extends Component {
})
.catch((resp) => {
console.log('Error building custom URL from settings:', resp);
toastNotifications.addDanger('An error occurred building the new custom URL from the supplied settings');
toastNotifications.addDanger(this.props.intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.addNewUrlErrorNotificationMessage',
defaultMessage: 'An error occurred building the new custom URL from the supplied settings'
}));
});
}

onTestButtonClick = () => {
const job = this.props.job;
const { intl } = this.props;
buildCustomUrlFromSettings(this.state.editorSettings, job)
.then((customUrl) => {
getTestUrl(job, customUrl)
Expand All @@ -125,12 +139,18 @@ export class CustomUrls extends Component {
})
.catch((resp) => {
console.log('Error obtaining URL for test:', resp);
toastNotifications.addWarning('An error occurred obtaining the URL to test the configuration');
toastNotifications.addWarning(intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.getTestUrlErrorNotificationMessage',
defaultMessage: 'An error occurred obtaining the URL to test the configuration'
}));
});
})
.catch((resp) => {
console.log('Error building custom URL from settings:', resp);
toastNotifications.addWarning('An error occurred building the custom URL for testing from the supplied settings');
toastNotifications.addWarning(intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.buildUrlErrorNotificationMessage',
defaultMessage: 'An error occurred building the custom URL for testing from the supplied settings'
}));
});
}

Expand Down Expand Up @@ -160,7 +180,10 @@ export class CustomUrls extends Component {
size="s"
onClick={() => this.editNewCustomUrl()}
>
Add custom URL
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.customUrls.addCustomUrlButtonLabel"
defaultMessage="Add custom URL"
/>
</EuiButton>
</React.Fragment>
) : (
Expand All @@ -170,7 +193,10 @@ export class CustomUrls extends Component {
color="text"
onClick={() => this.closeEditor()}
iconType="cross"
aria-label="Close custom URL editor"
aria-label={this.props.intl.formatMessage({
id: 'xpack.ml.jobsList.editJobFlyout.customUrls.closeEditorAriaLabel',
defaultMessage: 'Close custom URL editor'
})}
className="close-editor-button"
/>
<CustomUrlEditor
Expand All @@ -188,7 +214,10 @@ export class CustomUrls extends Component {
onClick={() => this.addNewCustomUrl()}
isDisabled={!isValidEditorSettings}
>
Add
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.customUrls.addButtonLabel"
defaultMessage="Add"
/>
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand All @@ -198,7 +227,10 @@ export class CustomUrls extends Component {
onClick={() => this.onTestButtonClick()}
isDisabled={!isValidEditorSettings}
>
Test
<FormattedMessage
id="xpack.ml.jobsList.editJobFlyout.customUrls.testButtonLabel"
defaultMessage="Test"
/>
</EuiButtonEmpty>
</EuiFlexItem>

Expand All @@ -217,8 +249,10 @@ export class CustomUrls extends Component {
);
}
}
CustomUrls.propTypes = {
CustomUrlsUI.propTypes = {
job: PropTypes.object.isRequired,
jobCustomUrls: PropTypes.array.isRequired,
setCustomUrls: PropTypes.func.isRequired,
};

export const CustomUrls = injectI18n(CustomUrlsUI);
Loading