-
Notifications
You must be signed in to change notification settings - Fork 351
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
Export query result records as JSON #957
Conversation
} from 'browser/modules/Stream/CypherFrame/helpers' | ||
import { csvFormat } from 'services/bolt/cypherTypesFormatting' | ||
import arrayHasItems from 'shared/utils/array-has-items' | ||
|
||
const JSON_EXPORT_INDENT = 2 |
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.
@oskarhane any suggestions for where to put this?
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.
No need to extract this at all imo.
line-height: 30px; | ||
padding: 5px 0 5px 0; | ||
padding: 5px 10px; |
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.
Had to do this to fix dropdown
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.
moved this to DropdownItem to fix appearance
case neo4j.types.LocalTime: | ||
case neo4j.types.Time: | ||
case neo4j.types.Point: | ||
case neo4j.types.Integer: // not exposed in typings but still there |
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 be that I should call toInt()
for Integers?
- CSS fix - Export int as Number - Export Point as GeoJSON - Reorder and cleanup
ab3c3d7
to
8280de0
Compare
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.
LGTM, but I'd like maybe @jexp to have a look at the output to see if that's useful for prospects.
} from 'browser/modules/Stream/CypherFrame/helpers' | ||
import { csvFormat } from 'services/bolt/cypherTypesFormatting' | ||
import arrayHasItems from 'shared/utils/array-has-items' | ||
|
||
const JSON_EXPORT_INDENT = 2 |
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.
No need to extract this at all imo.
@@ -726,4 +727,510 @@ describe('helpers', () => { | |||
]) | |||
}) | |||
}) | |||
|
|||
describe('recordToJSONMapper', () => { |
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.
Well done on the tests 🎉
} | ||
|
||
// could be a Node or Relationship | ||
const type = lowerCase(get(values, 'constructor.name', '')) |
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.
From discussion: call this elementType
const type = lowerCase(get(values, 'constructor.name', '')) | ||
|
||
if (includes(['relationship', 'node'], type)) { | ||
const labels = |
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.
From discussion: Call this type
for relationships and keep labels
for nodes.
@oskarhane updated the PR as per your comments |
This PR enables users to export result records as JSON, trying to mimic APOC output as much as possible.
STR
MATCH p = (:Person)-[r]-(:Movie) RETURN p
Screenshots
Sample output
See unit tests