opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.22k stars 718 forks source link

dashboard: Implement button to turn off automatic resize of widgets #7628

Open Monviech opened 1 month ago

Monviech commented 1 month ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Most of the new widgets hard-code maximum widget sizes, or limit the way they can be resized: https://github.com/opnsense/core/blob/7c6e95889798d501dc6042df2afeb1a1369b98e8/src/opnsense/www/js/widgets/IpsecTunnels.js#L32 https://github.com/opnsense/core/blob/7c6e95889798d501dc6042df2afeb1a1369b98e8/src/opnsense/www/js/widgets/IpsecTunnels.js#L39

Describe the solution you like

A button that globally disables this for all widgets, allowing users to resize them however they please. This should also persist, so the state of the button would need to be saved.

Describe alternatives you considered

Leaving it as it is because it was implemented for reasons that I do not know.

swhite2 commented 1 month ago

The philosophy here is that widgets are sized according to their content, if the content is responsive, a resize will trigger the content to resize. Any leftover whitespace after a resize is cut off. There is no hardcoded maximum size.

The sizeToContent was intended to prevent very long, difficult to handle widgets in cases where the recordset was potentially very large (imagine 200 ipsec tunnels). The unintended side-effect of this is that widgets could be resized indefinetly on the y-axis, which the resizeHandles setting prevents, but allows configurability per widget.

I guess the question here is whether we can make the sizeToContent part optional? would the content be static in this case with scrollbars in both x, and y-directions?

swhite2 commented 1 month ago

@Monviech https://github.com/opnsense/core/commit/4bd6ad3cdec0ad2eb2dc4896c85bd9844f9e4f8e should make this better without introducing a new toggle for it.