diff --git a/changes/3660-hosts-filter-state b/changes/3660-hosts-filter-state
new file mode 100644
index 0000000000..3376874f99
--- /dev/null
+++ b/changes/3660-hosts-filter-state
@@ -0,0 +1 @@
+- Modified no hosts message for software and policy filter
\ No newline at end of file
diff --git a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx
index d9fd1163f6..92b2cd68f0 100644
--- a/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx
+++ b/frontend/pages/hosts/ManageHostsPage/ManageHostsPage.tsx
@@ -1450,10 +1450,14 @@ const ManageHostsPage = ({
searchQuery === "" &&
!isHostsLoading
) {
+ const { software_id, policy_id } = queryParams || {};
+ const includesSoftwareOrPolicyFilter = !!(software_id || policy_id);
+
return (
);
}
diff --git a/frontend/pages/hosts/ManageHostsPage/components/NoHosts/NoHosts.tsx b/frontend/pages/hosts/ManageHostsPage/components/NoHosts/NoHosts.tsx
index d2cf65b2f8..e4f7dac814 100644
--- a/frontend/pages/hosts/ManageHostsPage/components/NoHosts/NoHosts.tsx
+++ b/frontend/pages/hosts/ManageHostsPage/components/NoHosts/NoHosts.tsx
@@ -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 (
+
+
No hosts match the current criteria
+
+ Expecting to see new hosts? Try again in a few seconds as the system
+ catches up.
+
+
+ );
+ }
+
+ if (canEnrollHosts) {
+ return (
+
+
Add your devices to Fleet
+
Generate an installer to add your own devices.
+
+
+
+
+ );
+ }
+
+ return (
+
+
Devices will show up here once they’re added to Fleet.
+
+ Expecting to see devices? Try again in a few seconds as the system
+ catches up.
+
+
+ );
+ };
+
return (
-

- {canEnrollHosts ? (
-
-
Add your devices to Fleet
-
Generate an installer to add your own devices.
-
-
-
-
- ) : (
-
-
Devices will show up here once they’re added to Fleet.
-
- Expecting to see devices? Try again in a few seconds as the system
- catches up.
-
-
+ {!includesSoftwareOrPolicyFilter && (
+

)}
+ {renderContent()}
);