Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show vulnerabilities WebApp report #4736

Merged
merged 9 commits into from
Dec 4, 2021
4 changes: 2 additions & 2 deletions .azure-pipelines/LinuxTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
# Gradle build cache, see: https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
- task: Cache@2
inputs:
key: '"$(Agent.OS)" | test | gradle-caches | v1 | gradle.properties, settings.gradle.kts, **/build.gradle.kts'
key: '"$(Agent.OS)" | test | gradle-caches | v2 | gradle.properties, settings.gradle.kts, **/build.gradle.kts'
restoreKeys: |
"$(Agent.OS)" | test | gradle-caches | v1
"$(Agent.OS)" | test | gradle-caches | v2
path: $(GRADLE_USER_HOME)/caches
displayName: Cache Gradle Caches

Expand Down
24 changes: 16 additions & 8 deletions reporter-web-app/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,38 @@ tr.ant-table-expanded-row, tr.ant-table-expanded-row:hover {
width: 1.2em;
}
.ort-control > svg:hover {
color: #1890FF;
color: #1890ff;
}

/* Colors of exclude, error, hint, success and warning icons */
.ort-error {
color: #F5222D;
.ort-critical {
color: #c61b10;
}

.ort-error, .ort-high {
color: #f5222d;
}

.ort-excluded {
color: #B0C4DE;
color: #b0c4de;
}

.ort-hint {
.ort-hint, .ort-unknown {
color: #84b6eb;
}

.ort-ok {
color: #52C41A;
.ort-low, .ort-ok {
color: #52c41a;
}

.ort-warning {
color: #ef8f1c;
}

.ort-medium {
color: #d5c920;
}

.ort-about-logo {
width: 420px;
height: 90px;
Expand All @@ -131,7 +139,7 @@ tr.ant-table-expanded-row, tr.ant-table-expanded-row:hover {
/* === Styling for PackageCollapse === */

.ort-package-collapse {
background-color: #FFF;
background-color: #fff;
font-weight: 400;
}

Expand Down
49 changes: 46 additions & 3 deletions reporter-web-app/src/components/SummaryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ import {
CheckCircleOutlined,
ExclamationCircleOutlined,
ExceptionOutlined,
SecurityScanOutlined,
TagsOutlined
} from '@ant-design/icons';
import IssuesTable from './IssuesTable';
import LicenseChart from './LicenseChart';
import LicenseStatsTable from './LicenseStatsTable';
import RuleViolationsTable from './RuleViolationsTable';
import VulnerabilitiesTable from './VulnerabilitiesTable';
import {
getOrtResult,
getSummaryCharts,
Expand Down Expand Up @@ -110,6 +112,20 @@ class SummaryView extends React.Component {
});
}

static onChangeVulnerabilitiesTable(pagination, filters, sorter) {
store.dispatch({
type: 'SUMMARY::CHANGE_VULNERABILITIES_TABLE',
payload: {
columns: {
vulnerabilities: {
filteredInfo: filters,
sortedInfo: sorter
}
}
}
});
}

shouldComponentUpdate() {
const { shouldComponentUpdate } = this.props;
return shouldComponentUpdate;
Expand All @@ -133,7 +149,8 @@ class SummaryView extends React.Component {
repository: { vcsProcessed },
ruleViolations,
scopes,
statistics
statistics,
vulnerabilities
} = webAppOrtResult;

const {
Expand Down Expand Up @@ -348,6 +365,7 @@ class SummaryView extends React.Component {
{
(webAppOrtResult.hasIssues()
|| webAppOrtResult.hasRuleViolations()
|| webAppOrtResult.hasVulnerabilities()
|| webAppOrtResult.hasDeclaredLicenses()
|| webAppOrtResult.hasDetectedLicenses())
&& (
Expand All @@ -370,7 +388,7 @@ class SummaryView extends React.Component {
)
</span>
)}
key="1"
key="ort-summary-rule-violations-table"
>
<RuleViolationsTable
onChange={
Expand Down Expand Up @@ -399,7 +417,7 @@ class SummaryView extends React.Component {
)
</span>
)}
key="2"
key="ort-summary-issues-table"
>
<IssuesTable
issues={webAppOrtResult.issues}
Expand All @@ -412,6 +430,31 @@ class SummaryView extends React.Component {
</TabPane>
)
}
{
webAppOrtResult.hasVulnerabilities()
&& (
<TabPane
tab={(
<span>
<SecurityScanOutlined />
Vulnerabilities (
{vulnerabilities.length}
)
</span>
)}
key="ort-summary-vulnerabilities-table"
>
<VulnerabilitiesTable
onChange={
SummaryView.onChangeVulnerabilitiesTable
}
vulnerabilities={webAppOrtResult.vulnerabilities}
showExcludesColumn={webAppOrtResult.hasExcludes()}
state={columns.vulnerabilities}
/>
</TabPane>
)
}
{
webAppOrtResult.hasDeclaredLicensesProcessed()
&& (
Expand Down
Loading