Skip to content

Commit

Permalink
[7.8] [ILM] Fix bug when clearing priority field (#70154) (#70278)
Browse files Browse the repository at this point in the history
  • Loading branch information
alisonelizabeth authored Jun 30, 2020
1 parent 61a3188 commit 8c0fe9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ 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 ?? '';
}
}
return policy;
Expand Down Expand Up @@ -307,6 +309,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,
};
}
return esPhase;
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const minAgeSchema = schema.maybe(schema.string());

const setPrioritySchema = schema.maybe(
schema.object({
priority: schema.number(),
priority: schema.nullable(schema.number()),
})
);

Expand Down

0 comments on commit 8c0fe9f

Please sign in to comment.