Skip to content

Commit

Permalink
[ML] Add constants, update descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
qn895 committed Sep 2, 2020
1 parent 56bef02 commit 1118b3e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
6 changes: 6 additions & 0 deletions x-pack/plugins/ml/common/constants/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
export const FILE_DATA_VISUALIZER_MAX_FILE_SIZE = 'ml:fileDataVisualizerMaxFileSize';
export const ANOMALY_DETECTION_ENABLE_TIME_RANGE = 'ml:anomalyDetection:results:enableTmeDefaults';
export const ANOMALY_DETECTION_DEFAULT_TIME_RANGE = 'ml:anomalyDetection:results:timeDefaults';

export const DEFAULT_AD_RESULTS_TIME_FILTER = {
from: 'now-15m',
to: 'now',
};
export const DEFAULT_ENABLE_AD_RESULTS_TIME_FILTER = false;
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/public/application/explorer/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class Explorer extends React.Component {
toastNotifications.addWarning(
i18n.translate('xpack.ml.explorer.invalidTimeRangeInUrlCallout', {
defaultMessage:
'The time filter changed to the full range for this job due to invalid default time filter. Please check the advanced settings for {field}.',
'The time filter was changed to the full range due to an invalid default time filter. Check the advanced settings for {field}.',
values: {
field: ANOMALY_DETECTION_DEFAULT_TIME_RANGE,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { i18n } from '@kbn/i18n';
import { MlSummaryJobs } from '../../../../../common/types/anomaly_detection_jobs';
import { useCreateADLinks } from '../../../components/custom_hooks/use_create_ad_links';

// @ts-ignore no module file

interface Props {
jobsList: MlSummaryJobs;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ export class TimeSeriesExplorer extends React.Component {
toastNotifications.addWarning(
i18n.translate('xpack.ml.timeSeriesExplorer.invalidTimeRangeInUrlCallout', {
defaultMessage:
'The time filter changed to the full range for this job due to invalid default time filter. Please check the advanced settings for {field}.',
'The time filter was changed to the full range for this job due to an invalid default time filter. Check the advanced settings for {field}.',
values: {
field: ANOMALY_DETECTION_DEFAULT_TIME_RANGE,
},
Expand Down
15 changes: 7 additions & 8 deletions x-pack/plugins/ml/server/lib/register_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
FILE_DATA_VISUALIZER_MAX_FILE_SIZE,
ANOMALY_DETECTION_DEFAULT_TIME_RANGE,
ANOMALY_DETECTION_ENABLE_TIME_RANGE,
DEFAULT_AD_RESULTS_TIME_FILTER,
DEFAULT_ENABLE_AD_RESULTS_TIME_FILTER,
} from '../../common/constants/settings';
import { MAX_FILE_SIZE } from '../../common/constants/file_datavisualizer';

Expand All @@ -36,28 +38,25 @@ export function registerKibanaSettings(coreSetup: CoreSetup) {
},
[ANOMALY_DETECTION_ENABLE_TIME_RANGE]: {
name: i18n.translate('xpack.ml.advancedSettings.enableAnomalyDetectionDefaultTimeRangeName', {
defaultMessage: 'Enable time filter defaults for anomaly detection jobs',
defaultMessage: 'Enable time filter defaults for anomaly detection results',
}),
value: false,
value: DEFAULT_ENABLE_AD_RESULTS_TIME_FILTER,
schema: schema.boolean(),
description: i18n.translate(
'xpack.ml.advancedSettings.enableAnomalyDetectionDefaultTimeRangeDesc',
{
defaultMessage:
'Use the default time filter in the Single Metric Viewer and Anomaly Explorer.',
'Use the default time filter in the Single Metric Viewer and Anomaly Explorer. If not enabled, the results for the full time range of the job are displayed.',
}
),
category: ['Machine Learning'],
},
[ANOMALY_DETECTION_DEFAULT_TIME_RANGE]: {
name: i18n.translate('xpack.ml.advancedSettings.anomalyDetectionDefaultTimeRangeName', {
defaultMessage: 'Time filter defaults',
defaultMessage: 'Time filter defaults for anomaly detection results',
}),
type: 'json',
value: `{
"from": "now-15m",
"to": "now"
}`,
value: JSON.stringify(DEFAULT_AD_RESULTS_TIME_FILTER, null, 2),
description: i18n.translate(
'xpack.ml.advancedSettings.anomalyDetectionDefaultTimeRangeDesc',
{
Expand Down

0 comments on commit 1118b3e

Please sign in to comment.