diff options
| author | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 12:53:34 +0200 |
|---|---|---|
| committer | Ernst Widerberg <ernst@sunet.se> | 2022-03-30 12:54:32 +0200 |
| commit | dcd03d8a3f94505c53e667a4b967a29b698c5728 (patch) | |
| tree | 399c39a193666d72e2fb9dcf0370ced04b1f96b0 /src/components/ObjectComponent.js | |
| parent | cb77e7928297c39222a813b0de6f3b2768c24c61 (diff) | |
Merge redesign (refs/archive/redesign-2022-03-30)
Diffstat (limited to 'src/components/ObjectComponent.js')
| -rw-r--r-- | src/components/ObjectComponent.js | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/src/components/ObjectComponent.js b/src/components/ObjectComponent.js deleted file mode 100644 index 2ae0b6e..0000000 --- a/src/components/ObjectComponent.js +++ /dev/null @@ -1,135 +0,0 @@ -import React from "react"; - -import Accordion from "@mui/material/Accordion"; -import AccordionDetails from "@mui/material/AccordionDetails"; -import AccordionSummary from "@mui/material/AccordionSummary"; -import Alert from "@mui/material/Alert"; -import Card from "@mui/material/Card"; -import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; - -class ObjectComponent extends React.Component { - render() { - return ( - <Card className="object" variant="outlined"> - <div className="id"> - <a href={`/${this.props._id}`}>#{this.props._id}</a> - </div> - <table> - <tbody> - <tr> - <td>Domain</td> - <td>{this.props.domain}</td> - </tr> - <tr> - <td>Endpoint</td> - <td>{`${this.props.ip}:${this.props.port}`}</td> - </tr> - <tr> - <td>Hostname</td> - <td>{this.props.ptr}</td> - </tr> - <tr> - <td>Owner</td> - <td>{this.props.whois_description}</td> - </tr> - <tr> - <td>ASN</td> - <td>{`${this.props.asn} (${this.props.asn_country_code})`}</td> - </tr> - <tr> - <td>Abuse mail</td> - <td>{this.props.abuse_mail}</td> - </tr> - <tr> - <td>Scan finished at</td> - <td>{this.props.timestamp_in_utc}</td> - </tr> - </tbody> - </table> - <Details {...this.props} /> - </Card> - ); - } -} - -function Details(props) { - let content = ( - <> - {props.user_presentation.description && ( - <Alert severity="info" sx={{ marginTop: "1em" }}> - {props.user_presentation.description} - </Alert> - )} - <UserPresentation - description={props.user_presentation.description} - data={props.user_presentation.data} - /> - </> - ); - if (props.summary) { - return ( - <div> - <Accordion elevation={0} disableGutters={true}> - <AccordionSummary - expandIcon={<ExpandMoreIcon fontSize="small" />} - ></AccordionSummary> - <AccordionDetails>{content}</AccordionDetails> - </Accordion> - </div> - ); - } - return content; -} - -function UserPresentation(props) { - return ( - <div className="user-presentation" style={{ marginTop: "2em" }}> - {Object.entries(props.data).map( - ([key, { data, display_name, description }]) => ( - <UserPresentationElement - key={key} - data={data} - display_name={display_name} - description={description} - /> - ) - )} - </div> - ); -} - -function UserPresentationElement(props) { - return ( - <Card - className="user-presentation-element" - variant="outlined" - sx={{ padding: "1em", marginTop: "1em" }} - > - <b>{props.display_name}</b>: {props.data.toString()} - {props.description && ( - <Alert severity="info" sx={{ marginTop: "0.5em" }}> - {props.description} - </Alert> - )} - </Card> - ); -} - -function GenericTable(props) { - return ( - <table> - <tbody> - {Object.entries(props.data).map(([key, value]) => { - return ( - <tr key={key}> - <td>{key}</td> - <td>{value}</td> - </tr> - ); - })} - </tbody> - </table> - ); -} - -export default ObjectComponent; |
