This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch next
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit ebf6aa7299de4d02a878cfc7e107edaf66cff32a
Author: mintsweet <[email protected]>
AuthorDate: Mon Dec 25 21:40:50 2023 +1300

    feat(config-ui): integrate external code
---
 config-ui/src/app/routrer.tsx           | 37 ++++++++++++++++++++++++++++++++-
 config-ui/src/app/store.ts              |  6 ++++--
 config-ui/src/components/logo/index.tsx |  4 ++++
 config-ui/src/routes/layout/layout.tsx  | 19 -----------------
 config-ui/src/utils/request.ts          |  4 ++++
 config-ui/vite.config.ts                |  4 ++++
 6 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/config-ui/src/app/routrer.tsx b/config-ui/src/app/routrer.tsx
index c3e86021b..55cfc8cd6 100644
--- a/config-ui/src/app/routrer.tsx
+++ b/config-ui/src/app/routrer.tsx
@@ -31,6 +31,7 @@ import { Layout, loader as layoutLoader } from 
'@/routes/layout';
 import { Error, ErrorEnum } from '@/routes/error';
 import { Pipelines, Pipeline } from '@/routes/pipeline';
 import { ApiKeys } from '@/routes/api-keys';
+import { ExtraLayout, UserLayout, Profile, ChangePassword, Account } from 
'@next';
 
 export const router = createBrowserRouter([
   {
@@ -41,9 +42,43 @@ export const router = createBrowserRouter([
     },
     errorElement: <Error />,
   },
+  {
+    path: 'user',
+    element: (
+      <ExtraLayout>
+        <UserLayout />
+      </ExtraLayout>
+    ),
+    children: [
+      {
+        index: true,
+        element: <Navigate to="profile" />,
+      },
+      {
+        path: 'profile',
+        element: <Profile />,
+      },
+      {
+        path: 'change-password',
+        element: <ChangePassword />,
+      },
+    ],
+  },
+  {
+    path: 'account',
+    element: (
+      <ExtraLayout>
+        <Account />
+      </ExtraLayout>
+    ),
+  },
   {
     path: '/',
-    element: <Layout />,
+    element: (
+      <ExtraLayout>
+        <Layout />
+      </ExtraLayout>
+    ),
     loader: layoutLoader,
     errorElement: <Error />,
     children: [
diff --git a/config-ui/src/app/store.ts b/config-ui/src/app/store.ts
index b838101b5..02180d094 100644
--- a/config-ui/src/app/store.ts
+++ b/config-ui/src/app/store.ts
@@ -17,11 +17,13 @@
  */
 
 import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
-import connectionsSlice from '@/features/connections/slice';
+import connectionSlice from '@/features/connections/slice';
+import userSlice from '@next/user/slice';
 
 export const store = configureStore({
   reducer: {
-    connections: connectionsSlice,
+    connections: connectionSlice,
+    user: userSlice,
   },
 });
 
diff --git a/config-ui/src/components/logo/index.tsx 
b/config-ui/src/components/logo/index.tsx
index 23362c9e4..0e600a65d 100644
--- a/config-ui/src/components/logo/index.tsx
+++ b/config-ui/src/components/logo/index.tsx
@@ -23,6 +23,10 @@ import LogoImg from '@/images/logo.svg';
 const Wrapper = styled.div`
   display: flex;
   justify-content: center;
+
+  img {
+    max-width: 150px;
+  }
 `;
 
 export const Logo = () => {
diff --git a/config-ui/src/routes/layout/layout.tsx 
b/config-ui/src/routes/layout/layout.tsx
index eca5c265b..f304695df 100644
--- a/config-ui/src/routes/layout/layout.tsx
+++ b/config-ui/src/routes/layout/layout.tsx
@@ -146,25 +146,6 @@ export const Layout = () => {
                     <img src={APIIcon} alt="api" />
                     <span>API</span>
                   </ExternalLink>
-                  <Navbar.Divider />
-                  <a
-                    href="https://github.com/apache/incubator-devlake";
-                    rel="noreferrer"
-                    target="_blank"
-                    className="navIconLink"
-                  >
-                    <img src={GitHubIcon} alt="github" />
-                    <span>GitHub</span>
-                  </a>
-                  <Navbar.Divider />
-                  <a
-                    
href="https://join.slack.com/t/devlake-io/shared_invite/zt-26ulybksw-IDrJYuqY1FrdjlMMJhs53Q";
-                    rel="noreferrer"
-                    target="_blank"
-                  >
-                    <img src={SlackIcon} alt="slack" />
-                    <span>Slack</span>
-                  </a>
                 </Navbar.Group>
               </S.Header>
               <S.Inner>
diff --git a/config-ui/src/utils/request.ts b/config-ui/src/utils/request.ts
index a3d2e5275..6d126ab58 100644
--- a/config-ui/src/utils/request.ts
+++ b/config-ui/src/utils/request.ts
@@ -43,6 +43,10 @@ instance.interceptors.response.use(
       window.location.replace('/db-migrate');
     }
 
+    if (status === 401) {
+      window.location.reload();
+    }
+
     return Promise.reject(error);
   },
 );
diff --git a/config-ui/vite.config.ts b/config-ui/vite.config.ts
index d8416b25e..3ac3da0fa 100644
--- a/config-ui/vite.config.ts
+++ b/config-ui/vite.config.ts
@@ -26,6 +26,8 @@ export default defineConfig({
 
   envPrefix: 'DEVLAKE_',
 
+  publicDir: path.join(__dirname, '../../frontend/public'),
+
   server: {
     port: 4000,
     proxy: {
@@ -40,6 +42,8 @@ export default defineConfig({
   resolve: {
     alias: {
       '@': path.join(__dirname, './src'),
+      '@next': path.join(__dirname, '../../frontend/src'),
+      'react-router-dom': path.join(__dirname, 
'node_modules/react-router-dom'),
     },
   },
 });

Reply via email to