From a57078b72bc2762b2e6e9ba35c0c221c2238ba75 Mon Sep 17 00:00:00 2001
From: John Sparger <john.sparger@ess.eu>
Date: Fri, 18 Feb 2022 12:35:24 +0000
Subject: [PATCH] Remove SearchBar and client-side filtering code from
 HostDetailsView as quick fix for UI crash from stale code.

---
 src/views/host/HostDetailsView.js | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/views/host/HostDetailsView.js b/src/views/host/HostDetailsView.js
index c9817a95..3ab8f4ba 100644
--- a/src/views/host/HostDetailsView.js
+++ b/src/views/host/HostDetailsView.js
@@ -20,7 +20,6 @@ import { KeyValueTable } from '../../components/common/KeyValueTable/KeyValueTab
 import { LokiPanel } from '../../components/common/Loki/LokiPanel';
 import { useHistory } from "react-router-dom";
 import { formatDate, initRequestParams } from '../../components/common/Helper';
-import { SearchBar } from '../../components/common/SearchBar/SearchBar';
 
 const useStyles = makeStyles((theme) => ({
     secondItem: {
@@ -31,7 +30,6 @@ const useStyles = makeStyles((theme) => ({
 export function HostDetailsView({ id }) {
     const [host] = useHost(id);
     const [iocs, getIocs, /*reset*/, loading] = useHostIOCList();
-    const [query, setQuery] = useState();
     const [deployedIocs, setDeployedIocs] = useState([]);
     const history = useHistory();
     const classes = useStyles();
@@ -57,12 +55,7 @@ export function HostDetailsView({ id }) {
         getIocs(requestParams);
     }, [getIocs, lazyParams, columnSort, id])
 
-    useEffect(() => setDeployedIocs((iocs?.deployedList ?? []).filter(ioc => ioc.namingName.toLowerCase().includes(query) ||
-        (ioc.host && ioc.host.toLowerCase().includes(query)) ||
-        ioc.git.toLowerCase().includes(query) ||
-        ioc.version.toLowerCase().includes(query) ||
-        ioc.owner.toLowerCase().includes(query) ||
-        (ioc.status && ioc.status.toLowerCase().includes(query)))), [query, iocs]);
+    useEffect(() => setDeployedIocs(iocs?.deployedList ?? []), [iocs]);
 
     const renderHost = { ...host?.csEntryHost };
     delete renderHost.id;
@@ -84,16 +77,14 @@ export function HostDetailsView({ id }) {
             </IconButton>
             {host && <HostBadge host={host} />}
             <SimpleAccordion summary="Deployed IOCs" defaultExpanded>
-                <SearchBar search={setQuery} loading={loading}>
-                    <Hidden smUp>
-                        <IOCList iocs={deployedIocs} />
-                    </Hidden>
-                    <Hidden xsDown>
-                        <IOCTable iocs={deployedIocs} rowType="host" 
-                            totalCount={iocs.totalCount} lazyParams={lazyParams} setLazyParams={setLazyParams} columnSort={columnSort} setColumnSort={setColumnSort}
-                            rowsPerPage={rowsPerPage}/>
-                    </Hidden>
-                </SearchBar>
+                <Hidden smUp>
+                    <IOCList iocs={deployedIocs} loading={loading}/>
+                </Hidden>
+                <Hidden xsDown>
+                    <IOCTable iocs={deployedIocs} loading={loading} rowType="host" 
+                        totalCount={iocs.totalCount} lazyParams={lazyParams} setLazyParams={setLazyParams} columnSort={columnSort} setColumnSort={setColumnSort}
+                        rowsPerPage={rowsPerPage}/>
+                </Hidden>
             </SimpleAccordion>
             <SimpleAccordion summary="Syslog info" defaultExpanded>
                 {host &&
-- 
GitLab