openwisp / openwisp-controller

Network and WiFi controller: provisioning, configuration management and updates, (pull via openwisp-config or push via SSH), x509 PKI management and more. Mainly OpenWRT, but designed to work also on other systems.
https://openwisp.io/docs/dev/controller/
Other
549 stars 176 forks source link

[bug] Multiple UI issues in configuration editor for Device #910

Closed kkreitmair closed 1 week ago

kkreitmair commented 3 weeks ago

Describe the bug There are two bugs in the configuration default editor for a Device in the admin.

  1. For select fields, with predefined values in the corresponding JSON schema, when a value is saved other than the default, the field will be empty after saving. The saved value is though present in the advanced mode editor. This happens only, in combination of the lib select2. See also corresponding GIF below.
  2. The dropdown for Configuration Menu and Object Properties are not shown anymore, if a configuration section is saved, which has in its JSON schema definition a property with type array and should have unique items (such as Mwan3) . See also corresponding GIF below.

Steps To Reproduce Steps to reproduce the behavior for the 1. Issue:

  1. Go to the change view of an existing Device.
  2. Select the Configuration tab.
  3. Create a new Configuration for the section General.
  4. In the field timezone, set a value other than the default.
  5. Click Save and continue editing.
  6. Scroll down to the configuration section General. The previous selected and saved value is not shown.

Steps to reproduce the behavior for the 2. Issue:

  1. Go to the change view of an existing Device.
  2. Select the Configuration tab.
  3. Create a new Configuration for the section Mwan3. (I patched this into netjsonconfig from https://github.com/openwisp/netjsonconfig/pull/232 because it has a property in its schema definition with type array and allows only unique items)
  4. Click Save and continue editing.
  5. Scroll down to the configuration section and click Configuration Menu. The menu dropdown will not show up, but all configuration fields will be disabled.

Expected behavior Expected behavior for the 1. Issue: The saved value, should always be displayed.

Expected behavior for the 2. Issue: The dropdown menu of the Configuration Menu and the Object Properties should be always displayed.

Screenshots GIF for showing the 1. Issue: openwisp_controller_config_editor_issue_1

GIF for showing the 2. Issue:
openwisp_controller_config_editor_issue_2

System Information:

kkreitmair commented 3 weeks ago

I will open a PR for the bug fix in the next days.

nemesifier commented 3 weeks ago

Thank you very much for reporting this @okraits @kkreitmair, I didn't notice this yet.