appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
33.84k stars 3.65k forks source link

[Feature] JSON Editor Widget #3360

Open Nikhil-Nandagopal opened 3 years ago

Nikhil-Nandagopal commented 3 years ago

Summary

Users need a way to edit & explore JSON objects

Requirement

Title Desc Comment
JSON Data Object which needs to be parsed into the widget; editable or view only; The sample data should be short and be related to fruits -
Mode Editable | Explore Editable mode: The json object will display as code; Explore mode: The json object will show up as a nested tree, And option to append new key value will be given; Both modes will allow editing
Expand Fields Expand all the field in the explore mode -
Save action onSave will trigger the registered event; When the event is set a button to save the json object should show up -
Allow Copy Boolean - false; Should give an option to the end user to copy the object in one click -
Indentation Allow this automatically or with a button click on the widget; Should only be available in the edit mode -

Figma Link

https://www.figma.com/file/w9CaXHF5iYcrLtiEbAHcFu/Widgets-Library?node-id=421%3A11596

Front logo Front conversations

somangshu commented 3 years ago

@nikhil do we need something like this or a linter like this

Nikhil-Nandagopal commented 3 years ago

@somangshu more like the former but we can add linting also to it. Like this is a great example https://jsoneditoronline.org/

wmdev0808 commented 3 years ago

Estimation details:

asmiller commented 3 years ago

Just submitted a PR for a read-only JSON widget - which could be expanded to read/write without too much difficulty

https://github.com/appsmithorg/appsmith/pull/7030

momcilo-appsmith commented 2 years ago

@somangshu I just added the link to Figma

areyabhishek commented 2 years ago

@momcilo-appsmith @somangshu This editor needs more states to be designed. See screenshots below from the JSON editor that haven't been designed.

Is it possible to list every single interaction that is necessary for this JSON editor? There's a lot of scenarios to cover here.

Loom video showing some interactions: LOOM DEMO

Screen Shot 2021-09-27 at 11 39 59 AM Screen Shot 2021-09-27 at 11 42 23 AM Screen Shot 2021-09-27 at 11 42 43 AM Screen Shot 2021-09-27 at 11 42 54 AM Screen Shot 2021-09-27 at 11 43 35 AM
somangshu commented 2 years ago

@momcilo-appsmith the given design is not covering the PRD, simply restyling the current widget is not out goal, We also have additional options like save and copy that need to be an option for the end user (if allowed by the developer)

Apart from the the mode according to me should be an option in the property pane, I dont see why the end user needs this option.

@areyabhishek regarding the above feedback, the functionality you see is all default of the package, Do we really need to alter all that, We could control / hide some options based on the PRD

areyabhishek commented 2 years ago

@somangshu The UI looks inconsistent with what we have today. Can we simplify the current editor to only include the essential features? We can then only style the essential features the right way.

I'm worried about this widget's styling because it looks so bad and totally out of place in Appsmith.

somangshu commented 2 years ago

@areyabhishek we can work on changing the basic UI of the widget to make it consistent, The functionality offered by the package is useful and lets us offer more to the user when it comes to JSON Widget, In case we do not want the functionality we will use a very basic package which can just display JSON is an indented manner.

My conclusion here would be that:

areyabhishek commented 2 years ago

Please ensure UI consistency. That's my main point. It shouldn't look out of place in an Appsmith app. Once you decide the core features, we can style the app to work like that

somangshu commented 2 years ago

@wmdev0808 we need to check what kind of options are provided by the package to customise the UI, Check out the design for a basic idea

wmdev0808 commented 2 years ago

OK, let me check

riodeuno commented 2 years ago
nidhi-nair commented 2 years ago

@somangshu A user was requesting an enhancement on this widget. Not sure if it had been implemented, is in scope for v1, or even whether we want to be supporting the feature at all. :)

is it possible to have a preview of images when there is links in the JSON?

Nikhil-Nandagopal commented 2 years ago

@nidhi-nair could you ask the user to share context of a place where they have seen something like this anywhere on the web? It doesn't seem like it should be a part of this widget

nidhi-nair commented 2 years ago

Here's what the user has shared on Discord:

thay's how I am doing it on vscode but I wanted to do it in appsmith interface instead ^^', so a preview of the picture when it's a link

appsmith_widget_tree

dilippitchika commented 2 years ago

Adding notes from re-opening the PR and testing it out

Checked this, i think the widget wasn't fully built out UX and DX wise, but keeping that aside there are some challenges from theming perspective -

image

somangshu commented 2 years ago

@dilippitchika do we plan to pick this up?

Nikhil-Nandagopal commented 8 months ago

We recently added a custom widget where you can create a custom JSON widget. Check out the post below where you can fork and try out the widget https://community.appsmith.com/template/json-editorviewer