You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/02/21 12:13:09 UTC

[incubator-devlake] branch main updated: fix(config-ui): adjust the plugin config for tapd (#4474)

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 86db4ca22 fix(config-ui): adjust the plugin config for tapd (#4474)
86db4ca22 is described below

commit 86db4ca22593b4117cddce57ff44e67b451213db
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Feb 21 20:13:05 2023 +0800

    fix(config-ui): adjust the plugin config for tapd (#4474)
---
 .../components/connection-form/fields/password.tsx | 20 ++++++++++++++---
 .../components/connection-form/fields/username.tsx | 21 ++++++++++++++---
 .../register/tapd/{config.ts => config.tsx}        | 26 +++++++++++++++++++---
 3 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/config-ui/src/plugins/components/connection-form/fields/password.tsx b/config-ui/src/plugins/components/connection-form/fields/password.tsx
index 6be3ed07d..fc823a196 100644
--- a/config-ui/src/plugins/components/connection-form/fields/password.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/password.tsx
@@ -40,6 +40,8 @@ import * as S from './styled';
 
 interface Props {
   label?: string;
+  subLabel?: string;
+  placeholder?: string;
   name: string;
   initialValue: string;
   value: string;
@@ -48,7 +50,15 @@ interface Props {
   setError: (value: string) => void;
 }
 
-export const ConnectionPassword = ({ label, initialValue, value, setValue, setError }: Props) => {
+export const ConnectionPassword = ({
+  label,
+  subLabel,
+  placeholder,
+  initialValue,
+  value,
+  setValue,
+  setError,
+}: Props) => {
   useEffect(() => {
     setValue(initialValue);
   }, [initialValue]);
@@ -62,8 +72,12 @@ export const ConnectionPassword = ({ label, initialValue, value, setValue, setEr
   };
 
   return (
-    <FormGroup label={<S.Label>{label ?? 'Password'}</S.Label>} labelInfo={<S.LabelInfo>*</S.LabelInfo>}>
-      <InputGroup type="password" placeholder="Your Password" value={value} onChange={handleChange} />
+    <FormGroup
+      label={<S.Label>{label ?? 'Password'}</S.Label>}
+      labelInfo={<S.LabelInfo>*</S.LabelInfo>}
+      subLabel={subLabel ? <S.LabelDescription>{subLabel}</S.LabelDescription> : null}
+    >
+      <InputGroup type="password" placeholder={placeholder ?? 'Your Password'} value={value} onChange={handleChange} />
     </FormGroup>
   );
 };
diff --git a/config-ui/src/plugins/components/connection-form/fields/username.tsx b/config-ui/src/plugins/components/connection-form/fields/username.tsx
index 9389fe292..0487e8203 100644
--- a/config-ui/src/plugins/components/connection-form/fields/username.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/username.tsx
@@ -39,6 +39,9 @@ import { FormGroup, InputGroup } from '@blueprintjs/core';
 import * as S from './styled';
 
 interface Props {
+  label?: string;
+  subLabel?: string;
+  placeholder?: string;
   name: string;
   initialValue: string;
   value: string;
@@ -47,7 +50,15 @@ interface Props {
   setError: (error: string) => void;
 }
 
-export const ConnectionUsername = ({ initialValue, value, setValue, setError }: Props) => {
+export const ConnectionUsername = ({
+  label,
+  subLabel,
+  placeholder,
+  initialValue,
+  value,
+  setValue,
+  setError,
+}: Props) => {
   useEffect(() => {
     setValue(initialValue);
   }, [initialValue]);
@@ -61,8 +72,12 @@ export const ConnectionUsername = ({ initialValue, value, setValue, setError }:
   };
 
   return (
-    <FormGroup label={<S.Label>Username</S.Label>} labelInfo={<S.LabelInfo>*</S.LabelInfo>}>
-      <InputGroup placeholder="Your Username" value={value} onChange={handleChange} />
+    <FormGroup
+      label={<S.Label>{label ?? 'Username'}</S.Label>}
+      labelInfo={<S.LabelInfo>*</S.LabelInfo>}
+      subLabel={subLabel ? <S.LabelDescription>{subLabel}</S.LabelDescription> : null}
+    >
+      <InputGroup placeholder={placeholder ?? 'Your Username'} value={value} onChange={handleChange} />
     </FormGroup>
   );
 };
diff --git a/config-ui/src/plugins/register/tapd/config.ts b/config-ui/src/plugins/register/tapd/config.tsx
similarity index 75%
rename from config-ui/src/plugins/register/tapd/config.ts
rename to config-ui/src/plugins/register/tapd/config.tsx
index cd71b7fc8..e0e95dcce 100644
--- a/config-ui/src/plugins/register/tapd/config.ts
+++ b/config-ui/src/plugins/register/tapd/config.tsx
@@ -16,6 +16,9 @@
  *
  */
 
+import React from 'react';
+
+import { ExternalLink } from '@/components';
 import type { PluginConfigType } from '@/plugins';
 import { PluginType } from '@/plugins';
 
@@ -27,7 +30,7 @@ export const TAPDConfig: PluginConfigType = {
   name: 'TAPD',
   isBeta: true,
   icon: Icon,
-  sort: 100,
+  sort: 6,
   connection: {
     docLink: 'https://devlake.apache.org/docs/Configuration/Tapd',
     initialValues: {
@@ -40,8 +43,25 @@ export const TAPDConfig: PluginConfigType = {
         subLabel: 'You do not need to enter the endpoint URL, because all versions use the same URL.',
         disabled: true,
       },
-      'username',
-      'password',
+      {
+        key: 'username',
+        label: 'API Account',
+        subLabel: (
+          <span>
+            Please follow the instruction{' '}
+            <ExternalLink link="https://devlake.apache.org/docs/UserManuals/ConfigUI/Tapd/#api-account--api-token">
+              here
+            </ExternalLink>{' '}
+            to find your API account information.
+          </span>
+        ),
+        placeholder: 'Your API Account',
+      },
+      {
+        key: 'password',
+        label: 'API Token',
+        placeholder: 'Your API Token',
+      },
       'proxy',
       {
         key: 'rateLimitPerHour',