No hosts for software/policy renders better message (#3701)

* Allow sort by more than one key

* more accurate message for no hosts on filter

* added changes file

* lint fix

* more accurate message for no hosts on filter

* added changes file

* lint fix

* small logical change

Co-authored-by: Tomas Touceda <chiiph@gmail.com>
This commit is contained in:
Martavis Parker 2022-01-19 12:49:14 -08:00 committed by GitHub
parent 77c3a8a61e
commit 4a83201092
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 23 deletions

View file

@ -0,0 +1 @@
- Modified no hosts message for software and policy filter

View file

@ -1450,10 +1450,14 @@ const ManageHostsPage = ({
searchQuery === "" &&
!isHostsLoading
) {
const { software_id, policy_id } = queryParams || {};
const includesSoftwareOrPolicyFilter = !!(software_id || policy_id);
return (
<NoHosts
toggleGenerateInstallerModal={toggleGenerateInstallerModal}
canEnrollHosts={canEnrollHosts}
includesSoftwareOrPolicyFilter={includesSoftwareOrPolicyFilter}
/>
);
}

View file

@ -9,6 +9,7 @@ import RoboDogImage from "../../../../../../assets/images/robo-dog-176x144@2x.pn
interface INoHostsProps {
toggleGenerateInstallerModal: () => void;
canEnrollHosts?: boolean;
includesSoftwareOrPolicyFilter?: boolean;
}
const baseClass = "no-hosts";
@ -16,34 +17,57 @@ const baseClass = "no-hosts";
const NoHosts = ({
toggleGenerateInstallerModal,
canEnrollHosts,
includesSoftwareOrPolicyFilter,
}: INoHostsProps): JSX.Element => {
const renderContent = () => {
if (includesSoftwareOrPolicyFilter) {
return (
<div>
<h1>No hosts match the current criteria</h1>
<p>
Expecting to see new hosts? Try again in a few seconds as the system
catches up.
</p>
</div>
);
}
if (canEnrollHosts) {
return (
<div>
<h2>Add your devices to Fleet</h2>
<p>Generate an installer to add your own devices.</p>
<div className={`${baseClass}__no-hosts-button`}>
<Button
onClick={toggleGenerateInstallerModal}
type="button"
className="button button--brand"
>
Generate installer
</Button>
</div>
</div>
);
}
return (
<div>
<h2>Devices will show up here once theyre added to Fleet.</h2>
<p>
Expecting to see devices? Try again in a few seconds as the system
catches up.
</p>
</div>
);
};
return (
<div className={`${baseClass}`}>
<div className={`${baseClass}__inner`}>
<img src={RoboDogImage} alt="No Hosts" />
{canEnrollHosts ? (
<div>
<h2>Add your devices to Fleet</h2>
<p>Generate an installer to add your own devices.</p>
<div className={`${baseClass}__no-hosts-button`}>
<Button
onClick={toggleGenerateInstallerModal}
type="button"
className="button button--brand"
>
Generate installer
</Button>
</div>
</div>
) : (
<div>
<h2>Devices will show up here once theyre added to Fleet.</h2>
<p>
Expecting to see devices? Try again in a few seconds as the system
catches up.
</p>
</div>
{!includesSoftwareOrPolicyFilter && (
<img src={RoboDogImage} alt="No Hosts" />
)}
{renderContent()}
</div>
</div>
);