You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2023/10/30 06:29:35 UTC

(incubator-devlake) branch main updated: fix(config-ui): some bugs (#6339)

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

klesh 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 743d122b5 fix(config-ui): some bugs (#6339)
743d122b5 is described below

commit 743d122b546f02f0b958be752b9c55b6a207fb9f
Author: 青湛 <0x...@gmail.com>
AuthorDate: Mon Oct 30 19:29:31 2023 +1300

    fix(config-ui): some bugs (#6339)
    
    * fix(config-ui): adjust the copywriting for collect data
    
    * fix(config-ui): the helptooltip error for bamboo transformation
    
    * fix(config-ui): change icon for webhook view
    
    * feat(config-ui): support placeholder in data scope search
    
    * fix(config-ui): disabled scope config save btn when has error
---
 config-ui/src/pages/blueprint/detail/status-panel.tsx         |  4 ++--
 .../plugins/components/data-scope-remote/search-remote.tsx    |  1 +
 config-ui/src/plugins/components/scope-config-form/index.tsx  | 11 ++++++++++-
 config-ui/src/plugins/register/bamboo/transformation.tsx      |  2 +-
 config-ui/src/plugins/register/bitbucket/config.tsx           |  1 +
 config-ui/src/plugins/register/github/transformation.tsx      |  7 ++++++-
 config-ui/src/plugins/register/gitlab/config.tsx              |  1 +
 config-ui/src/plugins/register/gitlab/transformation.tsx      |  7 ++++++-
 config-ui/src/plugins/register/webhook/connection.tsx         |  2 +-
 config-ui/src/types/plugin.ts                                 |  1 +
 10 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/config-ui/src/pages/blueprint/detail/status-panel.tsx b/config-ui/src/pages/blueprint/detail/status-panel.tsx
index 018a0de78..38c4a2456 100644
--- a/config-ui/src/pages/blueprint/detail/status-panel.tsx
+++ b/config-ui/src/pages/blueprint/detail/status-panel.tsx
@@ -143,13 +143,13 @@ export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props) =
             disabled={!blueprint.enable}
             loading={operating}
             intent={Intent.PRIMARY}
-            text="Collect All Data"
+            text="Collect Data"
             onClick={() => handleRun({})}
           />
           <Popover
             content={
               <Menu>
-                <MenuItem text="Collect All Data in Full Sync Mode" onClick={() => setType('fullSync')} />
+                <MenuItem text="Collect All Data in Full Refresh Mode" onClick={() => setType('fullSync')} />
               </Menu>
             }
             placement="bottom"
diff --git a/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
index eb5777c5f..a543abafd 100644
--- a/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
+++ b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
@@ -138,6 +138,7 @@ export const SearchRemote = ({ plugin, connectionId, config, disabledScope, sele
       <FormItem>
         <InputGroup
           leftIcon="search"
+          placeholder={config.searchPlaceholder}
           value={search.query}
           onChange={(e) => setSearch({ ...search, query: e.target.value })}
         />
diff --git a/config-ui/src/plugins/components/scope-config-form/index.tsx b/config-ui/src/plugins/components/scope-config-form/index.tsx
index a8aa0a028..757d3eac0 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -62,6 +62,7 @@ export const ScopeConfigForm = ({
   const [entities, setEntities] = useState<string[]>([]);
   const [transformation, setTransformation] = useState<any>({});
   const [hasRefDiff, setHasRefDiff] = useState(false);
+  const [hasError, setHasError] = useState(false);
   const [operating, setOperating] = useState(false);
 
   const config = useMemo(() => getPluginConfig(plugin), []);
@@ -187,6 +188,7 @@ export const ScopeConfigForm = ({
                 entities={entities}
                 transformation={transformation}
                 setTransformation={setTransformation}
+                setHasError={setHasError}
               />
             )}
 
@@ -204,6 +206,7 @@ export const ScopeConfigForm = ({
                 entities={entities}
                 transformation={transformation}
                 setTransformation={setTransformation}
+                setHasError={setHasError}
               />
             )}
 
@@ -253,7 +256,13 @@ export const ScopeConfigForm = ({
           </Card>
           <Buttons position="bottom" align="right">
             <Button outlined intent={Intent.PRIMARY} text="Prev" onClick={handlePrevStep} />
-            <Button loading={operating} intent={Intent.PRIMARY} text="Save" onClick={handleSubmit} />
+            <Button
+              loading={operating}
+              disabled={hasError}
+              intent={Intent.PRIMARY}
+              text="Save"
+              onClick={handleSubmit}
+            />
           </Buttons>
         </>
       )}
diff --git a/config-ui/src/plugins/register/bamboo/transformation.tsx b/config-ui/src/plugins/register/bamboo/transformation.tsx
index 8bac35bf5..fc04d528e 100644
--- a/config-ui/src/plugins/register/bamboo/transformation.tsx
+++ b/config-ui/src/plugins/register/bamboo/transformation.tsx
@@ -110,7 +110,7 @@ export const BambooTransformation = ({ entities, transformation, setTransformati
               }
             />
             <span>.</span>
-            <HelpTooltip content="View your BitBucket Pipelines: https://support.atlassian.com/bitbucket-cloud/docs/view-your-pipeline/" />
+            <HelpTooltip content="View your Bamboo Builds: https://confluence.atlassian.com/bamboo/viewing-a-plan-s-build-information-289276861.html" />
           </div>
           <div className="sub-text">
             <span>If the name also matches</span>
diff --git a/config-ui/src/plugins/register/bitbucket/config.tsx b/config-ui/src/plugins/register/bitbucket/config.tsx
index 77131b890..31bf6b086 100644
--- a/config-ui/src/plugins/register/bitbucket/config.tsx
+++ b/config-ui/src/plugins/register/bitbucket/config.tsx
@@ -57,6 +57,7 @@ export const BitBucketConfig = {
     ],
   },
   dataScope: {
+    searchPlaceholder: 'Enter the keywords to search for repositories that you have read access',
     title: 'Repositories',
     millerColumn: {
       columnCount: 2,
diff --git a/config-ui/src/plugins/register/github/transformation.tsx b/config-ui/src/plugins/register/github/transformation.tsx
index 93a184fd1..da0279c65 100644
--- a/config-ui/src/plugins/register/github/transformation.tsx
+++ b/config-ui/src/plugins/register/github/transformation.tsx
@@ -28,9 +28,10 @@ interface Props {
   entities: string[];
   transformation: any;
   setTransformation: React.Dispatch<React.SetStateAction<any>>;
+  setHasError: React.Dispatch<React.SetStateAction<boolean>>;
 }
 
-export const GitHubTransformation = ({ entities, transformation, setTransformation }: Props) => {
+export const GitHubTransformation = ({ entities, transformation, setTransformation, setHasError }: Props) => {
   const [useCustom, setUseCustom] = useState(false);
 
   useEffect(() => {
@@ -41,6 +42,10 @@ export const GitHubTransformation = ({ entities, transformation, setTransformati
     }
   }, [transformation]);
 
+  useEffect(() => {
+    setHasError(useCustom && !transformation.deploymentPattern);
+  }, [useCustom, transformation]);
+
   const handleChangeUseCustom = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
 
diff --git a/config-ui/src/plugins/register/gitlab/config.tsx b/config-ui/src/plugins/register/gitlab/config.tsx
index d9ab98283..7a398b46a 100644
--- a/config-ui/src/plugins/register/gitlab/config.tsx
+++ b/config-ui/src/plugins/register/gitlab/config.tsx
@@ -64,6 +64,7 @@ export const GitLabConfig = {
     ],
   },
   dataScope: {
+    searchPlaceholder: 'Please enter at least 3 characters to search',
     title: 'Projects',
     millerColumn: {
       columnCount: 2.5,
diff --git a/config-ui/src/plugins/register/gitlab/transformation.tsx b/config-ui/src/plugins/register/gitlab/transformation.tsx
index e2505030e..217d1853d 100644
--- a/config-ui/src/plugins/register/gitlab/transformation.tsx
+++ b/config-ui/src/plugins/register/gitlab/transformation.tsx
@@ -28,9 +28,10 @@ interface Props {
   entities: string[];
   transformation: any;
   setTransformation: React.Dispatch<React.SetStateAction<any>>;
+  setHasError: React.Dispatch<React.SetStateAction<boolean>>;
 }
 
-export const GitLabTransformation = ({ entities, transformation, setTransformation }: Props) => {
+export const GitLabTransformation = ({ entities, transformation, setTransformation, setHasError }: Props) => {
   const [useCustom, setUseCustom] = useState(false);
 
   useEffect(() => {
@@ -41,6 +42,10 @@ export const GitLabTransformation = ({ entities, transformation, setTransformati
     }
   }, [transformation]);
 
+  useEffect(() => {
+    setHasError(useCustom && !transformation.deploymentPattern);
+  }, [useCustom, transformation]);
+
   const handleChangeUseCustom = (e: React.FormEvent<HTMLInputElement>) => {
     const checked = (e.target as HTMLInputElement).checked;
 
diff --git a/config-ui/src/plugins/register/webhook/connection.tsx b/config-ui/src/plugins/register/webhook/connection.tsx
index 2a6f1a011..cdb8660e4 100644
--- a/config-ui/src/plugins/register/webhook/connection.tsx
+++ b/config-ui/src/plugins/register/webhook/connection.tsx
@@ -72,7 +72,7 @@ export const WebHookConnection = ({ filterIds, onCreateAfter, onDeleteAfter }: P
       align: 'center',
       render: (_, row) => (
         <S.Action>
-          <IconButton icon="array" tooltip="View" onClick={() => handleShowDialog('show', row)} />
+          <IconButton icon="eye-open" tooltip="View" onClick={() => handleShowDialog('show', row)} />
           <IconButton icon="annotation" tooltip="Edit" onClick={() => handleShowDialog('edit', row)} />
           <IconButton icon="trash" tooltip="Delete" onClick={() => handleShowDialog('delete', row)} />
         </S.Action>
diff --git a/config-ui/src/types/plugin.ts b/config-ui/src/types/plugin.ts
index e9153666e..141781e2f 100644
--- a/config-ui/src/types/plugin.ts
+++ b/config-ui/src/types/plugin.ts
@@ -29,6 +29,7 @@ export interface IPluginConfig {
   };
   dataScope: {
     localSearch?: boolean;
+    searchPlaceholder?: string;
     title?: string;
     millerColumn?: {
       columnCount?: number;