Skip to content

Commit

Permalink
feat: Style KubeHunterReport details pane (#67)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak authored Oct 17, 2021
1 parent 31a5bac commit b78d556
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
32 changes: 31 additions & 1 deletion src/kubehunterreports/details.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.KubeHunterReportDetails {
.summary {
.VulnerabilitySummary {
.Badge {
&.theme-high {
color: white;
Expand All @@ -21,4 +21,34 @@

}
}

.VulnerabilityList {

.TableCell {
&.vulnerabilityID {
flex-grow: 0.4;
}

&.severity {
flex-grow: 0.2;
}

&.high {
color: #cc1814;
}

&.medium {
color: #ffa500;
}

&.low {
color: #515456;
}

&.category {
flex-grow: 0.3;
}
}
}

}
26 changes: 7 additions & 19 deletions src/kubehunterreports/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "./details.scss"
import {Renderer} from "@k8slens/extensions";
import React from "react";
import {KubeHunterReport, Vulnerability} from "./types";
import styled from "@emotion/styled";

const {
Component: {
Expand All @@ -18,16 +17,6 @@ const {
} = Renderer;


const Wrapper = styled.div`
.Table.virtual {
height: 500px;
.VirtualList {
height: 100%;
}
}
`

export interface KubeHunterReportDetailsProps extends Renderer.Component.KubeObjectDetailsProps<KubeHunterReport> {
showObjectMeta?: boolean
}
Expand All @@ -46,7 +35,7 @@ export class KubeHunterReportDetails extends React.Component<KubeHunterReportDet
<TableCell className="vulnerabilityID">
<a target="_blank" href={vulnerability.avd_reference}>{vulnID}</a>
</TableCell>
<TableCell className="severity">{vulnerability.severity}</TableCell>
<TableCell className={"severity " + vulnerability.severity}>{vulnerability.severity}</TableCell>
<TableCell className="description">
<Badge flat expandable={false} key="description" label={vulnerability.description}
tooltip={vulnerability.description}/>
Expand All @@ -68,7 +57,7 @@ export class KubeHunterReportDetails extends React.Component<KubeHunterReportDet
{this.props.showObjectMeta &&
<KubeObjectMeta object={report} hideFields={["uid", "resourceVersion", "selfLink"]}/>}

<DrawerItem name="Summary" className="summary" labelsOnly>
<DrawerItem className="VulnerabilitySummary" name="Summary" labelsOnly>
<Badge className="Badge theme-high"
label={report.report.summary.highCount}
tooltip="High"/>
Expand All @@ -85,24 +74,23 @@ export class KubeHunterReportDetails extends React.Component<KubeHunterReportDet

<DrawerTitle title={"Vulnerabilities"}/>

<Wrapper>
<Table selectable scrollable={false}
<div className="VulnerabilityList flex column">
<Table className="box grow" selectable scrollable={false}
tableId="kubeHunterVulnerabilitiesTable"
virtual={virtual}
items={vulnerabilities}
getTableRow={this.getTableRow}>
<TableHead>
<TableCell className="vulnerabilityID">ID</TableCell>
<TableCell className="severity">Severity</TableCell>
<TableCell
className="description">Description</TableCell>
<TableCell className="description">Description</TableCell>
<TableCell className="category">Category</TableCell>
</TableHead>
{
!virtual && vulnerabilities.map((vulnerability) => this.getTableRow(vulnerability.getId()))
!virtual && vulnerabilities.map((vulnerability: Vulnerability) => this.getTableRow(vulnerability.getId()))
}
</Table>
</Wrapper>
</div>

</div>
)
Expand Down

0 comments on commit b78d556

Please sign in to comment.