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

likyh 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 da40c9241 fix(config-ui): test fails after introducing jira bearer 
authentication (#4354)
da40c9241 is described below

commit da40c9241e1b2244b073b1d5a42bbbe0d12de82a
Author: 青湛 <[email protected]>
AuthorDate: Wed Feb 8 22:11:17 2023 +0800

    fix(config-ui): test fails after introducing jira bearer authentication 
(#4354)
---
 config-ui/src/pages/connection/form/index.tsx        | 6 +++---
 config-ui/src/store/connections/api.ts               | 1 +
 config-ui/src/store/connections/types.ts             | 1 +
 config-ui/src/store/connections/use-context-value.ts | 4 +++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/config-ui/src/pages/connection/form/index.tsx 
b/config-ui/src/pages/connection/form/index.tsx
index 630c36ce2..dfb34be7b 100644
--- a/config-ui/src/pages/connection/form/index.tsx
+++ b/config-ui/src/pages/connection/form/index.tsx
@@ -52,16 +52,16 @@ export const ConnectionFormPage = () => {
 
   const error = useMemo(
     () =>
-      fields.every((field) => {
+      fields.some((field) => {
         if (field.required) {
-          return !!form[field.key];
+          return !form[field.key];
         }
 
         if (field.checkError) {
           return !field.checkError(form);
         }
 
-        return true;
+        return false;
       }),
     [form, fields],
   );
diff --git a/config-ui/src/store/connections/api.ts 
b/config-ui/src/store/connections/api.ts
index 9e62cb8d5..5b7b7acde 100644
--- a/config-ui/src/store/connections/api.ts
+++ b/config-ui/src/store/connections/api.ts
@@ -24,6 +24,7 @@ type TestConnectionPayload = {
   token?: string;
   username?: string;
   password?: string;
+  authMethod?: string;
 };
 
 export const getConnection = (plugin: string) => 
request(`/plugins/${plugin}/connections`);
diff --git a/config-ui/src/store/connections/types.ts 
b/config-ui/src/store/connections/types.ts
index 7e23be1d6..f9c543b7d 100644
--- a/config-ui/src/store/connections/types.ts
+++ b/config-ui/src/store/connections/types.ts
@@ -36,4 +36,5 @@ export type ConnectionItemType = {
   token?: string;
   username?: string;
   password?: string;
+  authMethod?: string;
 };
diff --git a/config-ui/src/store/connections/use-context-value.ts 
b/config-ui/src/store/connections/use-context-value.ts
index b978471cc..4c31ec576 100644
--- a/config-ui/src/store/connections/use-context-value.ts
+++ b/config-ui/src/store/connections/use-context-value.ts
@@ -82,6 +82,7 @@ export const useContextValue = ({ plugin, filterBeta = false 
}: UseContextValueP
         token: it.token,
         username: it.username,
         password: it.password,
+        authMethod: it.authMethod,
       })),
     );
 
@@ -105,7 +106,7 @@ export const useContextValue = ({ plugin, filterBeta = 
false }: UseContextValueP
         ),
       );
 
-      const { plugin, endpoint, proxy, token, username, password } = 
selectedConnection;
+      const { plugin, endpoint, proxy, token, username, password, authMethod } 
= selectedConnection;
 
       let status = ConnectionStatusEnum.OFFLINE;
 
@@ -116,6 +117,7 @@ export const useContextValue = ({ plugin, filterBeta = 
false }: UseContextValueP
           token,
           username,
           password,
+          authMethod,
         });
         status = res.success ? ConnectionStatusEnum.ONLINE : 
ConnectionStatusEnum.OFFLINE;
       } catch {

Reply via email to