mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ML] Adding type for job summary state (#131643)
* [ML] Adding type for job summary state * renaming type * translations * fixing jobState types in security * fixing snapshots * fixing test
This commit is contained in:
parent
c21c8f7006
commit
1dc6216053
12 changed files with 19 additions and 29 deletions
|
@ -5,8 +5,6 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
|
||||
export const JOB_ACTION = {
|
||||
DELETE: 'delete',
|
||||
RESET: 'reset',
|
||||
|
@ -15,22 +13,16 @@ export const JOB_ACTION = {
|
|||
|
||||
export type JobAction = typeof JOB_ACTION[keyof typeof JOB_ACTION];
|
||||
|
||||
export function getJobActionString(action: JobAction) {
|
||||
export type JobActionState = 'deleting' | 'resetting' | 'reverting';
|
||||
|
||||
export function getJobActionString(action: JobAction): JobActionState {
|
||||
switch (action) {
|
||||
case JOB_ACTION.DELETE:
|
||||
return i18n.translate('xpack.ml.models.jobService.deletingJob', {
|
||||
defaultMessage: 'deleting',
|
||||
});
|
||||
return 'deleting';
|
||||
case JOB_ACTION.RESET:
|
||||
return i18n.translate('xpack.ml.models.jobService.resettingJob', {
|
||||
defaultMessage: 'resetting',
|
||||
});
|
||||
return 'resetting';
|
||||
case JOB_ACTION.REVERT:
|
||||
return i18n.translate('xpack.ml.models.jobService.revertingJob', {
|
||||
defaultMessage: 'reverting',
|
||||
});
|
||||
default:
|
||||
return '';
|
||||
return 'reverting';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,3 +21,4 @@ export { extractErrorMessage } from './util/errors';
|
|||
export type { RuntimeMappings } from './types/fields';
|
||||
export { getDefaultCapabilities as getDefaultMlCapabilities } from './types/capabilities';
|
||||
export { DATAFEED_STATE, JOB_STATE } from './constants/states';
|
||||
export type { MlSummaryJob, SummaryJobState } from './types/anomaly_detection_jobs';
|
||||
|
|
|
@ -5,15 +5,19 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { Moment } from 'moment';
|
||||
|
||||
import { MlCustomSettings } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import type { CombinedJob, CombinedJobWithStats } from './combined_job';
|
||||
import type { MlAnomalyDetectionAlertRule } from '../alerts';
|
||||
import type { MlJobBlocked } from './job';
|
||||
import type { JobActionState } from '../../constants/job_actions';
|
||||
export type { Datafeed } from './datafeed';
|
||||
export type { DatafeedStats } from './datafeed_stats';
|
||||
|
||||
export type SummaryJobState = estypes.MlJobState | JobActionState;
|
||||
|
||||
/**
|
||||
* A summary of an anomaly detection job.
|
||||
*/
|
||||
|
@ -47,7 +51,7 @@ export interface MlSummaryJob {
|
|||
/**
|
||||
* The status of the job.
|
||||
*/
|
||||
jobState: string;
|
||||
jobState: SummaryJobState;
|
||||
|
||||
/**
|
||||
* An array of index names used by the datafeed. Wildcards are supported.
|
||||
|
|
|
@ -14,6 +14,8 @@ export type {
|
|||
AnomalyResultType as MlAnomalyResultType,
|
||||
DatafeedStats as MlDatafeedStats,
|
||||
Job as MlJob,
|
||||
MlSummaryJob,
|
||||
SummaryJobState as MlSummaryJobState,
|
||||
} from './shared';
|
||||
export {
|
||||
UnknownMLCapabilitiesError,
|
||||
|
|
|
@ -548,7 +548,7 @@ export const mockSecurityJobs: SecurityJob[] = [
|
|||
datafeedState: '',
|
||||
hasDatafeed: false,
|
||||
isSingleMetricViewerJob: false,
|
||||
jobState: '',
|
||||
jobState: 'closed',
|
||||
memory_status: '',
|
||||
processed_record_count: 0,
|
||||
id: 'rare_process_by_host_windows_ecs',
|
||||
|
|
|
@ -44,7 +44,7 @@ describe('useSecurityJobsHelpers', () => {
|
|||
isElasticJob: true,
|
||||
isInstalled: false,
|
||||
isSingleMetricViewerJob: false,
|
||||
jobState: '',
|
||||
jobState: 'closed',
|
||||
jobTags: {},
|
||||
memory_status: '',
|
||||
moduleId: 'siem_auditbeat',
|
||||
|
|
|
@ -32,7 +32,7 @@ export const moduleToSecurityJob = (
|
|||
datafeedState: '',
|
||||
hasDatafeed: false,
|
||||
isSingleMetricViewerJob: false,
|
||||
jobState: '',
|
||||
jobState: 'closed',
|
||||
memory_status: '',
|
||||
processed_record_count: 0,
|
||||
id: moduleJob.id,
|
||||
|
|
|
@ -100,7 +100,7 @@ exports[`JobsTableComponent renders correctly against snapshot 1`] = `
|
|||
"isElasticJob": true,
|
||||
"isInstalled": false,
|
||||
"isSingleMetricViewerJob": false,
|
||||
"jobState": "",
|
||||
"jobState": "closed",
|
||||
"jobTags": Object {},
|
||||
"memory_status": "",
|
||||
"moduleId": "siem_winlogbeat",
|
||||
|
|
|
@ -103,7 +103,7 @@ exports[`JobsTableFilters renders correctly against snapshot 1`] = `
|
|||
"isElasticJob": true,
|
||||
"isInstalled": false,
|
||||
"isSingleMetricViewerJob": false,
|
||||
"jobState": "",
|
||||
"jobState": "closed",
|
||||
"jobTags": Object {},
|
||||
"memory_status": "",
|
||||
"moduleId": "siem_winlogbeat",
|
||||
|
|
|
@ -18799,11 +18799,8 @@
|
|||
"xpack.ml.models.jobService.categorization.messages.validTokenLength": "Plus de {tokenCount} tokens par exemple ont été trouvés dans plus de {percentage} % des exemples chargés.",
|
||||
"xpack.ml.models.jobService.categorization.messages.validTooManyTokens": "Moins de 10 000 tokens ont été trouvés en tout dans les exemples chargés.",
|
||||
"xpack.ml.models.jobService.categorization.messages.validUserPrivileges": "L'utilisateur dispose de privilèges suffisants pour effectuer les vérifications.",
|
||||
"xpack.ml.models.jobService.deletingJob": "suppression",
|
||||
"xpack.ml.models.jobService.jobHasNoDatafeedErrorMessage": "La tâche ne comporte aucun flux de données",
|
||||
"xpack.ml.models.jobService.requestToActionTimedOutErrorMessage": "La requête pour {action} \"{id}\" a expiré.{extra}",
|
||||
"xpack.ml.models.jobService.resettingJob": "réinitialisation",
|
||||
"xpack.ml.models.jobService.revertingJob": "restauration",
|
||||
"xpack.ml.models.jobService.revertModelSnapshot.autoCreatedCalendar.description": "Créé automatiquement",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEmptyMessage": "Le champ d’étendue du compartiment doit être spécifié.",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEstimationMismatchHeading": "Étendue du compartiment",
|
||||
|
|
|
@ -18946,11 +18946,8 @@
|
|||
"xpack.ml.models.jobService.categorization.messages.validTokenLength": "読み込んだサンプルの {percentage}% 以上でサンプルあたり {tokenCount} 個を超えるトークンが見つかりました。",
|
||||
"xpack.ml.models.jobService.categorization.messages.validTooManyTokens": "読み込んだサンプル内に合計で 10000 個未満のトークンがありました。",
|
||||
"xpack.ml.models.jobService.categorization.messages.validUserPrivileges": "ユーザーには、確認を実行する十分な権限があります。",
|
||||
"xpack.ml.models.jobService.deletingJob": "削除中",
|
||||
"xpack.ml.models.jobService.jobHasNoDatafeedErrorMessage": "ジョブにデータフィードがありません",
|
||||
"xpack.ml.models.jobService.requestToActionTimedOutErrorMessage": "「{id}」を{action}するリクエストがタイムアウトしました。{extra}",
|
||||
"xpack.ml.models.jobService.resettingJob": "セットしています",
|
||||
"xpack.ml.models.jobService.revertingJob": "元に戻しています",
|
||||
"xpack.ml.models.jobService.revertModelSnapshot.autoCreatedCalendar.description": "自動作成されました",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEmptyMessage": "バケットスパンフィールドを指定する必要があります。",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEstimationMismatchHeading": "バケットスパン",
|
||||
|
|
|
@ -18975,11 +18975,8 @@
|
|||
"xpack.ml.models.jobService.categorization.messages.validTokenLength": "在 {percentage}% 以上的已加载示例中为每个示例找到 {tokenCount} 个以上分词。",
|
||||
"xpack.ml.models.jobService.categorization.messages.validTooManyTokens": "在已加载示例中总共找到的分词不超过 10000 个。",
|
||||
"xpack.ml.models.jobService.categorization.messages.validUserPrivileges": "用户有足够的权限执行检查。",
|
||||
"xpack.ml.models.jobService.deletingJob": "正在删除",
|
||||
"xpack.ml.models.jobService.jobHasNoDatafeedErrorMessage": "作业没有数据馈送",
|
||||
"xpack.ml.models.jobService.requestToActionTimedOutErrorMessage": "对 {action} “{id}” 的请求超时。{extra}",
|
||||
"xpack.ml.models.jobService.resettingJob": "正在重置",
|
||||
"xpack.ml.models.jobService.revertingJob": "正在恢复",
|
||||
"xpack.ml.models.jobService.revertModelSnapshot.autoCreatedCalendar.description": "自动创建",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEmptyMessage": "必须指定存储桶跨度字段。",
|
||||
"xpack.ml.models.jobValidation.messages.bucketSpanEstimationMismatchHeading": "存储桶跨度",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue