From bc3391d39fd987dafb7f8027b4475982bc37a50c Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Wed, 30 Mar 2022 13:13:32 +0200 Subject: Edit data format --- example_data_1.json | 22 ++++++++++----------- example_data_2.json | 22 ++++++++++----------- src/components/ScanDetail.js | 47 +++++++++++++++++--------------------------- 3 files changed, 38 insertions(+), 53 deletions(-) diff --git a/example_data_1.json b/example_data_1.json index 2b819ea..2dbfff0 100644 --- a/example_data_1.json +++ b/example_data_1.json @@ -32,18 +32,16 @@ "vulnerable": true } ], - "user_presentation": { - "description": "A presentation of the observation as a whole (optional)", - "data": { - "subject_cn": { - "data": "unknown", - "display_name": "Subject Common Name", - "description": "A description of this key (optional)" - }, - "end_of_general_support": { - "data": false, - "display_name": "End of general support" - } + "description": "A presentation of the observation as a whole (optional)", + "custom_data": { + "subject_cn": { + "data": "unknown", + "display_name": "Subject Common Name", + "description": "A description of this key (optional)" + }, + "end_of_general_support": { + "data": false, + "display_name": "End of general support" } } } diff --git a/example_data_2.json b/example_data_2.json index 4cc30da..1ef5e1a 100644 --- a/example_data_2.json +++ b/example_data_2.json @@ -32,18 +32,16 @@ "vulnerable": true } ], - "user_presentation": { - "description": "A presentation of the observation as a whole (optional)", - "data": { - "subject_cn": { - "data": "unknown", - "display_name": "Subject Common Name", - "description": "A description of this key (optional)" - }, - "end_of_general_support": { - "data": true, - "display_name": "End of general support" - } + "description": "A presentation of the observation as a whole (optional)", + "custom_data": { + "subject_cn": { + "data": "unknown", + "display_name": "Subject Common Name", + "description": "A description of this key (optional)" + }, + "end_of_general_support": { + "data": true, + "display_name": "End of general support" } } } diff --git a/src/components/ScanDetail.js b/src/components/ScanDetail.js index a5f6d16..dfc6722 100644 --- a/src/components/ScanDetail.js +++ b/src/components/ScanDetail.js @@ -41,17 +41,15 @@ class ScanDetail extends React.Component { - {this.props.user_presentation.description && ( + {this.props.description && ( <>
- - {this.props.user_presentation.description} - + {this.props.description} )}

Custom info

-
+

Latest scan | {this.props.timestamp_in_utc}

@@ -66,35 +64,26 @@ class ScanDetail extends React.Component { } } -function Details(props) { +function Custom(props) { return ( - <> - - - ); -} - -function UserPresentation(props) { - return ( - - {Object.entries(props.data).map( - ([key, { data, display_name, description }]) => ( - - ) - )} +
+ + {Object.entries(props).map( + ([key, { data, display_name, description }]) => ( + + ) + )} +
); } -function UserPresentationElement(props) { +function CustomElement(props) { return ( {props.display_name} -- cgit v1.1