Skip to content
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

added a formatter #165

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 40 additions & 7 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"jest-fetch-mock": "^3.0.3",
"jest-transform-stub": "^2.0.0",
"mermaid": "^8.13.10",
"neatjson": "^0.10.6",
"pattern.css": "^1.0.0",
"prettier": "^2.5.1",
"react": "^17.0.2",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/CaseContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Grid, Box, DropButton, Layer, Button, Text } from "grommet";
import { FormClose, ZoomIn, ZoomOut } from "grommet-icons";
import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
import { v4 as uuidv4 } from "uuid";
import { neatJSON } from "neatjson";

import CasePermissionsManager from "./CasePermissionsManager.js";
import MermaidChart from "./Mermaid";
Expand Down Expand Up @@ -110,7 +111,7 @@ class CaseContainer extends Component {
const name = json_response["name"];
// Remove the `id` fields, since they are only meaningful to the backend, and might
// confuse it when importing the JSON exported here.
json_response = JSON.stringify(json_response);
json_response = neatJSON(json_response);
json_response = json_response.replaceAll(/"id":\d+(,)?/g, "");
// Write to a file, which to the user shows as a download.
const blob = new Blob([json_response], {
Expand Down