mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] Fix Anomaly Detection job model memory limit input editable when datafeed is open (#97723)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
07c45e1bcf
commit
47d863b0ff
2 changed files with 33 additions and 11 deletions
|
@ -32,7 +32,7 @@ import { toastNotificationServiceProvider } from '../../../../services/toast_not
|
|||
import { ml } from '../../../../services/ml_api_service';
|
||||
import { withKibana } from '../../../../../../../../../src/plugins/kibana_react/public';
|
||||
import { collapseLiteralStrings } from '../../../../../../shared_imports';
|
||||
import { DATAFEED_STATE } from '../../../../../../common/constants/states';
|
||||
import { DATAFEED_STATE, JOB_STATE } from '../../../../../../common/constants/states';
|
||||
|
||||
export class EditJobFlyoutUI extends Component {
|
||||
_initialJobFormState = null;
|
||||
|
@ -176,11 +176,13 @@ export class EditJobFlyoutUI extends Component {
|
|||
extractJob(job, hasDatafeed) {
|
||||
this.extractInitialJobFormState(job, hasDatafeed);
|
||||
const datafeedRunning = hasDatafeed && job.datafeed_config.state !== DATAFEED_STATE.STOPPED;
|
||||
const jobClosed = job.state === JOB_STATE.CLOSED;
|
||||
|
||||
this.setState({
|
||||
job,
|
||||
hasDatafeed,
|
||||
datafeedRunning,
|
||||
jobClosed,
|
||||
jobModelMemoryLimitValidationError: '',
|
||||
jobGroupsValidationError: '',
|
||||
...cloneDeep(this._initialJobFormState),
|
||||
|
@ -318,6 +320,7 @@ export class EditJobFlyoutUI extends Component {
|
|||
isValidJobDetails,
|
||||
isValidJobCustomUrls,
|
||||
datafeedRunning,
|
||||
jobClosed,
|
||||
} = this.state;
|
||||
|
||||
const tabs = [
|
||||
|
@ -328,6 +331,7 @@ export class EditJobFlyoutUI extends Component {
|
|||
}),
|
||||
content: (
|
||||
<JobDetails
|
||||
jobClosed={jobClosed}
|
||||
datafeedRunning={datafeedRunning}
|
||||
jobDescription={jobDescription}
|
||||
jobGroups={jobGroups}
|
||||
|
|
|
@ -59,10 +59,32 @@ export class JobDetails extends Component {
|
|||
? props.jobGroups.map((g) => ({ label: g, color: tabColor(g) }))
|
||||
: [];
|
||||
|
||||
const { datafeedRunning, jobClosed } = props;
|
||||
|
||||
let mmlHelpText = null;
|
||||
if (!jobClosed) {
|
||||
mmlHelpText = (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobsList.editJobFlyout.jobDetails.modelMemoryLimitJobOpenLabelHelp"
|
||||
defaultMessage="Model memory limit cannot be edited while the job is open."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (datafeedRunning) {
|
||||
mmlHelpText = (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobsList.editJobFlyout.jobDetails.modelMemoryLimitLabelHelp"
|
||||
defaultMessage="Model memory limit cannot be edited while the datafeed is running."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
description: props.jobDescription,
|
||||
selectedGroups,
|
||||
mml: props.jobModelMemoryLimit,
|
||||
mmlHelpText,
|
||||
mmlValidationError: props.jobModelMemoryLimitValidationError,
|
||||
groupsValidationError: props.jobGroupsValidationError,
|
||||
modelSnapshotRetentionDays: props.jobModelSnapshotRetentionDays,
|
||||
|
@ -139,8 +161,11 @@ export class JobDetails extends Component {
|
|||
groupsValidationError,
|
||||
modelSnapshotRetentionDays,
|
||||
dailyModelSnapshotRetentionAfterDays,
|
||||
mmlHelpText,
|
||||
} = this.state;
|
||||
const { datafeedRunning } = this.props;
|
||||
|
||||
const { datafeedRunning, jobClosed } = this.props;
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<EuiSpacer size="m" />
|
||||
|
@ -188,14 +213,7 @@ export class JobDetails extends Component {
|
|||
defaultMessage="Model memory limit"
|
||||
/>
|
||||
}
|
||||
helpText={
|
||||
datafeedRunning ? (
|
||||
<FormattedMessage
|
||||
id="xpack.ml.jobsList.editJobFlyout.jobDetails.modelMemoryLimitLabelHelp"
|
||||
defaultMessage="Model memory limit cannot be edited while the datafeed is running."
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
helpText={mmlHelpText}
|
||||
isInvalid={mmlValidationError !== ''}
|
||||
error={mmlValidationError}
|
||||
>
|
||||
|
@ -204,7 +222,7 @@ export class JobDetails extends Component {
|
|||
onChange={this.onMmlChange}
|
||||
isInvalid={mmlValidationError !== ''}
|
||||
error={mmlValidationError}
|
||||
disabled={datafeedRunning}
|
||||
disabled={datafeedRunning || !jobClosed}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
<EuiFormRow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue