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


##########
dashboard/src/views/SideBar/SideBarBody.tsx:
##########
@@ -246,38 +323,117 @@ const SideBarBody = (props: {
             backgroundColor: "#034858",
           }}
         >
-          {/* Collapsed sidebar logo */}
+          {/* Collapsed sidebar logo and module icons */}
           {!open && (
-            <div
-              style={{
-                width: "100%",
-                textAlign: "center",
-                paddingLeft: "12px",
-                display: "flex",
-                alignItems: "center",
-                justifyContent: "center",
-                minHeight: "64px",
-                cursor: "pointer",
-                boxSizing: "border-box",
-              }}
-              role="button"
-              tabIndex={0}
-              aria-label="Atlas home — refresh dashboard"
-              onClick={handleAtlasLogoClick}
-              onKeyDown={handleAtlasLogoKeyDown}
-              data-cy="apache-atlas-logo-collapsed"
+            <Stack
+              alignItems="center"
+              sx={{ width: "100%", flex: 1, minHeight: 0, overflowY: "auto", 
overflowX: "hidden", boxSizing: "border-box", pb: "60px" }}
             >
-              <img
-                src={apacheAtlasLogo}
-                alt="Apache Atlas logo"
-                style={{
-                  width: "29px",
-                  height: "auto",
-                  maxWidth: "100%",
-                  display: "block",
+              <div
+                className="collapsed-logo-container"
+                role="button"
+                tabIndex={0}
+                aria-label="Atlas home — refresh dashboard"
+                onClick={handleAtlasLogoClick}
+                onKeyDown={handleAtlasLogoKeyDown}
+                data-cy="apache-atlas-logo-collapsed"
+              >
+                <img
+                  src={apacheAtlasLogo}
+                  alt="Apache Atlas logo"
+                  className="collapsed-logo-img"
+                />
+              </div>
+
+              {/* Module Icons for Mini Drawer */}
+              <Stack alignItems="stretch" gap="1rem" sx={{ width: "100%" }}>
+                {/* Search */}
+                <Box sx={{ display: "flex", justifyContent: "center", 
borderLeft: "4px solid transparent", borderRight: "4px solid transparent", 
background: "transparent" }}>
+                  <Tooltip title="Search" placement="right">
+                    <IconButton aria-expanded={open} onClick={() => 
setOpen(true)} sx={{ '&:hover': { background: 'rgba(255, 255, 255, 0.1)' } }}>
+                      <img src="/img/sidebar-icons/icon-search.svg" 
className="sidebar-module-icon" alt="search" />
+                    </IconButton>
+                  </Tooltip>
+                </Box>
+
+                {modules.filter(m => m.isVisible).map(m => (
+                  <Box
+                    key={m.id}
+                    className={m.isActive ? "sidebar-icon-active" : ""}
+                    sx={{
+                      display: "flex",
+                      justifyContent: "center",
+                      borderLeft: "4px solid transparent",
+                      borderRight: "4px solid transparent",
+                      background: "transparent"
+                    }}
+                  >
+                    <Tooltip title={m.title} placement="right">
+                      <IconButton onClick={(e) => handlePopoverOpen(e, m.id)} 
sx={{ color: m.isActive ? "white" : "rgba(255, 255, 255, 0.6)", '&:hover': { 
color: 'white', background: 'rgba(255, 255, 255, 0.1)' } }}>
+                        <img src={m.iconUrl} className="sidebar-module-icon" 
alt={m.title.toLowerCase()} />
+                      </IconButton>
+                    </Tooltip>
+                  </Box>
+                ))}
+              </Stack>

Review Comment:
   Resolved. Removed the inline styles and replaced them with 
className="sidebar-tree-highlight" for consistency with the SCSS definitions.



##########
dashboard/src/components/SidebarSearchInput.tsx:
##########
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React, { ChangeEvent } from "react";
+import { Paper, InputBase, Stack } from "@mui/material";
+import ClearIcon from "@mui/icons-material/Clear";
+import { IconButton } from "@components/muiComponents";
+
+interface SidebarSearchInputProps {
+  searchTerm: string;
+  onChange: (value: string) => void;
+  dataCy?: string;
+}
+
+export const SidebarSearchInput: React.FC<SidebarSearchInputProps> = ({
+  searchTerm,
+  onChange,
+  dataCy
+}) => (
+  <Paper
+    sx={{
+      width: "100%",
+      paddingLeft: "8px",
+      display: "flex",
+      alignItems: "center"
+    }}
+    className="sidebar-searchbar"
+  >
+    <InputBase
+      fullWidth
+      sx={{ color: "rgba(0, 0, 0, 0.7)" }}
+      placeholder="Search"
+      inputProps={{ "aria-label": "search" }}
+      value={searchTerm}
+      onChange={(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.value)}
+      data-cy={dataCy}
+      endAdornment={
+        <Stack direction="row" alignItems="center" gap="4px">
+          {searchTerm.length > 0 && (
+            <IconButton
+              size="small"
+              onClick={() => onChange("")}
+              edge="end"
+              sx={{ padding: "4px" }}
+            >
+              <ClearIcon fontSize="small" sx={{ color: "rgba(0, 0, 0, 0.4)" }} 
/>
+            </IconButton>
+          )}
+          <img
+            src="/img/sidebar-icons/icon-search.svg"
+            style={{

Review Comment:
   Resolved. Moved the search icon's inline styles to a new 
.sidebar-searchbar-icon class in sidebar.scss



##########
dashboard/src/components/EntityDisplayImage.tsx:
##########
@@ -15,86 +15,58 @@
  * limitations under the License.
  */
 
-import { useEffect, useState } from "react";
-import { Avatar, Skeleton } from "@mui/material";
+import { Avatar } from "@mui/material";
 import { getEntityIconPath } from "../utils/Utils";
 
+interface DisplayImageProps {
+  entity: Record<string, unknown>;
+  width?: string | number;
+  height?: string | number;
+  avatarDisplay?: boolean;
+  isProcess?: boolean;
+}
+
 const DisplayImage = ({
   entity,
   width,
   height,
   avatarDisplay,
   isProcess
-}: any) => {
-  const [imageUrl, setImageUrl] = useState<any>(null);
-  const [checkEntityImage, setCheckEntityImage] = useState<any>({
-    [entity.guid]: false
-  });
-
-  useEffect(() => {
-    const fetchImagePath = async () => {
-      let entityData = { ...entity, ...{ isProcess: isProcess } };
-      let imagePath: any = getEntityIconPath({ entityData: entityData });
-      try {
-        const response = await fetch(imagePath);
-        const contentType: any = response.headers.get("Content-Type");
-
-        if (contentType.startsWith("image/")) {
-          let cache = { [entityData.guid]: imagePath };
-          setCheckEntityImage(cache);
-          setImageUrl(getEntityIconPath({ entityData: entityData }));
-        } else {
-          setImageUrl(
-            getEntityIconPath({ entityData: entityData, errorUrl: imagePath })
-          );
-        }
-      } catch (error) {
-        setImageUrl(
-          getEntityIconPath({ entityData: entityData, errorUrl: imagePath })
-        );
-      }
-    };
+}: DisplayImageProps) => {
+  const entityData = { ...entity, isProcess: isProcess };
+  
+  const primaryUrl = getEntityIconPath({ entityData }) || "";
+  const fallbackUrl = getEntityIconPath({ entityData, errorUrl: primaryUrl }) 
|| "";
 
-    fetchImagePath();
-  }, []);
+  const handleError = (e: React.SyntheticEvent<HTMLImageElement, Event>) => {

Review Comment:
   Resolved. Added a unit test in EntityDisplayImage.test.tsx to verify that a 
failing fallback image does not trigger an infinite loop.



-- 
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