diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js
index aec57e0d33cdd..29c79458fe431 100644
--- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js
+++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js
@@ -31,6 +31,7 @@ import { withKibana } from '../../../../../../../../../src/plugins/kibana_react/
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { collapseLiteralStrings } from '../../../../../../shared_imports';
+import { DATAFEED_STATE } from '../../../../../../common/constants/states';
export class EditJobFlyoutUI extends Component {
_initialJobFormState = null;
@@ -41,6 +42,7 @@ export class EditJobFlyoutUI extends Component {
this.state = {
job: {},
hasDatafeed: false,
+ datafeedRunning: false,
isFlyoutVisible: false,
isConfirmationModalVisible: false,
jobDescription: '',
@@ -157,10 +159,12 @@ export class EditJobFlyoutUI extends Component {
extractJob(job, hasDatafeed) {
this.extractInitialJobFormState(job, hasDatafeed);
+ const datafeedRunning = hasDatafeed && job.datafeed_config.state !== DATAFEED_STATE.STOPPED;
this.setState({
job,
hasDatafeed,
+ datafeedRunning,
jobModelMemoryLimitValidationError: '',
jobGroupsValidationError: '',
...cloneDeep(this._initialJobFormState),
@@ -283,6 +287,7 @@ export class EditJobFlyoutUI extends Component {
jobModelMemoryLimitValidationError,
isValidJobDetails,
isValidJobCustomUrls,
+ datafeedRunning,
} = this.state;
const tabs = [
@@ -293,6 +298,7 @@ export class EditJobFlyoutUI extends Component {
}),
content: (
),
},
diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js
index 096a03621d422..3d81b767021a0 100644
--- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js
+++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/datafeed.js
@@ -7,7 +7,14 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
-import { EuiFieldText, EuiForm, EuiFormRow, EuiSpacer, EuiFieldNumber } from '@elastic/eui';
+import {
+ EuiFieldText,
+ EuiForm,
+ EuiFormRow,
+ EuiSpacer,
+ EuiFieldNumber,
+ EuiCallOut,
+} from '@elastic/eui';
import { calculateDatafeedFrequencyDefaultSeconds } from '../../../../../../../common/util/job_utils';
import { getNewJobDefaults } from '../../../../../services/ml_server_info';
@@ -72,9 +79,21 @@ export class Datafeed extends Component {
render() {
const { query, queryDelay, frequency, scrollSize, defaults } = this.state;
+ const { datafeedRunning } = this.props;
return (
+ {datafeedRunning && (
+ <>
+
+
+
+
+ >
+ )}
@@ -140,6 +163,7 @@ export class Datafeed extends Component {
}
}
Datafeed.propTypes = {
+ datafeedRunning: PropTypes.bool.isRequired,
datafeedQuery: PropTypes.string.isRequired,
datafeedQueryDelay: PropTypes.string.isRequired,
datafeedFrequency: PropTypes.string.isRequired,
diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js
index a609d6a7c3fba..672fd8cefaaba 100644
--- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js
+++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/edit_job_flyout/tabs/job_details.js
@@ -105,6 +105,7 @@ export class JobDetails extends Component {
mmlValidationError,
groupsValidationError,
} = this.state;
+ const { datafeedRunning } = this.props;
return (
@@ -152,6 +153,14 @@ export class JobDetails extends Component {
defaultMessage="Model memory limit"
/>
}
+ helpText={
+ datafeedRunning ? (
+
+ ) : null
+ }
isInvalid={mmlValidationError !== ''}
error={mmlValidationError}
>
@@ -160,6 +169,7 @@ export class JobDetails extends Component {
onChange={this.onMmlChange}
isInvalid={mmlValidationError !== ''}
error={mmlValidationError}
+ disabled={datafeedRunning}
/>
@@ -168,6 +178,7 @@ export class JobDetails extends Component {
}
}
JobDetails.propTypes = {
+ datafeedRunning: PropTypes.bool.isRequired,
jobDescription: PropTypes.string.isRequired,
jobGroups: PropTypes.array.isRequired,
jobModelMemoryLimit: PropTypes.string.isRequired,
diff --git a/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts b/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts
index ee49da6538460..466e70197e3d1 100644
--- a/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts
+++ b/x-pack/plugins/ml/server/routes/schemas/datafeeds_schema.ts
@@ -24,7 +24,7 @@ export const datafeedConfigSchema = schema.object({
})
),
frequency: schema.maybe(schema.string()),
- indices: schema.arrayOf(schema.string()),
+ indices: schema.maybe(schema.arrayOf(schema.string())),
indexes: schema.maybe(schema.arrayOf(schema.string())),
job_id: schema.maybe(schema.string()),
query: schema.maybe(schema.any()),