Skip to content

Commit

Permalink
fix: show all CIS benchmark sections (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Pacak <pacak.daniel@gmail.com>
  • Loading branch information
danielpacak committed Feb 25, 2022
1 parent 4a3974c commit 6873432
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 34 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aquasecurity/starboard-lens-extension",
"publisher": "aquasecurity.github.io",
"version": "0.6.0",
"version": "0.7.0",
"description": "Lens extension for viewing Starboard security information",
"homepage": "https://github.com/aquasecurity/starboard-lens-extension",
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions src/ciskubebenchreports/cisresults-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@

.TableCell {
&.number {
text-align: right;
text-align: left;
flex-grow: 0.1;
}

&.status {
flex-grow: 0.2;
text-align: right;
flex-grow: 0.1;
}

.Badge {
Expand Down
5 changes: 1 addition & 4 deletions src/ciskubebenchreports/cisresults-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ const {
Table,
TableRow,
TableCell,
DrawerTitle,
Badge,
}
} = Renderer;

interface Props {
title: string;
results: CISResult[];
}

Expand All @@ -40,11 +38,10 @@ export class CISResultsList extends React.Component<Props> {
}

render() {
const {results, title} = this.props
const {results} = this.props

return (
<div className="CISResultsList flex column">
<DrawerTitle title={title}/>
<Table selectable scrollable={false} className="CISResultsTable box grow">
{
results.map((result, index) => this.getTableRow(index))
Expand Down
26 changes: 18 additions & 8 deletions src/ciskubebenchreports/cissections-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import React from "react";
import {CISResultsList} from "./cisresults-list";
import {CISSection} from "./types";
import {Renderer} from "@k8slens/extensions";

const {
Component: {
DrawerTitle,
}
} = Renderer;

interface Props {
sections: CISSection[];
Expand All @@ -11,13 +18,16 @@ export class CISSectionsList extends React.Component<Props> {
render() {
const {sections} = this.props

return (
<div>
{
sections.map((section, index) =>
<CISResultsList title={section.id + " " + section.text} results={section.tests[0].results}/>)
}
</div>
)
let rows = []

for (let section of sections) {
rows.push(<DrawerTitle title={section.id + " " + section.text}/>)
for (let test of section.tests) {
rows.push(<DrawerTitle title={test.section + " " + test.desc}/>)
rows.push(<CISResultsList results={test.results}/>)
}
}

return <div>{rows}</div>
}
}
26 changes: 15 additions & 11 deletions src/ciskubebenchreports/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import React from "react";
import {CISSectionsList} from "./cissections-list";
import {CISKubeBenchReport} from "./types";

const {
Component: {
KubeObjectMeta,
DrawerItem,
Badge,
}
} = Renderer;

export interface CISKubeBenchReportDetailsProps extends Renderer.Component.KubeObjectDetailsProps<CISKubeBenchReport> {
showObjectMeta?: boolean
}
Expand All @@ -16,28 +24,24 @@ export class CISKubeBenchReportDetails extends React.Component<CISKubeBenchRepor
return (
<div className="CISKubeBenchReportDetails">
{this.props.showObjectMeta &&
<Renderer.Component.KubeObjectMeta
<KubeObjectMeta
object={report}
hideFields={["uid", "resourceVersion", "selfLink"]}/>}

<Renderer.Component.DrawerItem name="Summary" className="summary" labelsOnly>
<Renderer.Component.Badge
className="Badge theme-fail"
<DrawerItem name="Summary" className="summary" labelsOnly>
<Badge className="Badge theme-fail"
label={report.report.summary.failCount}
tooltip="Fail"/>
<Renderer.Component.Badge
className="Badge theme-warn"
<Badge className="Badge theme-warn"
label={report.report.summary.warnCount}
tooltip="Warn"/>
<Renderer.Component.Badge
className="Badge theme-info"
<Badge className="Badge theme-info"
label={report.report.summary.infoCount}
tooltip="Info"/>
<Renderer.Component.Badge
className="Badge theme-pass"
<Badge className="Badge theme-pass"
label={report.report.summary.passCount}
tooltip="Pass"/>
</Renderer.Component.DrawerItem>
</DrawerItem>

<CISSectionsList sections={report.report.sections}/>

Expand Down
1 change: 1 addition & 0 deletions src/configauditreports/checks-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class ChecksList extends React.Component<Props> {
return (
<div className="ChecksList">
<Table tableId="configurationChecksTable"
selectable
virtual={virtual}
items={sorted}
getTableRow={this.getTableRow}
Expand Down
11 changes: 5 additions & 6 deletions src/vulnerabilityreports/list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "./list.scss"
import React from "react"
import styled from "@emotion/styled"
import {Renderer} from "@k8slens/extensions"
import {Vulnerability} from "./types";

Expand Down Expand Up @@ -77,11 +76,11 @@ export class VulnerabilitiesList extends React.Component<Props> {

return (
<div className="VulnerabilitiesList">
<Table
tableId="vulnerabilitiesTable"
virtual={virtual}
items={sorted}
getTableRow={this.getTableRow}
<Table tableId="vulnerabilitiesTable"
selectable
virtual={virtual}
items={sorted}
getTableRow={this.getTableRow}
>
<TableHead>
<TableCell className="vulnerabilityID">ID</TableCell>
Expand Down

0 comments on commit 6873432

Please sign in to comment.