Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/gmp/models/report/__tests__/host.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('ReportHost tests', () => {
expect(host.details).toEqual({});
expect(host.result_counts).toBeDefined();
expect(host.result_counts.false_positive).toEqual(0);
expect(host.result_counts.critical).toEqual(0);
expect(host.result_counts.high).toEqual(0);
expect(host.result_counts.medium).toEqual(0);
expect(host.result_counts.log).toEqual(0);
Expand Down Expand Up @@ -58,6 +59,7 @@ describe('ReportHost tests', () => {
expect(host.details).toEqual({});
expect(host.result_counts).toBeDefined();
expect(host.result_counts.false_positive).toEqual(0);
expect(host.result_counts.critical).toEqual(0);
expect(host.result_counts.high).toEqual(0);
expect(host.result_counts.medium).toEqual(0);
expect(host.result_counts.log).toEqual(0);
Expand Down Expand Up @@ -152,6 +154,17 @@ describe('ReportHost tests', () => {
expect(host2.result_counts.low).toEqual(3);
expect(host2.result_counts.log).toEqual(4);
expect(host2.result_counts.false_positive).toEqual(5);

const host3 = ReportHost.fromElement({
result_count: {
page: 7,
critical: {
page: 1,
},
},
});
expect(host3.result_counts.total).toEqual(7);
expect(host3.result_counts.critical).toEqual(1);
});

test('should parse start', () => {
Expand Down
5 changes: 5 additions & 0 deletions src/gmp/models/report/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface HostElement {
};
result_count?: {
page?: number;
critical?: PageCountElement;
false_positive?: PageCountElement;
high?: PageCountElement;
hole?: {
Expand Down Expand Up @@ -85,6 +86,7 @@ interface ComplianceCounts {
}

interface ResultCounts {
critical?: number;
high: number;
medium: number;
low: number;
Expand Down Expand Up @@ -169,6 +171,7 @@ class ReportHost {
this.ip = ip;
this.portsCount = portsCount;
this.result_counts = result_counts ?? {
critical: 0,
false_positive: 0,
high: 0,
medium: 0,
Expand Down Expand Up @@ -209,6 +212,7 @@ class ReportHost {

if (isDefined(result_count)) {
copy.result_counts = {
critical: parsePageCount(result_count.critical),
high: parsePageCount(result_count.high),
medium: parsePageCount(result_count.medium),
low: parsePageCount(result_count.low),
Expand All @@ -218,6 +222,7 @@ class ReportHost {
};
} else {
copy.result_counts = {
critical: 0,
high: 0,
medium: 0,
low: 0,
Expand Down
21 changes: 14 additions & 7 deletions src/web/entities/EntitiesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ const TableBox = styled(Layout)`
margin-top: 10px;
`;

const TableWrapper = styled.div`
width: 100%;
overflow-x: auto;
`;

const EmptyTitle = styled(Layout)`
margin-top: 10px;
margin-bottom: 20px;
Expand Down Expand Up @@ -319,13 +324,15 @@ function EntitiesTable<
) : (
pagination
)}
<UpdatingStripedTable
$isUpdating={isUpdating}
footer={footer}
header={header}
>
{body}
</UpdatingStripedTable>
<TableWrapper>
<UpdatingStripedTable
$isUpdating={isUpdating}
footer={footer}
header={header}
>
{body}
</UpdatingStripedTable>
</TableWrapper>
{footnote ? (
<Layout align="space-between">
<FootNote>
Expand Down
1 change: 1 addition & 0 deletions src/web/pages/reports/details/HostsTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const hostsSortFunctions = {
appsCount: makeCompareNumber(entity => entity.details.appsCount),
distance: makeCompareNumber(entity => entity.details.distance),
os: makeCompareString(entity => entity.details.best_os_cpe),
critical: makeCompareNumber(entity => entity.result_counts.critical),
high: makeCompareNumber(entity => entity.result_counts.high),
medium: makeCompareNumber(entity => entity.result_counts.warning),
low: makeCompareNumber(entity => entity.result_counts.info),
Expand Down
Loading