Implement a JSON Review UI that allow user to perform actions on json files

Review Request #9515 — Created Jan. 21, 2018 and updated — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

Json files is handled as an uneditble attachments in the current
version.
I implemented a new class JSONReviewUI that
enhence Review board's ability to process JSON file.

New features include:

  • Rendering JSON in an easy-to-read format.
  • Allowing the user to comment on the prettified file based on
    line numbers.
  • Auto-sorting of output keys.
  • Allow user to compare the changes of files in diffs
  • A thumbnail that render in the easy-to-read format, too.

Ran unit tests.

Tested the development environment with:

  • Properly formatted JSON files.
  • JSON files with long lines.
  • Minified JSON files.
  • Highly-nested JSON files.
{ 	"name":"John", 
	"age":31,
	"items":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],
	"city":"New York" }
{ 	"name":"John", 
	"age":31,
	"items":[100,100,100,100,100,100,100,
	"city":"New York" }
{ 	"name":"John", "age":31, "items":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"city":"New York" }
{ 	"name":"John", "age":31, "items":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"city":"New York" }
{ 	"name":"John", 
	"age":31,
	"items":[
			{"name":"bag","weight":7.5},{"name":"Laptop","weight":8}
			],
	"city":"New York" }

reviewboard/attachments/mimetypes.py
reviewboard/attachments/tests.py
reviewboard/reviews/ui/__init__.py
reviewboard/reviews/ui/jsonui.py
reviewboard/reviews/ui/markdownui.py
reviewboard/reviews/ui/tests.py
reviewboard/reviews/ui/testJsonData/OneLine.json
reviewboard/reviews/ui/testJsonData/OneLineCorrect.json
reviewboard/reviews/ui/testJsonData/nested.json
reviewboard/reviews/ui/testJsonData/wrongFormatted.json
Loading...