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

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


The following commit(s) were added to refs/heads/main by this push:
     new bf2623e9f fix(config-ui): the display of 'data connections' in the 
project list (#6497)
bf2623e9f is described below

commit bf2623e9fbbf9a61de475333a0f6f10729b97374
Author: 青湛 <[email protected]>
AuthorDate: Wed Nov 22 15:37:43 2023 +1300

    fix(config-ui): the display of 'data connections' in the project list 
(#6497)
---
 config-ui/src/features/connections/components/name.tsx |  5 +++--
 config-ui/src/pages/blueprint/home/index.tsx           | 12 +++++++-----
 config-ui/src/pages/blueprint/home/styled.ts           | 16 ----------------
 config-ui/src/pages/project/home/index.tsx             |  4 ++--
 config-ui/src/pages/project/home/styled.ts             | 16 ----------------
 5 files changed, 12 insertions(+), 41 deletions(-)

diff --git a/config-ui/src/features/connections/components/name.tsx 
b/config-ui/src/features/connections/components/name.tsx
index b3b617f8e..313e77f1e 100644
--- a/config-ui/src/features/connections/components/name.tsx
+++ b/config-ui/src/features/connections/components/name.tsx
@@ -18,7 +18,7 @@
 
 import { useAppSelector } from '@/app/hook';
 
-import { selectConnection } from '../slice';
+import { selectConnection, selectWebhook } from '../slice';
 
 interface Props {
   plugin: string;
@@ -27,5 +27,6 @@ interface Props {
 
 export const ConnectionName = ({ plugin, connectionId }: Props) => {
   const connection = useAppSelector((state) => selectConnection(state, 
`${plugin}-${connectionId}`));
-  return <span>{connection?.name ?? 
`${plugin}/connections/${connectionId}`}</span>;
+  const webhook = useAppSelector((state) => selectWebhook(state, 
connectionId));
+  return <span>{connection ? connection.name : webhook ? webhook.name : 
`${plugin}/connection/${connectionId}`}</span>;
 };
diff --git a/config-ui/src/pages/blueprint/home/index.tsx 
b/config-ui/src/pages/blueprint/home/index.tsx
index 3c78f8e52..0893622a4 100644
--- a/config-ui/src/pages/blueprint/home/index.tsx
+++ b/config-ui/src/pages/blueprint/home/index.tsx
@@ -132,21 +132,25 @@ export const BlueprintHomePage = () => {
                 if (mode === IBPMode.ADVANCED) {
                   return 'Advanced Mode';
                 }
+
+                if (!connections.length) {
+                  return 'N/A';
+                }
+
                 return (
-                  <S.ConnectionList>
+                  <ul>
                     {connections.map((it) => (
                       <li key={`${it.pluginName}-${it.connectionId}`}>
                         <ConnectionName plugin={it.pluginName} 
connectionId={it.connectionId} />
                       </li>
                     ))}
-                  </S.ConnectionList>
+                  </ul>
                 );
               },
             },
             {
               title: 'Frequency',
               key: 'frequency',
-              width: 100,
               render: (_, { isManual, cronConfig }) => {
                 const cron = getCron(isManual, cronConfig);
                 return cron.label;
@@ -155,7 +159,6 @@ export const BlueprintHomePage = () => {
             {
               title: 'Next Run Time',
               key: 'nextRunTime',
-              width: 200,
               render: (_, { isManual, cronConfig }) => {
                 const cron = getCron(isManual, cronConfig);
                 return formatTime(cron.nextTime);
@@ -179,7 +182,6 @@ export const BlueprintHomePage = () => {
               dataIndex: 'enable',
               key: 'enable',
               align: 'center',
-              width: 100,
               render: (val) => (
                 <Tag minimal intent={val ? Intent.SUCCESS : Intent.DANGER}>
                   {val ? 'Enabled' : 'Disabled'}
diff --git a/config-ui/src/pages/blueprint/home/styled.ts 
b/config-ui/src/pages/blueprint/home/styled.ts
index d81cd2b51..99ee9eaf5 100644
--- a/config-ui/src/pages/blueprint/home/styled.ts
+++ b/config-ui/src/pages/blueprint/home/styled.ts
@@ -46,19 +46,3 @@ export const LabelInfo = styled.i`
 export const LabelDescription = styled.p`
   margin: 0;
 `;
-
-export const ConnectionList = styled.ul`
-  display: flex;
-
-  li {
-    &:last-child {
-      &::after {
-        content: '';
-      }
-    }
-
-    &::after {
-      content: ',';
-    }
-  }
-`;
diff --git a/config-ui/src/pages/project/home/index.tsx 
b/config-ui/src/pages/project/home/index.tsx
index 81ffa6b65..a23a39c59 100644
--- a/config-ui/src/pages/project/home/index.tsx
+++ b/config-ui/src/pages/project/home/index.tsx
@@ -145,13 +145,13 @@ export const ProjectHomePage = () => {
               !val || !val.length ? (
                 'N/A'
               ) : (
-                <S.ConnectionList>
+                <ul>
                   {val.map((it) => (
                     <li key={`${it.pluginName}-${it.connectionId}`}>
                       <ConnectionName plugin={it.pluginName} 
connectionId={it.connectionId} />
                     </li>
                   ))}
-                </S.ConnectionList>
+                </ul>
               ),
           },
           {
diff --git a/config-ui/src/pages/project/home/styled.ts 
b/config-ui/src/pages/project/home/styled.ts
index 5e5a50db6..86e2c5568 100644
--- a/config-ui/src/pages/project/home/styled.ts
+++ b/config-ui/src/pages/project/home/styled.ts
@@ -37,19 +37,3 @@ export const LabelInfo = styled.i`
 export const LabelDescription = styled.p`
   margin: 0;
 `;
-
-export const ConnectionList = styled.ul`
-  display: flex;
-
-  li {
-    &:last-child {
-      &::after {
-        content: '';
-      }
-    }
-
-    &::after {
-      content: ',';
-    }
-  }
-`;

Reply via email to