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/05/08 07:33:47 UTC

(incubator-devlake) branch fix-scope-config created (now 7e1d29658)

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

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


      at 7e1d29658 fix: some bugs for scope config

This branch includes the following new commits:

     new 7e1d29658 fix: some bugs for scope config

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix: some bugs for scope config

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7e1d296586a72f31fce54086fc1969b4d656c96b
Author: mintsweet <0x...@gmail.com>
AuthorDate: Wed May 8 19:33:30 2024 +1200

    fix: some bugs for scope config
---
 config-ui/src/plugins/components/scope-config-select/index.tsx | 3 +++
 config-ui/src/routes/connection/connection.tsx                 | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/config-ui/src/plugins/components/scope-config-select/index.tsx b/config-ui/src/plugins/components/scope-config-select/index.tsx
index dfc37a163..a56a96b89 100644
--- a/config-ui/src/plugins/components/scope-config-select/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-select/index.tsx
@@ -45,6 +45,8 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
     [data, scopeConfigId],
   );
 
+  const defaultName = useMemo(() => `shared-config-<${(data ?? []).length}>`, [data]);
+
   useEffect(() => {
     setTrId(scopeConfigId);
   }, [scopeConfigId]);
@@ -103,6 +105,7 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
         <ScopeConfigForm
           plugin={plugin}
           connectionId={connectionId}
+          defaultName={defaultName}
           onCancel={handleHideDialog}
           onSubmit={handleSubmit}
         />
diff --git a/config-ui/src/routes/connection/connection.tsx b/config-ui/src/routes/connection/connection.tsx
index ba6d5d66a..fab7ff6a4 100644
--- a/config-ui/src/routes/connection/connection.tsx
+++ b/config-ui/src/routes/connection/connection.tsx
@@ -232,12 +232,18 @@ export const Connection = () => {
 
   const handleScopeConfigChange = async (scopeConfigId?: ID) => {
     if (!scopeConfigId) {
+      setVersion(version + 1);
       return;
     }
 
     const [success, res] = await operator(() => API.scopeConfig.check(plugin, scopeConfigId), { hideToast: true });
 
     if (success) {
+      if (!res.projects) {
+        setVersion(version + 1);
+        return;
+      }
+
       modal.success({
         closable: true,
         centered: true,
@@ -250,7 +256,7 @@ export const Connection = () => {
             </div>
             <ul>
               {res.projects.map((it: any) => (
-                <li style={{ marginBottom: 10 }}>
+                <li key={it.name} style={{ marginBottom: 10 }}>
                   <Space>
                     <span>{it.name}</span>
                     <Button