Open timkrins opened 3 years ago
I am also happy to write this feature when I get some spare time. I would add an option in the 'Data grid' area in Settings.
Thanks for that idea, I like it
There should be limit of JSON length to be displayed, otherwise it could be very slow. The most expensive operation is displaying text in grid. You are right, stringification is happening when setting title, so this should be no performance problem compared to current implementation.
If you would like to contribute making this change, it will be great.
Implementation of this could be done in DataGridCell.svelte file https://github.com/dbgate/dbgate/blob/master/packages/web/src/datagrid/DataGridCell.svelte . For reading settings, use getBoolSettingsValue function.
Settings are defined in SettingsModal.svelte https://github.com/dbgate/dbgate/blob/master/packages/web/src/settings/SettingsModal.svelte .
I believe, that these two files are the only places to be modified.
I would also be very much in favor of this, for both json and array. For array, it would ideally be displayed in such a form that it can be edited and saved back to the database. But is this then database dependent? For Postgres, either {foo, ba''r, "b{a}z", "b,u,z"}
or array['foo', 'ba''r', 'b{a}z', 'b,u,z']
. The current form ["a","b"]
throws a "malformed array literal" error.
Is your feature request related to a problem? Please describe. It is difficult to visually find records with specific values in a JSON column, as they just say
(JSON)
even if the JSON object is very small or empty.Describe the solution you'd like A setting which allows JSON columns to be stringified rather than say
(JSON)
. A setting is probably also desirable for other 'hidden' datatypes like arrays.Describe alternatives you've considered Hovering over for the tooltip or using the cell view is not really an alternative if you have more than a few records to look through.
Additional context Performance wise, the stringification of all the JSON objects is already happening, so I don't see it would make much difference to actually show the stringified text.