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 f0e458f39 feat(config-ui): use new data-scope-remote to replace old 
one (#6140)
f0e458f39 is described below

commit f0e458f3953587b2badc6754761cab7cac8e5ab7
Author: 青湛 <[email protected]>
AuthorDate: Wed Sep 27 16:15:35 2023 +1300

    feat(config-ui): use new data-scope-remote to replace old one (#6140)
    
    * feat(config-ui): use new data-scope-remote to replace old one
    
    * refactor(config-ui): adjust the plugin config
---
 config-ui/src/pages/connection/detail/index.tsx    |  4 +-
 .../api.ts                                         |  0
 .../data-scope-remote/data-scope-remote.tsx        | 99 ++++++++++++++++++++++
 .../styled.ts => data-scope-remote/index.ts}       |  9 +-
 .../data-scope-remote/search-local.tsx}            | 64 +++++++-------
 .../search-remote.tsx}                             | 96 ++++-----------------
 .../styled.ts                                      | 10 +++
 .../types.ts                                       |  0
 config-ui/src/plugins/components/index.ts          |  2 +-
 config-ui/src/plugins/register/azure/config.tsx    |  4 +
 .../src/plugins/register/bitbucket/config.tsx      |  4 +-
 config-ui/src/plugins/register/github/config.tsx   |  6 +-
 config-ui/src/plugins/register/gitlab/config.tsx   |  6 +-
 .../register/jenkins/{config.tsx => config.ts}     |  7 +-
 config-ui/src/plugins/register/tapd/data-scope.tsx |  4 +-
 config-ui/src/plugins/register/zentao/config.tsx   |  5 +-
 config-ui/src/plugins/types.ts                     |  7 +-
 17 files changed, 194 insertions(+), 133 deletions(-)

diff --git a/config-ui/src/pages/connection/detail/index.tsx 
b/config-ui/src/pages/connection/detail/index.tsx
index 10b6eaf46..3eb902f93 100644
--- a/config-ui/src/pages/connection/detail/index.tsx
+++ b/config-ui/src/pages/connection/detail/index.tsx
@@ -26,7 +26,7 @@ import ClearImg from '@/images/icons/clear.svg';
 import {
   ConnectionForm,
   ConnectionStatus,
-  DataScopeSelectRemote,
+  DataScopeRemote,
   getPluginConfig,
   getPluginScopeId,
   ScopeConfigForm,
@@ -395,7 +395,7 @@ const ConnectionDetail = ({ plugin, connectionId }: Props) 
=> {
           }
           onCancel={handleHideDialog}
         >
-          <DataScopeSelectRemote
+          <DataScopeRemote
             plugin={plugin}
             connectionId={connectionId}
             disabledScope={dataSource}
diff --git a/config-ui/src/plugins/components/data-scope-select-remote/api.ts 
b/config-ui/src/plugins/components/data-scope-remote/api.ts
similarity index 100%
rename from config-ui/src/plugins/components/data-scope-select-remote/api.ts
rename to config-ui/src/plugins/components/data-scope-remote/api.ts
diff --git 
a/config-ui/src/plugins/components/data-scope-remote/data-scope-remote.tsx 
b/config-ui/src/plugins/components/data-scope-remote/data-scope-remote.tsx
new file mode 100644
index 000000000..fc42fc201
--- /dev/null
+++ b/config-ui/src/plugins/components/data-scope-remote/data-scope-remote.tsx
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import { useState, useMemo } from 'react';
+import { Button, Intent } from '@blueprintjs/core';
+
+import { Buttons } from '@/components';
+import { getPluginConfig, getPluginScopeId } from '@/plugins';
+import { operator } from '@/utils';
+
+import { SearchLocal } from './search-local';
+import { SearchRemote } from './search-remote';
+import * as API from './api';
+
+interface Props {
+  plugin: string;
+  connectionId: ID;
+  disabledScope?: any[];
+  onCancel: () => void;
+  onSubmit: (origin: any) => void;
+}
+
+export const DataScopeRemote = ({ plugin, connectionId, disabledScope, 
onCancel, onSubmit }: Props) => {
+  const [selectedScope, setSelectedScope] = useState<any[]>([]);
+  const [operating, setOperating] = useState(false);
+
+  const config = useMemo(() => getPluginConfig(plugin).dataScope, [plugin]);
+
+  const handleSubmit = async () => {
+    const [success, res] = await operator(
+      () => API.updateDataScope(plugin, connectionId, { data: 
selectedScope.map((it) => it.data) }),
+      {
+        setOperating,
+        formatMessage: () => 'Add data scope successful.',
+      },
+    );
+
+    if (success) {
+      onSubmit(res);
+    }
+  };
+
+  return (
+    <>
+      {config.render ? (
+        config.render({
+          connectionId,
+          disabledItems: disabledScope?.map((it) => ({ id: 
getPluginScopeId(plugin, it) })),
+          selectedItems: selectedScope,
+          onChangeSelectedItems: setSelectedScope,
+        })
+      ) : config.localSearch ? (
+        <SearchLocal
+          plugin={plugin}
+          connectionId={connectionId}
+          config={config}
+          disabledScope={disabledScope ?? []}
+          selectedScope={selectedScope}
+          onChange={setSelectedScope}
+        />
+      ) : (
+        <SearchRemote
+          plugin={plugin}
+          connectionId={connectionId}
+          config={config}
+          disabledScope={disabledScope ?? []}
+          selectedScope={selectedScope}
+          onChange={setSelectedScope}
+        />
+      )}
+      <Buttons position="bottom" align="right">
+        <Button outlined intent={Intent.PRIMARY} text="Cancel" 
disabled={operating} onClick={onCancel} />
+        <Button
+          outlined
+          intent={Intent.PRIMARY}
+          text="Save"
+          loading={operating}
+          disabled={!selectedScope.length}
+          onClick={handleSubmit}
+        />
+      </Buttons>
+    </>
+  );
+};
diff --git 
a/config-ui/src/plugins/components/data-scope-select-remote/styled.ts 
b/config-ui/src/plugins/components/data-scope-remote/index.ts
similarity index 83%
copy from config-ui/src/plugins/components/data-scope-select-remote/styled.ts
copy to config-ui/src/plugins/components/data-scope-remote/index.ts
index 41e76ecb3..cf89ce70e 100644
--- a/config-ui/src/plugins/components/data-scope-select-remote/styled.ts
+++ b/config-ui/src/plugins/components/data-scope-remote/index.ts
@@ -16,11 +16,4 @@
  *
  */
 
-import styled from 'styled-components';
-
-export const Wrapper = styled.div``;
-
-export const ColumnTitle = styled.div`
-  padding: 6px 12px;
-  font-weight: 600;
-`;
+export * from './data-scope-remote';
diff --git a/config-ui/src/plugins/register/jenkins/data-scope.tsx 
b/config-ui/src/plugins/components/data-scope-remote/search-local.tsx
similarity index 79%
rename from config-ui/src/plugins/register/jenkins/data-scope.tsx
rename to config-ui/src/plugins/components/data-scope-remote/search-local.tsx
index ba147901b..3bbb49827 100644
--- a/config-ui/src/plugins/register/jenkins/data-scope.tsx
+++ b/config-ui/src/plugins/components/data-scope-remote/search-local.tsx
@@ -18,26 +18,29 @@
 
 import { useState, useEffect, useMemo } from 'react';
 import { Button, InputGroup, Icon, Intent } from '@blueprintjs/core';
-import type { McsID, McsItem } from 'miller-columns-select';
+import type { McsID, McsItem, McsColumn } from 'miller-columns-select';
 import { MillerColumnsSelect } from 'miller-columns-select';
 import { useDebounce } from 'ahooks';
 
 import { FormItem, MultiSelector, Loading, Dialog, Message } from 
'@/components';
-import * as T from '@/plugins/components/data-scope-select-remote/types';
-import * as API from '@/plugins/components/data-scope-select-remote/api';
+import { PluginConfigType } from '@/plugins';
 
+import * as T from './types';
+import * as API from './api';
 import * as S from './styled';
 
 interface Props {
+  plugin: string;
   connectionId: ID;
-  disabledItems: T.ResItem[];
-  selectedItems: T.ResItem[];
-  onChangeSelectedItems: (items: T.ResItem[]) => void;
+  config: PluginConfigType['dataScope'];
+  disabledScope: any[];
+  selectedScope: any[];
+  onChange: (selectedScope: any[]) => void;
 }
 
 let canceling = false;
 
-export const DataScope = ({ connectionId, selectedItems, onChangeSelectedItems 
}: Props) => {
+export const SearchLocal = ({ plugin, connectionId, config, disabledScope, 
selectedScope, onChange }: Props) => {
   const [miller, setMiller] = useState<{
     items: McsItem<T.ResItem>[];
     loadedIds: ID[];
@@ -56,7 +59,7 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
   const [query, setQuery] = useState('');
   const search = useDebounce(query, { wait: 500 });
 
-  const jobs = useMemo(
+  const scopes = useMemo(
     () =>
       search
         ? miller.items
@@ -85,7 +88,7 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
       return;
     }
 
-    const res = await API.getRemoteScope('jenkins', connectionId, {
+    const res = await API.getRemoteScope(plugin, connectionId, {
       groupId,
       pageToken: currentPageToken,
     });
@@ -138,7 +141,7 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
     }
   }, [miller]);
 
-  const handleLoadAllJobs = async () => {
+  const handleLoadAllScopes = async () => {
     setIsOpen(false);
     setStatus('loading');
 
@@ -162,33 +165,33 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
     }
   };
 
-  const handleCancelLoadAllJobs = () => {
+  const handleCancelLoadAllScopes = () => {
     setStatus('cancel');
     canceling = true;
   };
 
   return (
-    <S.DataScope>
-      <FormItem label="Jobs" required>
+    <S.Wrapper>
+      <FormItem label={config.title} required>
         <MultiSelector
           disabled
-          items={selectedItems}
+          items={selectedScope}
           getKey={(it) => it.id}
           getName={(it) => it.fullName}
-          selectedItems={selectedItems}
+          selectedItems={selectedScope}
         />
       </FormItem>
       <FormItem>
         {(status === 'loading' || status === 'cancel') && (
           <S.JobLoad>
             <Loading style={{ marginRight: 8 }} size={20} />
-            Loading: <span className="count">{miller.items.length}</span> jobs 
found
+            Loading: <span className="count">{miller.items.length}</span> 
scopes found
             <Button
               style={{ marginLeft: 8 }}
               loading={status === 'cancel'}
               small
               text="Cancel"
-              onClick={handleCancelLoadAllJobs}
+              onClick={handleCancelLoadAllScopes}
             />
           </S.JobLoad>
         )}
@@ -196,7 +199,7 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
         {status === 'loaded' && (
           <S.JobLoad>
             <Icon icon="endorsed" style={{ color: '#4DB764' }} />
-            <span className="count">{miller.items.length}</span> jobs found
+            <span className="count">{miller.items.length}</span> scopes found
           </S.JobLoad>
         )}
 
@@ -205,7 +208,7 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
             <Button
               disabled={!miller.items.length}
               intent={Intent.PRIMARY}
-              text="Load all jobs to search by keywords"
+              text="Load all scopes to search by keywords"
               onClick={() => setIsOpen(true)}
             />
           </S.JobLoad>
@@ -216,8 +219,8 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
           <InputGroup leftIcon="search" value={query} onChange={(e) => 
setQuery(e.target.value)} />
         )}
         <MillerColumnsSelect
-          items={jobs}
-          columnCount={search ? 1 : 2.5}
+          items={scopes}
+          columnCount={search ? 1 : config.millerColumn?.columnCount ?? 1}
           columnHeight={300}
           getCanExpand={(it) => it.type === 'group'}
           getHasMore={(id) => !miller.loadedIds.includes(id ?? 'root')}
@@ -225,18 +228,21 @@ export const DataScope = ({ connectionId, selectedItems, 
onChangeSelectedItems }
           onScroll={(id: McsID | null) =>
             getItems({ groupId: id, currentPageToken: miller.nextTokenMap[id 
?? 'root'] })
           }
-          renderLoading={() => <Loading size={20} style={{ padding: '4px 12px' 
}} />}
-          selectedIds={selectedItems.map((it) => it.id)}
-          onSelectItemIds={(selectedIds: ID[]) =>
-            onChangeSelectedItems(miller.items.filter((it) => 
selectedIds.includes(it.id)))
+          renderTitle={(column: McsColumn) =>
+            !column.parentId &&
+            config.millerColumn?.firstColumnTitle && (
+              
<S.ColumnTitle>{config.millerColumn.firstColumnTitle}</S.ColumnTitle>
+            )
           }
+          renderLoading={() => <Loading size={20} style={{ padding: '4px 12px' 
}} />}
+          selectedIds={selectedScope.map((it) => it.id)}
+          onSelectItemIds={(selectedIds: ID[]) => 
onChange(miller.items.filter((it) => selectedIds.includes(it.id)))}
           expandedIds={miller.expandedIds}
-          // onChangeExpandedIds={(expandedIds: ID[]) => 
setExpandedIds(expandedIds)}
         />
       </FormItem>
-      <Dialog isOpen={isOpen} okText="Load" onCancel={() => setIsOpen(false)} 
onOk={handleLoadAllJobs}>
-        <Message content="This operation may take a long time, as it iterates 
through all the Jenkins Jobs." />
+      <Dialog isOpen={isOpen} okText="Load" onCancel={() => setIsOpen(false)} 
onOk={handleLoadAllScopes}>
+        <Message content={`This operation may take a long time, as it iterates 
through all the ${config.title}.`} />
       </Dialog>
-    </S.DataScope>
+    </S.Wrapper>
   );
 };
diff --git 
a/config-ui/src/plugins/components/data-scope-select-remote/index.tsx 
b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
similarity index 64%
rename from config-ui/src/plugins/components/data-scope-select-remote/index.tsx
rename to config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
index 5be9d3fd4..60f6255e5 100644
--- a/config-ui/src/plugins/components/data-scope-select-remote/index.tsx
+++ b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
@@ -17,15 +17,14 @@
  */
 
 import { useEffect, useMemo, useState } from 'react';
-import { Button, Intent, InputGroup } from '@blueprintjs/core';
+import { InputGroup } from '@blueprintjs/core';
 import type { McsID, McsItem, McsColumn } from 'miller-columns-select';
 import MillerColumnsSelect from 'miller-columns-select';
 import { useDebounce } from 'ahooks';
 import { uniqBy } from 'lodash';
 
-import { FormItem, MultiSelector, Loading, Buttons } from '@/components';
-import { getPluginConfig, getPluginScopeId } from '@/plugins';
-import { operator } from '@/utils';
+import { FormItem, MultiSelector, Loading } from '@/components';
+import { PluginConfigType, getPluginScopeId } from '@/plugins';
 
 import * as T from './types';
 import * as API from './api';
@@ -34,77 +33,13 @@ import * as S from './styled';
 interface Props {
   plugin: string;
   connectionId: ID;
-  disabledScope?: any[];
-  onCancel: () => void;
-  onSubmit: (origin: any) => void;
+  config: PluginConfigType['dataScope'];
+  disabledScope: any[];
+  selectedScope: any[];
+  onChange: (selectedScope: any[]) => void;
 }
 
-export const DataScopeSelectRemote = ({ plugin, connectionId, disabledScope, 
onCancel, onSubmit }: Props) => {
-  const [operating, setOperating] = useState(false);
-  const [selectedScope, setSelectedScope] = useState<T.ResItem[]>([]);
-
-  const config = useMemo(() => getPluginConfig(plugin).dataScope, [plugin]);
-
-  const handleSubmit = async () => {
-    const [success, res] = await operator(
-      () => API.updateDataScope(plugin, connectionId, { data: 
selectedScope.map((it) => it.data) }),
-      {
-        setOperating,
-        formatMessage: () => 'Add data scope successful.',
-      },
-    );
-
-    if (success) {
-      onSubmit(res);
-    }
-  };
-
-  return (
-    <>
-      {config.render ? (
-        config.render({
-          connectionId,
-          disabledItems: disabledScope?.map((it) => ({ id: 
getPluginScopeId(plugin, it) })),
-          selectedItems: selectedScope,
-          onChangeSelectedItems: setSelectedScope,
-        })
-      ) : (
-        <SelectRemote
-          plugin={plugin}
-          connectionId={connectionId}
-          config={config}
-          disabledScope={disabledScope}
-          selectedScope={selectedScope}
-          onChangeSelectedScope={setSelectedScope}
-        />
-      )}
-      <Buttons position="bottom" align="right">
-        <Button outlined intent={Intent.PRIMARY} text="Cancel" 
disabled={operating} onClick={onCancel} />
-        <Button
-          outlined
-          intent={Intent.PRIMARY}
-          text="Save"
-          loading={operating}
-          disabled={!selectedScope.length}
-          onClick={handleSubmit}
-        />
-      </Buttons>
-    </>
-  );
-};
-
-const SelectRemote = ({
-  plugin,
-  connectionId,
-  config,
-  disabledScope,
-  selectedScope,
-  onChangeSelectedScope,
-}: Omit<Props, 'onCancel' | 'onSubmit'> & {
-  config: any;
-  selectedScope: any[];
-  onChangeSelectedScope: (selectedScope: any[]) => void;
-}) => {
+export const SearchRemote = ({ plugin, connectionId, config, disabledScope, 
selectedScope, onChange }: Props) => {
   const [miller, setMiller] = useState<{
     items: McsItem<T.ResItem>[];
     loadedIds: ID[];
@@ -209,21 +144,22 @@ const SelectRemote = ({
         {!searchDebounce ? (
           <MillerColumnsSelect
             items={miller.items}
-            columnCount={config.millerColumnCount ?? 1}
+            columnCount={config.millerColumn?.columnCount ?? 1}
             columnHeight={300}
             getCanExpand={(it) => it.type === 'group'}
             getHasMore={(id) => !miller.loadedIds.includes(id ?? 'root')}
             onExpand={(id: McsID) => getItems(id, miller.nextTokenMap[id])}
             onScroll={(id: McsID | null) => getItems(id, 
miller.nextTokenMap[id ?? 'root'])}
             renderTitle={(column: McsColumn) =>
-              !column.parentId && config.millerFirstTitle && 
<S.ColumnTitle>{config.millerFirstTitle}</S.ColumnTitle>
+              !column.parentId &&
+              config.millerColumn?.firstColumnTitle && (
+                
<S.ColumnTitle>{config.millerColumn.firstColumnTitle}</S.ColumnTitle>
+              )
             }
             renderLoading={() => <Loading size={20} style={{ padding: '4px 
12px' }} />}
             disabledIds={(disabledScope ?? []).map((it) => 
getPluginScopeId(plugin, it))}
             selectedIds={selectedScope.map((it) => it.id)}
-            onSelectItemIds={(selectedIds: ID[]) =>
-              onChangeSelectedScope(allItems.filter((it) => 
selectedIds.includes(it.id)))
-            }
+            onSelectItemIds={(selectedIds: ID[]) => 
onChange(allItems.filter((it) => selectedIds.includes(it.id)))}
           />
         ) : (
           <MillerColumnsSelect
@@ -236,9 +172,7 @@ const SelectRemote = ({
             renderLoading={() => <Loading size={20} style={{ padding: '4px 
12px' }} />}
             disabledIds={(disabledScope ?? []).map((it) => 
getPluginScopeId(plugin, it))}
             selectedIds={selectedScope.map((it) => it.id)}
-            onSelectItemIds={(selectedIds: ID[]) =>
-              onChangeSelectedScope(allItems.filter((it) => 
selectedIds.includes(it.id)))
-            }
+            onSelectItemIds={(selectedIds: ID[]) => 
onChange(allItems.filter((it) => selectedIds.includes(it.id)))}
           />
         )}
       </FormItem>
diff --git 
a/config-ui/src/plugins/components/data-scope-select-remote/styled.ts 
b/config-ui/src/plugins/components/data-scope-remote/styled.ts
similarity index 87%
rename from config-ui/src/plugins/components/data-scope-select-remote/styled.ts
rename to config-ui/src/plugins/components/data-scope-remote/styled.ts
index 41e76ecb3..27ecd0fe8 100644
--- a/config-ui/src/plugins/components/data-scope-select-remote/styled.ts
+++ b/config-ui/src/plugins/components/data-scope-remote/styled.ts
@@ -24,3 +24,13 @@ export const ColumnTitle = styled.div`
   padding: 6px 12px;
   font-weight: 600;
 `;
+
+export const JobLoad = styled.div`
+  display: flex;
+  align-items: center;
+
+  & > span.count {
+    margin: 0 8px;
+    color: #7497f7;
+  }
+`;
diff --git a/config-ui/src/plugins/components/data-scope-select-remote/types.ts 
b/config-ui/src/plugins/components/data-scope-remote/types.ts
similarity index 100%
rename from config-ui/src/plugins/components/data-scope-select-remote/types.ts
rename to config-ui/src/plugins/components/data-scope-remote/types.ts
diff --git a/config-ui/src/plugins/components/index.ts 
b/config-ui/src/plugins/components/index.ts
index 9f3e71026..82d08d3be 100644
--- a/config-ui/src/plugins/components/index.ts
+++ b/config-ui/src/plugins/components/index.ts
@@ -19,7 +19,7 @@
 export * from './connection-form';
 export * from './connection-list';
 export * from './connection-status';
+export * from './data-scope-remote';
 export * from './data-scope-select';
-export * from './data-scope-select-remote';
 export * from './scope-config-form';
 export * from './scope-config-select';
diff --git a/config-ui/src/plugins/register/azure/config.tsx 
b/config-ui/src/plugins/register/azure/config.tsx
index 7fc9a95cf..500a4e389 100644
--- a/config-ui/src/plugins/register/azure/config.tsx
+++ b/config-ui/src/plugins/register/azure/config.tsx
@@ -58,7 +58,11 @@ export const AzureConfig: PluginConfigType = {
     ],
   },
   dataScope: {
+    localSearch: true,
     title: 'Repositories',
+    millerColumn: {
+      columnCount: 2,
+    },
   },
   scopeConfig: {
     entities: ['CODE', 'CODEREVIEW', 'CROSS', 'CICD'],
diff --git a/config-ui/src/plugins/register/bitbucket/config.tsx 
b/config-ui/src/plugins/register/bitbucket/config.tsx
index b7e4fc7a5..11c03bb3d 100644
--- a/config-ui/src/plugins/register/bitbucket/config.tsx
+++ b/config-ui/src/plugins/register/bitbucket/config.tsx
@@ -62,7 +62,9 @@ export const BitBucketConfig: PluginConfigType = {
   },
   dataScope: {
     title: 'Repositories',
-    millerColumnCount: 2,
+    millerColumn: {
+      columnCount: 2,
+    },
   },
   scopeConfig: {
     entities: ['CODE', 'TICKET', 'CODEREVIEW', 'CROSS', 'CICD'],
diff --git a/config-ui/src/plugins/register/github/config.tsx 
b/config-ui/src/plugins/register/github/config.tsx
index ac5ddef8b..fc255675f 100644
--- a/config-ui/src/plugins/register/github/config.tsx
+++ b/config-ui/src/plugins/register/github/config.tsx
@@ -101,8 +101,10 @@ export const GitHubConfig: PluginConfigType = {
   },
   dataScope: {
     title: 'Repositories',
-    millerColumnCount: 2,
-    millerFirstTitle: 'Organizations/Owners',
+    millerColumn: {
+      columnCount: 2,
+      firstColumnTitle: 'Organizations/Owners',
+    },
   },
   scopeConfig: {
     entities: ['CODE', 'TICKET', 'CODEREVIEW', 'CROSS', 'CICD'],
diff --git a/config-ui/src/plugins/register/gitlab/config.tsx 
b/config-ui/src/plugins/register/gitlab/config.tsx
index 49d1f5ebe..53d11d044 100644
--- a/config-ui/src/plugins/register/gitlab/config.tsx
+++ b/config-ui/src/plugins/register/gitlab/config.tsx
@@ -69,8 +69,10 @@ export const GitLabConfig: PluginConfigType = {
   },
   dataScope: {
     title: 'Projects',
-    millerColumnCount: 2.5,
-    millerFirstTitle: 'Subgroups/Projects',
+    millerColumn: {
+      columnCount: 2.5,
+      firstColumnTitle: 'Subgroups/Projects',
+    },
   },
   scopeConfig: {
     entities: ['CODE', 'TICKET', 'CODEREVIEW', 'CROSS', 'CICD'],
diff --git a/config-ui/src/plugins/register/jenkins/config.tsx 
b/config-ui/src/plugins/register/jenkins/config.ts
similarity index 95%
rename from config-ui/src/plugins/register/jenkins/config.tsx
rename to config-ui/src/plugins/register/jenkins/config.ts
index 170341a3b..fc77932ac 100644
--- a/config-ui/src/plugins/register/jenkins/config.tsx
+++ b/config-ui/src/plugins/register/jenkins/config.ts
@@ -22,7 +22,6 @@ import type { PluginConfigType } from '../../types';
 import { PluginType } from '../../types';
 
 import Icon from './assets/icon.svg';
-import { DataScope } from './data-scope';
 
 export const JenkinsConfig: PluginConfigType = {
   type: PluginType.Connection,
@@ -52,7 +51,11 @@ export const JenkinsConfig: PluginConfigType = {
     ],
   },
   dataScope: {
-    render: ({ ...props }) => <DataScope {...props} />,
+    localSearch: true,
+    title: 'Jobs',
+    millerColumn: {
+      columnCount: 2.5,
+    },
   },
   scopeConfig: {
     entities: ['CICD'],
diff --git a/config-ui/src/plugins/register/tapd/data-scope.tsx 
b/config-ui/src/plugins/register/tapd/data-scope.tsx
index 1d69a37b6..280ae9f47 100644
--- a/config-ui/src/plugins/register/tapd/data-scope.tsx
+++ b/config-ui/src/plugins/register/tapd/data-scope.tsx
@@ -22,8 +22,8 @@ import type { McsID, McsItem } from 'miller-columns-select';
 import MillerColumnsSelect from 'miller-columns-select';
 
 import { ExternalLink, Loading } from '@/components';
-import * as T from '@/plugins/components/data-scope-select-remote/types';
-import * as API from '@/plugins/components/data-scope-select-remote/api';
+import * as T from '@/plugins/components/data-scope-remote/types';
+import * as API from '@/plugins/components/data-scope-remote/api';
 
 import { prepareToken } from './api';
 
diff --git a/config-ui/src/plugins/register/zentao/config.tsx 
b/config-ui/src/plugins/register/zentao/config.tsx
index 288d8832a..c5ee0ccb1 100644
--- a/config-ui/src/plugins/register/zentao/config.tsx
+++ b/config-ui/src/plugins/register/zentao/config.tsx
@@ -60,7 +60,10 @@ export const ZenTaoConfig: PluginConfigType = {
     ],
   },
   dataScope: {
+    localSearch: true,
     title: 'Repositories',
-    millerColumnCount: 2,
+    millerColumn: {
+      columnCount: 2,
+    },
   },
 };
diff --git a/config-ui/src/plugins/types.ts b/config-ui/src/plugins/types.ts
index 589ea9038..b79e6c7c7 100644
--- a/config-ui/src/plugins/types.ts
+++ b/config-ui/src/plugins/types.ts
@@ -34,9 +34,12 @@ export type PluginConfigType = {
     fields: any[];
   };
   dataScope: {
+    localSearch?: boolean;
     title?: string;
-    millerColumnCount?: number;
-    millerFirstTitle?: string;
+    millerColumn?: {
+      columnCount?: number;
+      firstColumnTitle?: string;
+    };
     render?: (props: any) => React.ReactNode;
   };
   scopeConfig?: {

Reply via email to