shieldproject / shield

A standalone system that can perform backup and restore functions for a wide variety of pluggable data systems
MIT License
367 stars 69 forks source link

[BUG] Web UI checkbox does not adhere to same boolean spec as plugin library #681

Open thomasmitchell opened 4 years ago

thomasmitchell commented 4 years ago

Describe the bug The plugin library allows for strings to act as booleans for plugin configuration. This is important, because with the current SHIELD CLI, an attempt to configure a boolean data member will instead configure a string (e.g. "false" instead offalse`).

Plugin code here: https://github.com/shieldproject/shield/blob/be0688cc8e3a0d88b147454f4d4626cd50c67900/plugin/endpoint.go#L82

The Web UI, upon seeing the string "false" in the edit target dialogue will show the checkbox as checked, or "true". This is likely because strings in Javascript are truthy, and we're likely doing a naive javascript truthiness check.

To Reproduce Steps to reproduce the behavior:

  1. Set a target of type fs's verbose property to false with the CLI.
  2. Go to the web UI
  3. edit that target
  4. see that the checkbox is checked

Expected behavior I expected the checkbox to be representative of the behavior the plugin would have. In this case, I expected the checkbox to be off.

Screenshots If applicable, add screenshots to help explain your problem.

SHIELD versions (please complete the following information):

Browser version(s) (please complete if reporting a web UI bug):

Additional context Add any other context about the problem here.