You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/10/28 02:27:41 UTC

[GitHub] [incubator-devlake] e2corporation commented on a diff in pull request #2886: feat: setup configuration-ui plugin registry

e2corporation commented on code in PR #2886:
URL: https://github.com/apache/incubator-devlake/pull/2886#discussion_r1007547165


##########
config-ui/src/components/Sidebar.jsx:
##########
@@ -29,35 +35,46 @@ import { ReactComponent as Logo } from '@/images/devlake-logo.svg'
 import { ReactComponent as LogoText } from '@/images/devlake-textmark.svg'
 
 import '@/styles/sidebar.scss'
-import UIContext from '../store/UIContext'
+import UIContext from '@/store/UIContext'
 
-const Sidebar = () => {
+const Sidebar = (props) => {
+  const { integrations = [] } = props
   const activeRoute = useRouteMatch()
   const uiContext = useContext(UIContext)
 
-  const [menu, setMenu] = useState(MenuConfiguration(activeRoute))
+  const getMenu = useCallback(
+    () => MenuConfiguration(activeRoute, integrations),
+    [activeRoute, integrations]
+  )
+
+  const ActiveMenu = useMemo(() => getMenu(), [getMenu])
+
+  const [menu, setMenu] = useState(ActiveMenu)
   const [versionTag, setVersionTag] = useState('')
 
-  useEffect(() => {
-    setMenu(MenuConfiguration(activeRoute))
-  }, [activeRoute])
+  // useEffect(() => {
+  //   setMenu(ActiveMenu)
+  // }, [ActiveMenu])
 
   useEffect(() => {
-    const fetchVersion = async () => {
-      try {
-        const versionUrl = `${DEVLAKE_ENDPOINT}/version`

Review Comment:
   @likyh We no longer display the version tag on the sidebar, fetch is not needed at the moment.



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org