diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/contants.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts similarity index 92% rename from x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/contants.ts rename to x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts index a58aad6dc6bc2..225432375dc75 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/contants.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/constants.ts @@ -14,6 +14,9 @@ export const DELETE_PHASE_POLICY = { hot: { min_age: '0ms', actions: { + set_priority: { + priority: null, + }, rollover: { max_size: '50gb', }, diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx index a36cd7e35c36f..d6c955e0c0813 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx @@ -8,7 +8,7 @@ import { act } from 'react-dom/test-utils'; import { registerTestBed, TestBed, TestBedConfig } from '../../../../../test_utils'; -import { POLICY_NAME } from './contants'; +import { POLICY_NAME } from './constants'; import { TestSubjects } from '../helpers'; import { EditPolicy } from '../../../public/application/sections/edit_policy'; diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts index cc04749af3205..8753f01376d42 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils'; import { setupEnvironment } from '../helpers/setup_environment'; import { EditPolicyTestBed, setup } from './edit_policy.helpers'; -import { DELETE_PHASE_POLICY } from './contants'; +import { DELETE_PHASE_POLICY } from './constants'; import { API_BASE_PATH } from '../../../common/constants'; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js index 32c6d93383c22..5bea22f0b3a76 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js @@ -193,8 +193,11 @@ const phaseFromES = (phase, phaseName, defaultEmptyPolicy) => { } if (actions.set_priority) { - policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority; + const { priority } = actions.set_priority; + + policy[PHASE_INDEX_PRIORITY] = priority ?? ''; } + if (actions.wait_for_snapshot) { policy[PHASE_WAIT_FOR_SNAPSHOT_POLICY] = actions.wait_for_snapshot.policy; } @@ -311,6 +314,10 @@ export const phaseToES = (phase, originalEsPhase) => { esPhase.actions.set_priority = { priority: phase[PHASE_INDEX_PRIORITY], }; + } else if (phase[PHASE_INDEX_PRIORITY] === '') { + esPhase.actions.set_priority = { + priority: null, + }; } if (phase[PHASE_WAIT_FOR_SNAPSHOT_POLICY]) { diff --git a/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts b/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts index 7bf3f96e2b2ef..a35255b3f65ad 100644 --- a/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts +++ b/x-pack/plugins/index_lifecycle_management/server/routes/api/policies/register_create_route.ts @@ -30,7 +30,7 @@ const minAgeSchema = schema.maybe(schema.string()); const setPrioritySchema = schema.maybe( schema.object({ - priority: schema.number(), + priority: schema.nullable(schema.number()), }) );