-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Pretty JSON formatter #2863
Pretty JSON formatter #2863
Conversation
src/webui/src/static/json_util.ts
Outdated
const fields = nonNull.map(obj => obj[key]).filter(v => v !== undefined); | ||
let elements; | ||
if (detectBatch(fields)) { // look like same field of class instances | ||
elements = batchFormat(fields, indent + ' ', width, key); |
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.
Can we expose the interface of indent width?
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.
As long as it's not configurable in web UI, I think we can make life easier.
I thought it is to call |
@Lijiaoa please help review |
@@ -3671,7 +3671,7 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: | |||
dependencies: | |||
ms "^2.1.1" | |||
|
|||
debuglog@*, debuglog@^1.0.1: |
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.
could you remove yarn.lock changes? Because PR #2866 had same changes.
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.
yarn.lock
is automatically modified on build.
I wonder why it's not committed by the PR which changes package.json
...
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.
PR #2880 had modifiy the rule |
This util formats JSON basing on expected width.
Take following object as example:
When the width is 60, it will be formatted as:
When the width is 40, it will be:
The
_value
arrays will always get collapsed or expanded together, since the util thinks they are "similar".