forked from p15670423/monkey
Extracted MustRunMonkeyWarning and ReportLoader to seperate compoments
and other small various fixes
This commit is contained in:
parent
dd48a2e40d
commit
0325521936
|
@ -1,4 +1,4 @@
|
||||||
import React from 'react';
|
import React, {Component} from 'react';
|
||||||
import {Button, Col} from 'react-bootstrap';
|
import {Button, Col} from 'react-bootstrap';
|
||||||
import BreachedServers from 'components/report-components/security/BreachedServers';
|
import BreachedServers from 'components/report-components/security/BreachedServers';
|
||||||
import ScannedServers from 'components/report-components/security/ScannedServers';
|
import ScannedServers from 'components/report-components/security/ScannedServers';
|
||||||
|
@ -14,10 +14,13 @@ import StrongUsers from "components/report-components/security/StrongUsers";
|
||||||
import AttackReport from "components/report-components/security/AttackReport";
|
import AttackReport from "components/report-components/security/AttackReport";
|
||||||
import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader";
|
import ReportHeader, {ReportTypes} from "../report-components/common/ReportHeader";
|
||||||
import {MonkeysStillAliveWarning} from "../report-components/common/MonkeysStillAliveWarning";
|
import {MonkeysStillAliveWarning} from "../report-components/common/MonkeysStillAliveWarning";
|
||||||
|
import ReportLoader from "../report-components/common/ReportLoader";
|
||||||
|
import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning";
|
||||||
|
|
||||||
let guardicoreLogoImage = require('../../images/guardicore-logo.png');
|
let guardicoreLogoImage = require('../../images/guardicore-logo.png');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ReportPageComponent extends AuthComponent {
|
class ReportPageComponent extends AuthComponent {
|
||||||
|
|
||||||
Issue =
|
Issue =
|
||||||
|
@ -70,13 +73,10 @@ class ReportPageComponent extends AuthComponent {
|
||||||
let content;
|
let content;
|
||||||
if (Object.keys(this.state.report).length === 0) {
|
if (Object.keys(this.state.report).length === 0) {
|
||||||
if (this.state.runStarted) {
|
if (this.state.runStarted) {
|
||||||
content = (<h1>Generating Report...</h1>);
|
content = (<ReportLoader loading={true}/>);
|
||||||
} else {
|
} else {
|
||||||
content =
|
content =
|
||||||
<p className="alert alert-warning">
|
<MustRunMonkeyWarning/>;
|
||||||
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
|
|
||||||
You have to run a monkey before generating a report!
|
|
||||||
</p>;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
content = this.generateReportContent();
|
content = this.generateReportContent();
|
||||||
|
|
|
@ -6,6 +6,8 @@ import PillarGrades from "../report-components/zerotrust/PillarGrades";
|
||||||
import FindingsTable from "../report-components/zerotrust/FindingsTable";
|
import FindingsTable from "../report-components/zerotrust/FindingsTable";
|
||||||
import {SinglePillarDirectivesStatus} from "../report-components/zerotrust/SinglePillarDirectivesStatus";
|
import {SinglePillarDirectivesStatus} from "../report-components/zerotrust/SinglePillarDirectivesStatus";
|
||||||
import {MonkeysStillAliveWarning} from "../report-components/common/MonkeysStillAliveWarning";
|
import {MonkeysStillAliveWarning} from "../report-components/common/MonkeysStillAliveWarning";
|
||||||
|
import ReportLoader from "../report-components/common/ReportLoader";
|
||||||
|
import MustRunMonkeyWarning from "../report-components/common/MustRunMonkeyWarning";
|
||||||
|
|
||||||
class ZeroTrustReportPageComponent extends AuthComponent {
|
class ZeroTrustReportPageComponent extends AuthComponent {
|
||||||
|
|
||||||
|
@ -36,8 +38,11 @@ class ZeroTrustReportPageComponent extends AuthComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let content;
|
let content;
|
||||||
|
if (this.state.runStarted) {
|
||||||
content = this.generateReportContent();
|
content = this.generateReportContent();
|
||||||
|
} else {
|
||||||
|
content = <MustRunMonkeyWarning/>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Col xs={12} lg={10}>
|
<Col xs={12} lg={10}>
|
||||||
|
@ -53,7 +58,7 @@ class ZeroTrustReportPageComponent extends AuthComponent {
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
if (this.stillLoadingDataFromServer()) {
|
if (this.stillLoadingDataFromServer()) {
|
||||||
content = "Still empty";
|
content = <ReportLoader loading={true}/>;
|
||||||
} else {
|
} else {
|
||||||
const pillarsSection = <div id="pillars-overview">
|
const pillarsSection = <div id="pillars-overview">
|
||||||
<h2>Pillars Overview</h2>
|
<h2>Pillars Overview</h2>
|
||||||
|
@ -97,17 +102,6 @@ class ZeroTrustReportPageComponent extends AuthComponent {
|
||||||
<ReportHeader report_type={ReportTypes.zeroTrust}/>
|
<ReportHeader report_type={ReportTypes.zeroTrust}/>
|
||||||
<hr/>
|
<hr/>
|
||||||
{content}
|
{content}
|
||||||
<hr/>
|
|
||||||
THIS IS THE RAW SERVER DATA
|
|
||||||
<br/>
|
|
||||||
PILLARS:
|
|
||||||
<pre>{JSON.stringify(this.state.pillars, undefined, 2)}</pre>
|
|
||||||
<br/>
|
|
||||||
DIRECTIVES:
|
|
||||||
<pre>{JSON.stringify(this.state.directives, undefined, 2)}</pre>
|
|
||||||
<br/>
|
|
||||||
FINDINGS:
|
|
||||||
<pre>{JSON.stringify(this.state.findings, undefined, 2)}</pre>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import React, {Component} from "react";
|
||||||
|
import {NavLink} from "react-router-dom";
|
||||||
|
|
||||||
|
export default class MustRunMonkeyWarning extends Component {
|
||||||
|
render() {
|
||||||
|
return <p className="alert alert-warning">
|
||||||
|
<i className="glyphicon glyphicon-warning-sign" style={{'marginRight': '5px'}}/>
|
||||||
|
<b>You have to <NavLink to="/run-monkey">run a monkey</NavLink> before generating a report!</b>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
import {css} from "@emotion/core";
|
||||||
|
import React, {Component} from "react";
|
||||||
|
import {GridLoader} from "react-spinners";
|
||||||
|
|
||||||
|
const loading_css_override = css`
|
||||||
|
display: block;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-left: auto;
|
||||||
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
export default class ReportLoader extends Component {
|
||||||
|
render() {
|
||||||
|
return <div id="loading-report" className='sweet-loading'>
|
||||||
|
<h1>Generating Report...</h1>
|
||||||
|
<GridLoader
|
||||||
|
css={loading_css_override}
|
||||||
|
sizeUnit={"px"}
|
||||||
|
size={20}
|
||||||
|
color={'#ffcc00'}
|
||||||
|
loading={this.props.loading}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue