mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
(cherry picked from commit 42839e104e
)
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
This commit is contained in:
parent
83426b30cd
commit
15580f36a0
1 changed files with 19 additions and 1 deletions
|
@ -210,7 +210,24 @@ export const EditPackagePolicyForm = memo<{
|
|||
...restOfPackagePolicy,
|
||||
inputs: baseInputs.map((input: any) => {
|
||||
// Remove `compiled_input` from all input info, we assign this after saving
|
||||
const { streams, compiled_input: compiledInput, ...restOfInput } = input;
|
||||
const { streams, compiled_input: compiledInput, vars, ...restOfInput } = input;
|
||||
let basePolicyInputVars: any =
|
||||
isUpgrade &&
|
||||
basePolicy.inputs.find(
|
||||
(i) => i.type === input.type && i.policy_template === input.policy_template
|
||||
)?.vars;
|
||||
let newVars = vars;
|
||||
if (basePolicyInputVars && vars) {
|
||||
// merging vars from dry run with updated ones
|
||||
basePolicyInputVars = Object.keys(vars).reduce(
|
||||
(acc, curr) => ({ ...acc, [curr]: basePolicyInputVars[curr] }),
|
||||
{}
|
||||
);
|
||||
newVars = {
|
||||
...vars,
|
||||
...basePolicyInputVars,
|
||||
};
|
||||
}
|
||||
return {
|
||||
...restOfInput,
|
||||
streams: streams.map((stream: any) => {
|
||||
|
@ -218,6 +235,7 @@ export const EditPackagePolicyForm = memo<{
|
|||
const { compiled_stream, ...restOfStream } = stream;
|
||||
return restOfStream;
|
||||
}),
|
||||
vars: newVars,
|
||||
};
|
||||
}),
|
||||
package: basePackage,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue