1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-27 01:09:41 +02:00

fix(app/mustache): reuse mustache variables in templates [EE-3689] (#7286)

This commit is contained in:
LP B 2022-07-19 15:38:00 +02:00 committed by GitHub
parent 95f4db4f48
commit 1a8fe82821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,12 +38,15 @@ export function intersectVariables(
) { ) {
const oldVariablesWithLabel = oldVariables.filter((v) => !!v.label); const oldVariablesWithLabel = oldVariables.filter((v) => !!v.label);
return [ return _.uniqBy(
[
...oldVariablesWithLabel, ...oldVariablesWithLabel,
...newVariables.filter( ...newVariables.filter(
(v) => !oldVariablesWithLabel.find(({ name }) => name === v.name) (v) => !oldVariablesWithLabel.find(({ name }) => name === v.name)
), ),
]; ],
'name'
);
} }
export function renderTemplate( export function renderTemplate(