Skip to content

Commit

Permalink
Merge pull request #2357 from sarahd93/report_scanned_hosts_20.08
Browse files Browse the repository at this point in the history
fix disappearing scanned hosts
  • Loading branch information
bjoernricks authored Aug 3, 2020
2 parents e0a678a + 60bd695 commit 152c361
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Deleting a single entity now removes its ID from store [#1839](https://github.com/greenbone/gsa/pull/1839)

### Fixed
- Fixed "Hosts scanned" in report details disappearing during page refresh [#2357](https://github.com/greenbone/gsa/pull/2357)
- Fixed schedule_periods not forwarded if there is no schedule [#2331](https://github.com/greenbone/gsa/pull/2331)
- Fixed broken radio buttons in alert dialog [#2326](https://github.com/greenbone/gsa/pull/2326)
- Fixed report formats undeletable and unrestorable [#2321](https://github.com/greenbone/gsa/pull/2321)
Expand Down
15 changes: 10 additions & 5 deletions gsa/src/web/pages/reports/details/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import React from 'react';
import React, {useState, useEffect} from 'react';

import styled from 'styled-components';

Expand Down Expand Up @@ -100,8 +100,13 @@ const Summary = ({

const {id, name, comment, progress} = task;

const hosts_count =
isDefined(hosts) && isDefined(hosts.counts) ? hosts.counts.all : 0;
const [hostsCount, setHostsCount] = useState(0);

useEffect(() => {
if (isDefined(hosts?.counts?.all)) {
setHostsCount(hosts.counts.all);
}
}, [hosts]);

const filterString = isDefined(filter)
? filter.simple().toFilterString()
Expand Down Expand Up @@ -244,10 +249,10 @@ const Summary = ({
<TableData>{slave.name}</TableData>
</TableRow>
)}
{hosts_count > 0 && (
{hostsCount > 0 && (
<TableRow>
<TableData>{_('Hosts scanned')}</TableData>
<TableData>{hosts_count}</TableData>
<TableData>{hostsCount}</TableData>
</TableRow>
)}
<TableRow>
Expand Down

0 comments on commit 152c361

Please sign in to comment.