You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/04/26 14:50:46 UTC

(incubator-devlake) 01/01: fix: expand click area for add new connection

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

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

commit cf7fd1f436dd8b95057fa2fe1bd57b26f049a180
Author: mintsweet <0x...@gmail.com>
AuthorDate: Fri Apr 26 22:50:30 2024 +0800

    fix: expand click area for add new connection
---
 .../detail/components/add-connection-dialog/index.tsx         | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/config-ui/src/routes/blueprint/detail/components/add-connection-dialog/index.tsx b/config-ui/src/routes/blueprint/detail/components/add-connection-dialog/index.tsx
index 000032fe6..28137d78d 100644
--- a/config-ui/src/routes/blueprint/detail/components/add-connection-dialog/index.tsx
+++ b/config-ui/src/routes/blueprint/detail/components/add-connection-dialog/index.tsx
@@ -68,7 +68,7 @@ export const AddConnectionDialog = ({ disabled = [], onCancel, onSubmit }: Props
 
   const options = useMemo(
     () =>
-      [{}].concat(
+      [{ value: '' }].concat(
         connections
           .filter((cs) => (disabled.length ? !disabled.includes(cs.unique) : true))
           .map((cs) => ({
@@ -110,7 +110,7 @@ export const AddConnectionDialog = ({ disabled = [], onCancel, onSubmit }: Props
               optionRender={(option, { index }) => {
                 if (index === 0) {
                   return (
-                    <Button size="small" type="link" icon={<PlusOutlined />} onClick={() => navigate('/connections')}>
+                    <Button size="small" type="link" icon={<PlusOutlined />}>
                       Add New Connection
                     </Button>
                   );
@@ -121,7 +121,12 @@ export const AddConnectionDialog = ({ disabled = [], onCancel, onSubmit }: Props
                   </Option>
                 );
               }}
-              onChange={(value) => setSelectedValue(value)}
+              onChange={(value) => {
+                if (!value) {
+                  navigate('/connections');
+                }
+                setSelectedValue(value);
+              }}
             />
           </Block>
           <Space style={{ display: 'flex', justifyContent: 'flex-end' }}>