Skip to content

Commit

Permalink
Add: New OS hosts links, columns, better filters
Browse files Browse the repository at this point in the history
This adds new columns to Operating Systems list page and an icon to
the OS details page to distinguish between hosts where the OS is the
best match and all hosts where the OS was detected.
The filters for the linked filtered hosts pages now use new filter
keywords to be more consistent with the numbers on the OS pages.

This improves the consistency between the OS and hosts pages and makes
it easier to find hosts that are still using an OS even if it is not the
best match.
  • Loading branch information
timopollmeier committed May 4, 2023
1 parent a26924a commit 4687d5b
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 16 deletions.
4 changes: 4 additions & 0 deletions public/locales/gsa-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"Base Vector": "Basisvektor",
"Base with a minimum set of NVTs": "Basis Konfiguration mit einer minimalen Anzahl an NVTs",
"Begins": "Beginnt",
"Best OS": "Bestes OS",
"Browser Language": "Browser-Sprache",
"By clicking the New Task icon": "Durch Anklicken des \"Neue Aufgabe\"-Symbols",
"CA Certificate": "CA-Zertifikat",
Expand Down Expand Up @@ -774,6 +775,8 @@
"Hostname": "Hostname",
"Hostname / IP": "Hostname/IP",
"Hosts": "Hosts",
"Hosts (All)": "Hosts (Alle)",
"Hosts (Best OS)": "Hosts (Bestes OS)",
"Hosts (High) by Modification Time (Total: {{count}})": "Hosts (\"Hoch\") nach Änderungszeit (Gesamt: {{count}})",
"Hosts Filter": "Hosts-Filter",
"Hosts Topology": "Hosts-Topologie",
Expand All @@ -782,6 +785,7 @@
"Hosts by Severity Class (Total: {{count}})": "Hosts nach Schweregradklasse (Gesamt: {{count}})",
"Hosts scanned": "Gescannte Hosts",
"Hosts with Operating System {{- name}}": "Hosts mit Betriebssystem {{- name}}",
"Hosts with Operating System {{- name}} as the best match": "Hosts mit {{- name}} als passendstes Betriebssystem",
"Hour": "Stunde",
"Hourly": "Stündlich",
"How to get a Greenbone Enterprise License": "Wie erhalte ich eine Greenbone Enterprise License",
Expand Down
3 changes: 3 additions & 0 deletions src/gmp/models/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class OperatingSystem extends Asset {
ret.hosts = {
length: ret.os.installs,
};
ret.allHosts = {
length: ret.os.all_installs,
};
}

delete ret.os;
Expand Down
21 changes: 18 additions & 3 deletions src/web/pages/operatingsystems/detailspage.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ let ToolBarIcons = ({
onOperatingSystemDeleteClick,
onOperatingSystemDownloadClick,
}) => {
const {hosts} = entity;
const {allHosts, hosts} = entity;
return (
<Divider margin="10px">
<IconDivider>
Expand Down Expand Up @@ -113,17 +113,32 @@ let ToolBarIcons = ({
/>
</IconDivider>
<IconDivider>
<Badge content={hosts.length}>
<Badge content={allHosts.length}>
<Link
to="hosts"
filter={'os~"' + entity.name + '"'}
filter={'os_id="' + entity.id + '"'}
textOnly={!links}
title={_('Hosts with Operating System {{- name}}', entity)}
>
<HostIcon />
</Link>
</Badge>
</IconDivider>
<IconDivider>
<Badge content={hosts.length}>
<Link
to="hosts"
filter={'best_os_cpe="' + entity.name + '"'}
textOnly={!links}
title={_(
'Hosts with Operating System {{- name}} as the best match',
entity,
)}
>
<HostIcon />
</Link>
</Badge>
</IconDivider>
</Divider>
);
};
Expand Down
6 changes: 5 additions & 1 deletion src/web/pages/operatingsystems/filterdialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ const SORT_FIELDS = [
name: 'average_severity',
displayName: _l('Severity: Average'),
},
{
name: 'all_hosts',
displayName: _l('Hosts (All)'),
},
{
name: 'hosts',
displayName: _l('Hosts'),
displayName: _l('Hosts (Best OS)'),
},
{
name: 'modified',
Expand Down
13 changes: 12 additions & 1 deletion src/web/pages/operatingsystems/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,18 @@ const Row = ({
<span>
<Link
to={'hosts'}
filter={'os="' + entity.name + '"'}
filter={'os_id="' + entity.id + '"'}
textOnly={!links}
>
{entity.allHosts.length}
</Link>
</span>
</TableData>
<TableData>
<span>
<Link
to={'hosts'}
filter={'best_os_cpe="' + entity.name + '"'}
textOnly={!links}
>
{entity.hosts.length}
Expand Down
32 changes: 21 additions & 11 deletions src/web/pages/operatingsystems/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Header = ({
<TableHeader>
<TableRow>
<TableHead
width="29%"
width="24%"
rowSpan="2"
currentSortDir={currentSortDir}
currentSortBy={currentSortBy}
Expand All @@ -64,15 +64,9 @@ const Header = ({
<TableHead width="24%" colSpan="3">
{_('Severity')}
</TableHead>
<TableHead
width="5%"
rowSpan="2"
currentSortDir={currentSortDir}
currentSortBy={currentSortBy}
sortBy={sort ? 'hosts' : false}
onSortChange={onSortChange}
title={_('Hosts')}
/>
<TableHead width="10%" colSpan="2">
{_('Hosts')}
</TableHead>
<TableHead
width="15%"
rowSpan="2"
Expand Down Expand Up @@ -115,6 +109,22 @@ const Header = ({
onSortChange={onSortChange}
title={_('Average')}
/>
<TableHead
width="5%"
currentSortDir={currentSortDir}
currentSortBy={currentSortBy}
sortBy={sort ? 'all_hosts' : false}
onSortChange={onSortChange}
title={_('All')}
/>
<TableHead
width="5%"
currentSortDir={currentSortDir}
currentSortBy={currentSortBy}
sortBy={sort ? 'hosts' : false}
onSortChange={onSortChange}
title={_('Best OS')}
/>
</TableRow>
</TableHeader>
);
Expand All @@ -130,7 +140,7 @@ Header.propTypes = {
};

const Footer = createEntitiesFooter({
span: 8,
span: 9,
delete: true,
download: 'os.xml',
});
Expand Down

0 comments on commit 4687d5b

Please sign in to comment.