mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
Fixed empty table showing while retrieving results (#2271)
Relates to #2269
This commit is contained in:
parent
e60f21ea18
commit
29aa6610b6
1
changes/issue-2269-query-results
Normal file
1
changes/issue-2269-query-results
Normal file
@ -0,0 +1 @@
|
||||
- Fixed empty table showing while retrieving results
|
@ -186,6 +186,28 @@ const QueryResults = ({
|
||||
};
|
||||
|
||||
const renderTable = () => {
|
||||
const emptyResults = !queryResults || !queryResults.length;
|
||||
const hasNoResultsYet = !isQueryFinished && emptyResults;
|
||||
const finishedWithNoResults =
|
||||
isQueryFinished && (!hostsCount.successful || emptyResults);
|
||||
|
||||
if (hasNoResultsYet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (finishedWithNoResults) {
|
||||
return (
|
||||
<p className="no-results-message">
|
||||
Your live query returned no results.
|
||||
<span>
|
||||
Expecting to see results? Check to see if the hosts you targeted
|
||||
reported “Online” or check out the “Errors”
|
||||
table.
|
||||
</span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${baseClass}__results-table-container`}>
|
||||
<Button
|
||||
@ -263,10 +285,6 @@ const QueryResults = ({
|
||||
</div>
|
||||
);
|
||||
|
||||
const hasNoResults =
|
||||
isQueryFinished &&
|
||||
(!hostsCount.successful || !queryResults || !queryResults.length);
|
||||
|
||||
const firstTabClass = classnames("react-tabs__tab", "no-count", {
|
||||
"errors-empty": !errors || errors?.length === 0,
|
||||
});
|
||||
@ -299,20 +317,7 @@ const QueryResults = ({
|
||||
{NAV_TITLES.ERRORS}
|
||||
</Tab>
|
||||
</TabList>
|
||||
<TabPanel>
|
||||
{isQueryFinished && hasNoResults ? (
|
||||
<p className="no-results-message">
|
||||
Your live query returned no results.
|
||||
<span>
|
||||
Expecting to see results? Check to see if the hosts you
|
||||
targeted reported “Online” or check out the
|
||||
“Errors” table.
|
||||
</span>
|
||||
</p>
|
||||
) : (
|
||||
renderTable()
|
||||
)}
|
||||
</TabPanel>
|
||||
<TabPanel>{renderTable()}</TabPanel>
|
||||
<TabPanel>{renderErrorsTable()}</TabPanel>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user