rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
463 stars 261 forks source link

Find a better YAML parser #10666

Open gaktive opened 8 months ago

gaktive commented 8 months ago

Internal reference: SURE-7838

We've had a long history of toggling between the standard fields and the raw YAML view whereby the charts.yaml file is modified:

Comments are removed
It is reformatted
Parameters are reordered

We need to find a better means to parse YAML so that it's less prone to being modified if the user makes their own changes.

Per @nwmac:

T he main problem here is that the UI allows the user to edit in a Form and then switch to the Yaml view to edit - they can then go back to the form and see the changes.

Having a YAML structure sent to the UI won't really help as we'll have to format that to text for the text editor - if the user switches back to the form, we'll need to parse it so the changes are reflected in the form editor and if the user was to switch back to editing the raw yaml, we'd need to apply the changes form the form to the YAML again.

Thus, the best approach would be to send us the raw YAML and in the UI we would need a better YAML parser that preserves the structure and allows us to manipulate it as an object as well, so we can update values. We would need to investigate this first - so I would hold off doing any work until we have done that. The UI treats the values field that comes back from the API as JSON, so I would not change that. I would add another field that contains the raw YAML, if this turns out to be viable form the UI side.

richard-cox commented 7 months ago

To resolve SURE-7838 we need to ensure that when creating a helm app we present values YAML without losing comments, formatting or order from that provided by the chart. This also applies when the page contains a form alongside rehand yaml.

nwmac commented 3 months ago

We should consider https://eemeli.org/yaml/#documents