Added table for pillar grades

This commit is contained in:
Shay Nehmad 2019-08-08 12:08:24 +03:00
parent 683e945506
commit a337bb5800
2 changed files with 37 additions and 13 deletions

View File

@ -35,7 +35,7 @@ class ZeroTrustReportPageComponent extends AuthComponent {
generateReportContent() { generateReportContent() {
let content; let content;
if (typeof this.state.findings === "undefined") { if (this.stillLoadingDataFromServer()) {
content = "Still empty"; content = "Still empty";
} else { } else {
content = <div> content = <div>
@ -76,6 +76,10 @@ class ZeroTrustReportPageComponent extends AuthComponent {
) )
} }
stillLoadingDataFromServer() {
return typeof this.state.findings === "undefined" || typeof this.state.pillars === "undefined" || typeof this.state.tests === "undefined";
}
print() { print() {
alert("unimplemented"); alert("unimplemented");
} }

View File

@ -1,18 +1,38 @@
import React, {Component} from "react"; import React, {Component} from "react";
import ZeroTrustPillars from "./ZeroTrustPillars"; import ReactTable from "react-table";
export class PillarGrades extends Component { const columns = [
{
Header: 'Pillar Grading',
columns: [
{ Header: 'Pillar', accessor: 'Pillar'},
{ Header: 'Conclusive', accessor: 'Conclusive'},
{ Header: 'Inconclusive', accessor: 'Inconclusive'},
{ Header: 'Unexecuted', accessor: 'Unexecuted'},
]
}
];
const pageSize = 10;
class PillarGrades extends Component {
render() { render() {
return ( if (this.props.pillars.length > 0) {
<div id="pillar-grades"> let defaultPageSize = this.props.pillars.length > pageSize ? pageSize : this.props.pillars.length;
<p> let showPagination = this.props.pillars.length > pageSize;
TODO: table with conditional colouring.
</p> return (
<pre> <div>
{JSON.stringify(this.props.pillars, undefined, 2)} <ReactTable
</pre> columns={columns}
</div> data={this.props.pillars}
) showPagination={showPagination}
defaultPageSize={defaultPageSize}
/>
</div>
);
}
else { return (<div><pre>BAYAZ</pre></div>);}
} }
} }