Brijesh619 commented on code in PR #688:
URL: https://github.com/apache/atlas/pull/688#discussion_r3720029245


##########
dashboard/src/views/SideBar/SideBarBody.tsx:
##########
@@ -308,189 +487,121 @@ const SideBarBody = (props: {
                     data-cy="atlas-logo"
                   />
                 </span>
-                <Paper
-                  sx={{
-                    width: "100%",
-                  }}
-                  className="sidebar-searchbar"
-                >
-                  <InputBase
-                    fullWidth
-                    sx={{ color: "rgba(0, 0, 0, 0.7)" }}
-                    placeholder="Entities, Classifications, Glossaries"
-                    inputProps={{ "aria-label": "search" }}
-                    value={searchTerm}
-                    onChange={(e: ChangeEvent<HTMLInputElement>) => {
-                      setSearchTerm(e.target.value);
-                    }}
-                    data-cy="searchNode"
-                  />
-
-                  <IconButton type="submit" size="small" aria-label="search">
-                    <SearchIcon fontSize="inherit" />
-                  </IconButton>
-                </Paper>
+                <SidebarSearchInput
+                  searchTerm={searchTerm}
+                  onChange={setSearchTerm}
+                  dataCy="searchNode"
+                />
               </Stack>
             </DrawerHeader>
           )}
           <Paper
             className="sidebar-wrapper"
             sx={{
               flex: 1,
-              overflow: "hidden auto",
-              paddingBottom: "0px", // Account for bottom toggle button
+              overflowX: "hidden",
+              overflowY: "auto",
+              paddingBottom: "48px", // Added space so it doesn't touch the 
bottom toggle button
               ...(open == false && {

Review Comment:
   Resolved! Updated non-strict equality open == false to use the strict !open 
check



##########
dashboard/src/components/EntityDisplayImage.tsx:
##########
@@ -26,75 +25,40 @@ const DisplayImage = ({
   avatarDisplay,
   isProcess
 }: any) => {

Review Comment:
   Resolved! Defined a DisplayImageProps interface instead of using any



##########
dashboard/src/views/SideBar/SideBarTree/SideBarTree.tsx:
##########
@@ -286,1008 +315,1051 @@ const BarTreeView: FC<{
   sideBarOpen,
   searchTerm,
   loader,
+  isPopover,
 }) => {
-  const { savedSearchData }: any = useAppSelector(
-    (state: any) => state.savedSearch
-  );
-  const { bmguid } = useParams();
-  const location = useLocation();
-  const navigate = useNavigate();
-  const searchParams = new URLSearchParams(location.search);
-  const [expand, setExpand] = useState<null | HTMLElement>(null);
-  const [selectedNode, setSelectedNode] = useState<{
-    type: string | null;
-    tag: string | null;
-    relationship: string | null;
-    businessMetadata: string | null;
-  }>({
-    type: null,
-    tag: null,
-    relationship: null,
-    businessMetadata: null,
-  });
-
-  const [openModal, setOpenModal] = useState<boolean>(false);
-  const toastId: any = useRef(null);
-  const open = Boolean(expand);
-  const [expandedItems, setExpandedItems] = useState<string[]>([]);
-  const [tagModal, setTagModal] = useState<boolean>(false);
-  const [glossaryModal, setGlossaryModal] = useState<boolean>(false);
-  const { businessMetaData }: any = useAppSelector(
-    (state: any) => state.businessMetaData
-  );
-
-  const filteredData = useMemo(() => {
-    return treeData.filter((node) => {
-      return (
-        node.label?.toLowerCase().includes(searchTerm.toLowerCase()) ||
-        (node.children &&
-          node.children.some((child) =>
-            child.label?.toLowerCase().includes(searchTerm.toLowerCase())
-          ))
-      );
+    const { savedSearchData } = useAppSelector(
+      (state) => state.savedSearch
+    );
+    const { bmguid } = useParams();
+    const location = useLocation();
+    const navigate = useNavigate();
+    const searchParams = new URLSearchParams(location.search);
+    const [expand, setExpand] = useState<null | HTMLElement>(null);
+    const [selectedNode, setSelectedNode] = useState<{
+      type: string | null;
+      tag: string | null;
+      relationship: string | null;
+      businessMetadata: string | null;
+      term: string | null;
+      customFilter: string | null;
+    }>({
+      type: null,
+      tag: null,
+      relationship: null,
+      businessMetadata: null,
+      term: null,
+      customFilter: null,
     });
-  }, [treeData, searchTerm]);
 
-  const displayTreeName = useMemo(() => {
-    return treeName === "CustomFilters" ? "Custom Filters" : treeName
-  }, [treeName]);
+    const [openModal, setOpenModal] = useState<boolean>(false);
+    const toastId: any = useRef(null);
+    const open = Boolean(expand);
+    const [expandedItems, setExpandedItems] = useState<string[]>([]);
+    const [tagModal, setTagModal] = useState<boolean>(false);
+    const [glossaryModal, setGlossaryModal] = useState<boolean>(false);
+    const { businessMetaData } = useAppSelector(
+      (state) => state.businessMetaData as unknown as { businessMetaData?: { 
businessMetadataDefs?: EnumTypeDefData[] } }
+    );
 
-  const highlightText = useMemo(() => {
-    return (text: string) => {
-      if (!searchTerm) return text;
+    const filteredData = useMemo(() => {
+      return treeData.filter((node) => {
+        return (
+          node.label?.toLowerCase().includes(searchTerm.toLowerCase()) ||
+          (node.children &&
+            node.children.some((child) =>
+              child.label?.toLowerCase().includes(searchTerm.toLowerCase())
+            ))
+        );
+      });
+    }, [treeData, searchTerm]);
+
+    const displayTreeName = useMemo(() => {
+      return treeName === "CustomFilters" ? "Custom Filters" : treeName
+    }, [treeName]);
+
+    const highlightText = useMemo(() => {
+      return (text: string) => {
+        if (!searchTerm) return text;
+
+        const parts = text.split(new RegExp(`(${searchTerm})`, "gi"));

Review Comment:
   Resolved! Escaped regex metacharacters in searchTerm before passing it to 
RegExp constructor.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to