Add number of hosts responding in live query UI. (#333)

These changes fixe #303 by adding the number of hosts successfully responding to the live query UI. This information was previously removed in Fleet 3.7.1
This commit is contained in:
noahtalerman 2021-02-18 12:59:27 -08:00 committed by GitHub
parent 3ccd624ee1
commit 8d5c1c37d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -19,10 +19,10 @@ const QueryProgressDetails = ({ campaign, className, onRunQuery, onStopQuery, qu
const totalRowsCount = get(campaign, ['query_results', 'length'], 0);
const campaignIsEmpty = !hostsCount.successful && hostsCount.successful !== 0;
const onlineHostsTotalDisplay = totalHostsOnline === 1 ? '1 host' : `${totalHostsOnline} hosts`;
const onlineHostsTotalDisplay = totalHostsOnline === 1 ? '1 online host' : `${totalHostsOnline} online hosts`;
const onlineResultsTotalDisplay = totalRowsCount === 1 ? '1 result' : `${totalRowsCount} results`;
const offlineHostsTotalDisplay = totalHostsOffline === 1 ? '1 host' : `${totalHostsOffline} hosts`;
const failedHostsTotalDisplay = hostsCount.failed === 1 ? '1 host' : `${hostsCount.failed} hosts`;
const offlineHostsTotalDisplay = totalHostsOffline === 1 ? '1 offline host' : `${totalHostsOffline} offline hosts`;
const failedHostsTotalDisplay = hostsCount.failed === 1 ? '1 failed host' : `${hostsCount.failed} failed hosts`;
let totalErrorsDisplay = '0 errors';
if (errors) {
totalErrorsDisplay = errors.length === 1 ? '1 error' : `${errors.length} errors`;
@ -66,9 +66,15 @@ const QueryProgressDetails = ({ campaign, className, onRunQuery, onStopQuery, qu
<div className={`${baseClass} ${className}`}>
<div className={`${baseClass}__wrapper`}>
<div className={`${baseClass}__text-wrapper`}>
<span className={`${baseClass}__text-online`}>Online - {onlineHostsTotalDisplay} returning {onlineResultsTotalDisplay}</span>
<span className={`${baseClass}__text-offline`}>Offline - {offlineHostsTotalDisplay} returning 0 results</span>
<span className={`${baseClass}__text-error`}>Failed - {failedHostsTotalDisplay} returning {totalErrorsDisplay}</span>
<span className={`${baseClass}__text-online`}>{hostsCount.successful} out of {onlineHostsTotalDisplay} responding
<span className={`${baseClass}__text-results`}> returning {onlineResultsTotalDisplay}</span>
</span>
<span className={`${baseClass}__text-offline`}>{offlineHostsTotalDisplay}
<span className={`${baseClass}__text-results`}> returning 0 results</span>
</span>
<span className={`${baseClass}__text-error`}>{failedHostsTotalDisplay}
<span className={`${baseClass}__text-results`}> returning {totalErrorsDisplay}</span>
</span>
</div>
<ProgressBar
error={hostsCount.failed}

View File

@ -56,6 +56,10 @@
}
}
&__text-results {
color: $core-medium-blue-grey;
}
&__btn-wrapper {
float: right;