Skip to content

Commit

Permalink
[req-changes] Fixed JS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Jul 13, 2023
1 parent 8ba464f commit d8563c3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions openwisp_controller/config/static/config/js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@
// If the contextValue was set by a template or group, then
// override the value.
(prevDefaultValues.hasOwnProperty(key) && prevDefaultValues[key] !== defaultValues[key]) ||
// Gives precedence to device's context (saved in database) and SystemContextValue
(!contextValue.hasOwnProperty(key) && !systemContextValue.hasOwnProperty(key))
// Gives precedence to device's context (saved in database)
(!contextValue.hasOwnProperty(key) &&
// Gives precedence to systemContextValue.
// But if the default value is equal to the system context value,
// then add the variable in the contextValue. This allows users
// to override the value.
(!systemContextValue.hasOwnProperty(key) || systemContextValue[key] === defaultValues[key])
)
) {
contextValue[key] = defaultValues[key];
}
Expand Down

0 comments on commit d8563c3

Please sign in to comment.