-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Adding reset anomaly detection jobs link to jobs list (#108039)
* [ML] Adding reset jobs link to jobs list * fixing types * updating types * improving react code * adding closed job warning callout * small code changes after review * updating comment for api docs * adding canResetJob to security's emptyMlCapabilities * updating apidoc * adding blocked to job summary * udating test * adding delayed refresh back in * updating tests * adding better reverting controls and labels * fixing bug in delete modal * updating job task polling for all blocking tasks * fixing types after es client update * one other type correction Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
dd33a55
commit 61d1e56
Showing
33 changed files
with
637 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
export const JOB_ACTION = { | ||
DELETE: 'delete', | ||
RESET: 'reset', | ||
REVERT: 'revert', | ||
} as const; | ||
|
||
export type JobAction = typeof JOB_ACTION[keyof typeof JOB_ACTION]; | ||
|
||
export function getJobActionString(action: JobAction) { | ||
switch (action) { | ||
case JOB_ACTION.DELETE: | ||
return i18n.translate('xpack.ml.models.jobService.deletingJob', { | ||
defaultMessage: 'deleting', | ||
}); | ||
case JOB_ACTION.RESET: | ||
return i18n.translate('xpack.ml.models.jobService.resettingJob', { | ||
defaultMessage: 'resetting', | ||
}); | ||
case JOB_ACTION.REVERT: | ||
return i18n.translate('xpack.ml.models.jobService.revertingJob', { | ||
defaultMessage: 'reverting', | ||
}); | ||
default: | ||
return ''; | ||
} | ||
} | ||
|
||
export const JOB_ACTION_TASK: Record<string, JobAction> = { | ||
'cluster:admin/xpack/ml/job/delete': JOB_ACTION.DELETE, | ||
'cluster:admin/xpack/ml/job/reset': JOB_ACTION.RESET, | ||
'cluster:admin/xpack/ml/job/model_snapshots/revert': JOB_ACTION.REVERT, | ||
}; | ||
|
||
export const JOB_ACTION_TASKS = Object.keys(JOB_ACTION_TASK); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.