From 9172ee315a6866df6238efc2d30f13b0d4733461 Mon Sep 17 00:00:00 2001 From: JeremiahUy Date: Wed, 11 Oct 2023 13:30:05 +0200 Subject: [PATCH 1/3] UPDATE: package for json view --- apps/frontend/package.json | 2 +- .../admin/audit/AuditRecentTable.tsx | 4 +-- .../src/components/admin/audit/AuditView.tsx | 25 ++++++++----------- apps/frontend/src/main.css | 3 ++- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 254028531..fb6f09bff 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -10,7 +10,6 @@ "@fortawesome/free-regular-svg-icons": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/react-fontawesome": "^0.2.0", - "@microlink/react-json-view": "^1.22.2", "@navikt/aksel-icons": "^5.6.0", "@navikt/ds-css": "^5.6.0", "@navikt/ds-react": "^5.6.0", @@ -41,6 +40,7 @@ "react-markdown-editor-lite": "^1.3.4", "react-player": "^2.13.0", "react-process-string": "^1.2.0", + "react18-json-view": "^0.2.6", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.0", "styletron-engine-atomic": "^1.5.0", diff --git a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx index 46dac1d75..5d5f5e30f 100644 --- a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx +++ b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx @@ -19,7 +19,7 @@ import {getAudits} from '../../../api/AuditApi' import {Cell, Row, Table} from '../../common/Table' import * as _ from 'lodash' import {theme} from '../../../util' -import ReactJson from '@microlink/react-json-view' +import JsonView from 'react18-json-view' import {ObjectLink} from '../../common/RouteLink' import {CustomizedStatefulSelect} from '../../common/CustomizedSelect' import {buttonContentStyle} from '../../common/Button' @@ -137,7 +137,7 @@ export const AuditRecentTable = (props: { show: boolean; tableType?: ObjectType accessibilityType="tooltip" overrides={{ Body: { style: { width: '80%' } } }} placement={PLACEMENT.leftBottom} - content={} + content={} > {newestAudit?.action !== AuditAction.DELETE && ( intl.view} placement={PLACEMENT.top}> @@ -132,12 +127,14 @@ export const AuditView = (props: AuditViewProps) => { - p.name === null && !open[index]} - onSelect={(sel) => { - ; (sel.name === 'id' || sel.name?.endsWith('Id')) && viewId(sel.value as string) + collapsed={() => { + if(openAll) { + return false + } else { + return index === 0 ? false : true + } }} /> diff --git a/apps/frontend/src/main.css b/apps/frontend/src/main.css index 687f87ad0..4e2bd8003 100644 --- a/apps/frontend/src/main.css +++ b/apps/frontend/src/main.css @@ -1,4 +1,5 @@ @import "tailwindcss/base"; @import "@navikt/ds-css"; @import "tailwindcss/components"; -@import "tailwindcss/utilities"; \ No newline at end of file +@import "tailwindcss/utilities"; +@import "react18-json-view/src/style.css"; \ No newline at end of file From 9620e328834b79c3ae7bd9f77837ade229f4668a Mon Sep 17 00:00:00 2001 From: Lord Andre Groseth Date: Thu, 12 Oct 2023 10:44:11 +0200 Subject: [PATCH 2/3] CHANGE: react18-json-view TO react-json-view-lite Co-authored-by: Jeremiah Uy Co-authored-by: PaulMartinKokseter > Co-authored-by: Shayan --- apps/frontend/package.json | 2 +- .../src/components/admin/audit/AuditRecentTable.tsx | 4 ++-- apps/frontend/src/components/admin/audit/AuditView.tsx | 10 +++++----- apps/frontend/src/main.css | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/frontend/package.json b/apps/frontend/package.json index fb6f09bff..9c94f609e 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -36,11 +36,11 @@ "react-diff-viewer-continued": "^3.2.6", "react-dom": "^18.2.0", "react-draft-wysiwyg": "^1.15.0", + "react-json-view-lite": "^1.1.0", "react-markdown": "^9.0.0", "react-markdown-editor-lite": "^1.3.4", "react-player": "^2.13.0", "react-process-string": "^1.2.0", - "react18-json-view": "^0.2.6", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.0", "styletron-engine-atomic": "^1.5.0", diff --git a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx index 5d5f5e30f..13ed63313 100644 --- a/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx +++ b/apps/frontend/src/components/admin/audit/AuditRecentTable.tsx @@ -19,7 +19,7 @@ import {getAudits} from '../../../api/AuditApi' import {Cell, Row, Table} from '../../common/Table' import * as _ from 'lodash' import {theme} from '../../../util' -import JsonView from 'react18-json-view' +import { JsonView} from 'react-json-view-lite' import {ObjectLink} from '../../common/RouteLink' import {CustomizedStatefulSelect} from '../../common/CustomizedSelect' import {buttonContentStyle} from '../../common/Button' @@ -137,7 +137,7 @@ export const AuditRecentTable = (props: { show: boolean; tableType?: ObjectType accessibilityType="tooltip" overrides={{ Body: { style: { width: '80%' } } }} placement={PLACEMENT.leftBottom} - content={} + content={} >