-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix overflowing advanced styling panel in Map Layer Manager #11673
Fix overflowing advanced styling panel in Map Layer Manager #11673
Conversation
@CWDamm-Kint, I've been unable to reproduce this bug in 7.6. Could you narrow down the conditions that cause it? |
@chiatt, I've updated the issue with a clip from 7.6 while pasting in improperly formatted json. Arguably, this is somewhat unlikely as Arches produces properly formatted json for new models by default, and you would likely then just edit what's there. But perhaps worth having the fix as a back up if something similar did recur? |
Thanks @CWDamm-Kint - That's helpful. I'm wondering if this fix, although it certainly makes the data more readable, isn't masking the actual problem. My guess is that if you make a change to the style, like a change of a fill color, that change won't be reflected in the map. I suspect that the data is getting saved as a json-like string rather than json. If that's the case, then the fix that's really needed is ensuring that the data gets converted to true json on save. |
It sounds like there are two issues at play here: the styling causing an overflow, and the incorrect AfHER data; but the overflow issue is caused by the json-like string in the AfHER data. I can trace the json string down to the AfHER models, here: https://github.com/archesproject/arches-her/blob/a8e9144fc622921e02e3e0fb28a48bc711b58851/arches_her/pkg/graphs/resource_models/Application%20Area.json#L8184. I can create this as an issue in AfHER. The line wrapping seems like a small enough addition to fix the visual side of this issue, but the data is truly the culprit. |
@SDScandrettKint - This string will have been generated by the system on exporting the graph. The content of the string passes validation as JSON if you remove the escape characters. This seems to imply that there could be an underlying issue with how this json-like string is loaded from the model file? Or, how the string is loaded into codemirror? |
The AfHER json string must be failing to JSON stringify somewhere then? The AfHER I've also noticed that any string can be added to the advanced styling box, it is not strict on JSON. At first, this was tested by replacing the AfHER model overflow_advanced_styling.mp4EDIT: console logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user modifies the Advanced Styling in the UI, the style is saved as a formatted string:
It's not very pretty, but codemirror can load this and it render it as formatted 'json'. The issue for HER is that the tab and newline characters have all been removed, so codemirror is rendering the data exactly as expected - as a single line.
I tested Advanced Styling with properly formatted json by exporting a graph, cleaning up the data and reloading it. The data loaded as valid json in the database, but codemirror threw an error when I tried to load it in Advanced Styling. I suspect the issue isn't with codemirror, but with how it's being used. Unfortunately a fix for this (so that only valid json is managed) might mean cleaning up data that is not formatted as valid json and most likely means a migration to do it. For the time being @CWDamm-Kint's solution addresses the problem of being unable able to edit Advanced styling in cases such as Arches for HERs.
@chiatt I have raised a new ticket with this issue that you encountered - I'll try reproduce. I think I encountered another issue from looking into this bug - changing advanced styling config doesn't reflect the changes in the UI user-input boxes e.g. changing polygon paint colour. Now this could be due to me changing the wrong value, but it might need to be looked into. |
Types of changes
Description of Change
When the advanced styling config is not properly formatted, the advanced styling panel overflows the screen. There is an option for codemirror to wrap text, which stops this from happening.
Issues Solved
Closes #11649
Checklist
Accessibility Checklist
Developer Guide
Ticket Background
Further comments
NA