Skip to content

Commit

Permalink
[ML] Update message
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Apr 12, 2021
1 parent c1263ef commit 058c5dd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
12 changes: 6 additions & 6 deletions x-pack/plugins/ml/common/util/job_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ export function isSourceDataChartableForDetector(job: CombinedJob, detectorIndex

// We cannot plot the source data for some specific aggregation configurations
const aggs = getDatafeedAggregations(job.datafeed_config);
if (aggs !== undefined) {
if (isPopulatedObject(aggs)) {
const aggBucketsName = getFirstKeyInObject(aggs);
if (aggBucketsName !== undefined) {
// if fieldName is a aggregated field under nested terms using bucket_script
// if fieldName is an aggregated field under nested terms using bucket_script
const aggregations =
getAggregations<estypes.AggregationContainer>(aggs[aggBucketsName]) ?? {};
const foundField = findAggField(aggregations, dtr.field_name, false);
Expand Down Expand Up @@ -198,16 +198,16 @@ export function isModelPlotChartableForDetector(job: Job, detectorIndex: number)
export function getSingleMetricViewerJobErrorMessage(job: CombinedJob): string | undefined {
// if job has at least one composite source that is not terms or date_histogram
const aggs = getDatafeedAggregations(job.datafeed_config);
if (aggs !== undefined) {
if (isPopulatedObject(aggs)) {
const aggBucketsName = getFirstKeyInObject(aggs);
if (aggBucketsName !== undefined && aggs[aggBucketsName] !== undefined) {
// if fieldName is a aggregated field under nested terms using bucket_script
// if fieldName is an aggregated field under nested terms using bucket_script

if (!hasValidComposite(aggs[aggBucketsName])) {
return i18n.translate(
'xpack.ml.timeSeriesJob.jobWithUnsupportedCompositeAggregationMessage',
{
defaultMessage: 'the datafeed contains unsupported composite sources',
defaultMessage: 'Disabled because the datafeed contains unsupported composite sources.',
}
);
}
Expand All @@ -223,7 +223,7 @@ export function getSingleMetricViewerJobErrorMessage(job: CombinedJob): string |

if (isChartableTimeSeriesViewJob === false) {
return i18n.translate('xpack.ml.timeSeriesJob.notViewableTimeSeriesJobMessage', {
defaultMessage: 'not a viewable time series job',
defaultMessage: 'Disabled because not a viewable time series job.',
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ export function ResultLinks({ jobs }) {
const singleMetricDisabledMessage =
jobs.length === 1 && jobs[0].isNotSingleMetricViewerJobMessage;

const singleMetricDisabledMessageText =
singleMetricDisabledMessage !== undefined
? i18n.translate('xpack.ml.jobsList.resultActions.singleMetricDisabledMessageText', {
defaultMessage: 'Disabled because {reason}.',
values: {
reason: singleMetricDisabledMessage,
},
})
: undefined;

const jobActionsDisabled = jobs.length === 1 && jobs[0].deleting === true;
const { createLinkWithUserDefaults } = useCreateADLinks();
const timeSeriesExplorerLink = useMemo(
Expand All @@ -62,7 +52,7 @@ export function ResultLinks({ jobs }) {
{singleMetricVisible && (
<EuiToolTip
position="bottom"
content={singleMetricDisabledMessageText ?? openJobsInSingleMetricViewerText}
content={singleMetricDisabledMessage ?? openJobsInSingleMetricViewerText}
>
<EuiButtonIcon
href={timeSeriesExplorerLink}
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -14209,7 +14209,6 @@
"xpack.ml.jobsList.refreshButtonLabel": "更新",
"xpack.ml.jobsList.resultActions.openJobsInAnomalyExplorerText": "{jobsCount, plural, one {{jobId}} other {# 件のジョブ}} を異常エクスプローラーで開く",
"xpack.ml.jobsList.resultActions.openJobsInSingleMetricViewerText": "シングルメトリックビューアーで {jobsCount, plural, one {{jobId}} other {# 件のジョブ}} を開く",
"xpack.ml.jobsList.resultActions.singleMetricDisabledMessageText": "{reason}のため無効です。",
"xpack.ml.jobsList.selectRowForJobMessage": "ジョブID {jobId} の行を選択",
"xpack.ml.jobsList.showDetailsColumn.screenReaderDescription": "このカラムには各ジョブの詳細を示すクリック可能なコントロールが含まれます",
"xpack.ml.jobsList.spacesLabel": "スペース",
Expand Down Expand Up @@ -23571,4 +23570,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。",
"xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。"
}
}
}
3 changes: 1 addition & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -14406,7 +14406,6 @@
"xpack.ml.jobsList.refreshButtonLabel": "刷新",
"xpack.ml.jobsList.resultActions.openJobsInAnomalyExplorerText": "在 Anomaly Explorer 中打开 {jobsCount, plural, one {{jobId}} other {# 个作业}}",
"xpack.ml.jobsList.resultActions.openJobsInSingleMetricViewerText": "在 Single Metric Viewer 中打开 {jobsCount, plural, one {{jobId}} other {# 个作业}}",
"xpack.ml.jobsList.resultActions.singleMetricDisabledMessageText": "由于{reason},已禁用。",
"xpack.ml.jobsList.selectRowForJobMessage": "选择作业 ID {jobId} 的行",
"xpack.ml.jobsList.showDetailsColumn.screenReaderDescription": "此列包含可单击控件,用于显示每个作业的更多详情",
"xpack.ml.jobsList.spacesLabel": "工作区",
Expand Down Expand Up @@ -23940,4 +23939,4 @@
"xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。",
"xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。"
}
}
}

0 comments on commit 058c5dd

Please sign in to comment.