diff options
author | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 13:13:32 +0200 |
---|---|---|
committer | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 13:13:32 +0200 |
commit | bc3391d39fd987dafb7f8027b4475982bc37a50c (patch) | |
tree | 0659c7729210f02236ac3d6b605c9b79f5e25279 | |
parent | c21b3cc14a655f2709b26d77036dfeb81f6c6ff1 (diff) |
Edit data format
-rw-r--r-- | example_data_1.json | 22 | ||||
-rw-r--r-- | example_data_2.json | 22 | ||||
-rw-r--r-- | 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 { </tbody> </table> - {this.props.user_presentation.description && ( + {this.props.description && ( <> <br /> - <Alert severity="info"> - {this.props.user_presentation.description} - </Alert> + <Alert severity="info">{this.props.description}</Alert> </> )} <h2>Custom info</h2> - <Details {...this.props} /> + <Custom {...this.props.custom_data} /> <h2>Latest scan | {this.props.timestamp_in_utc}</h2> <div id="cves"> @@ -66,35 +64,26 @@ class ScanDetail extends React.Component { } } -function Details(props) { +function Custom(props) { return ( - <> - <UserPresentation - description={props.user_presentation.description} - data={props.user_presentation.data} - /> - </> - ); -} - -function UserPresentation(props) { - return ( - <table className="user-presentation"> - {Object.entries(props.data).map( - ([key, { data, display_name, description }]) => ( - <UserPresentationElement - key={key} - data={data} - display_name={display_name} - description={description} - /> - ) - )} + <table> + <tbody> + {Object.entries(props).map( + ([key, { data, display_name, description }]) => ( + <CustomElement + key={key} + data={data} + display_name={display_name} + description={description} + /> + ) + )} + </tbody> </table> ); } -function UserPresentationElement(props) { +function CustomElement(props) { return ( <tr> <td>{props.display_name}</td> |