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 2023/10/31 08:17:02 UTC

(incubator-devlake) 01/01: refactor(config-ui): unified type definition and output

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

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

commit 14da7b6409a48ea0df3fc7add03ea36cc1fd042a
Author: mintsweet <0x...@gmail.com>
AuthorDate: Tue Oct 31 21:16:50 2023 +1300

    refactor(config-ui): unified type definition and output
---
 config-ui/src/api/api-key/index.ts                 | 20 ++++++--
 config-ui/src/api/blueprint/index.ts               | 16 +++---
 config-ui/src/api/connection/index.ts              | 17 +++---
 config-ui/src/api/connection/types.ts              | 60 ----------------------
 config-ui/src/api/pipeline/index.ts                |  5 +-
 config-ui/src/api/project/index.ts                 | 11 ++--
 config-ui/src/api/scope/index.ts                   | 42 ++++++++++++---
 config-ui/src/api/scope/types.ts                   | 50 ------------------
 .../components/update-policy-dialog/index.tsx      |  8 ++-
 .../pages/blueprint/detail/configuration-panel.tsx | 12 ++---
 .../src/pages/blueprint/detail/status-panel.tsx    | 16 +++---
 config-ui/src/pages/blueprint/home/index.tsx       | 21 ++++----
 config-ui/src/pages/blueprint/types.ts             | 25 ---------
 config-ui/src/pages/project/detail/index.tsx       | 12 ++---
 .../src/pages/project/detail/settings-panel.tsx    |  4 +-
 .../src/pages/project/detail/webhooks-panel.tsx    |  5 +-
 config-ui/src/pages/project/home/index.tsx         |  6 +--
 config-ui/src/pages/project/index.ts               |  1 -
 .../src/routes/pipeline/components/duration.tsx    | 13 ++---
 config-ui/src/routes/pipeline/components/info.tsx  | 24 ++++-----
 .../src/routes/pipeline/components/status.tsx      | 14 ++---
 config-ui/src/routes/pipeline/components/table.tsx |  9 ++--
 config-ui/src/routes/pipeline/components/task.tsx  | 22 ++++----
 config-ui/src/routes/pipeline/components/tasks.tsx | 14 ++---
 config-ui/src/routes/pipeline/constant.ts          | 38 +++++++-------
 config-ui/src/routes/pipeline/types.ts             | 56 --------------------
 .../src/{api/api-key/types.ts => types/api-key.ts} |  4 +-
 .../{api/blueprint/types.ts => types/blueprint.ts} | 21 +++-----
 config-ui/src/types/connection.ts                  | 17 +++++-
 .../api-keys/types.ts => types/data-scope.ts}      |  8 ++-
 config-ui/src/types/index.ts                       |  7 +++
 .../{api/pipeline/types.ts => types/pipeline.ts}   |  8 +--
 .../{pages/project/types.ts => types/project.ts}   | 11 ++--
 .../api-key/types.ts => types/scope-config.ts}     |  7 +--
 .../src/{api/project/types.ts => types/task.ts}    | 26 ++++++----
 35 files changed, 244 insertions(+), 386 deletions(-)

diff --git a/config-ui/src/api/api-key/index.ts b/config-ui/src/api/api-key/index.ts
index 48e82cb6d..79d09c2f4 100644
--- a/config-ui/src/api/api-key/index.ts
+++ b/config-ui/src/api/api-key/index.ts
@@ -16,15 +16,22 @@
  *
  */
 
+import type { IApiKey } from '@/types';
 import { request } from '@/utils';
-import * as T from './types';
 
-export const list = (data?: Pagination): Promise<{ count: number; apikeys: T.Key[] }> =>
+type ListRes = {
+  count: number;
+  apikeys: IApiKey[];
+};
+
+export const list = (data?: Pagination): Promise<ListRes> =>
   request('/api-keys', {
     data,
   });
 
-export const create = (data: Pick<T.Key, 'name' | 'expiredAt' | 'allowedPath'>): Promise<T.Key> =>
+type CreateForm = Pick<IApiKey, 'name' | 'expiredAt' | 'allowedPath'>;
+
+export const create = (data: CreateForm): Promise<IApiKey> =>
   request('/api-keys', {
     method: 'POST',
     data: {
@@ -33,7 +40,12 @@ export const create = (data: Pick<T.Key, 'name' | 'expiredAt' | 'allowedPath'>):
     },
   });
 
-export const remove = (id: string): Promise<void> =>
+type RemoveRes = {
+  message: string;
+  success: boolean;
+};
+
+export const remove = (id: string): Promise<RemoveRes> =>
   request(`/api-keys/${id}`, {
     method: 'DELETE',
   });
diff --git a/config-ui/src/api/blueprint/index.ts b/config-ui/src/api/blueprint/index.ts
index 36ad47eaf..0f63d0210 100644
--- a/config-ui/src/api/blueprint/index.ts
+++ b/config-ui/src/api/blueprint/index.ts
@@ -16,14 +16,13 @@
  *
  */
 
+import type { IBlueprint } from '@/types';
 import { request } from '@/utils';
 
-import * as T from './types';
-
-export const list = (data: Pagination & { type: string }): Promise<{ count: number; blueprints: T.Blueprint[] }> =>
+export const list = (data: Pagination & { type: string }): Promise<{ count: number; blueprints: IBlueprint[] }> =>
   request('/blueprints', { data });
 
-export const get = (id: ID): Promise<T.Blueprint> => request(`/blueprints/${id}`);
+export const get = (id: ID): Promise<IBlueprint> => request(`/blueprints/${id}`);
 
 export const create = (data: any) =>
   request('/blueprints', {
@@ -33,8 +32,13 @@ export const create = (data: any) =>
 
 export const remove = (id: ID) => request(`/blueprints/${id}`, { method: 'delete' });
 
-export const update = (id: ID, data: T.Blueprint) => request(`/blueprints/${id}`, { method: 'patch', data });
+export const update = (id: ID, data: IBlueprint) => request(`/blueprints/${id}`, { method: 'patch', data });
 
 export const pipelines = (id: ID) => request(`/blueprints/${id}/pipelines`);
 
-export const trigger = (id: ID, data: T.TriggerQuery) => request(`/blueprints/${id}/trigger`, { method: 'post', data });
+type TriggerQuery = {
+  skipCollectors: boolean;
+  fullSync: boolean;
+};
+
+export const trigger = (id: ID, data: TriggerQuery) => request(`/blueprints/${id}/trigger`, { method: 'post', data });
diff --git a/config-ui/src/api/connection/index.ts b/config-ui/src/api/connection/index.ts
index c142d2879..d19c87cac 100644
--- a/config-ui/src/api/connection/index.ts
+++ b/config-ui/src/api/connection/index.ts
@@ -16,22 +16,21 @@
  *
  */
 
+import { IConnectionAPI, IConnectionTestResult } from '@/types';
 import { request } from '@/utils';
 
-import * as T from './types';
+export const list = (plugin: string): Promise<IConnectionAPI[]> => request(`/plugins/${plugin}/connections`);
 
-export const list = (plugin: string): Promise<T.Connection[]> => request(`/plugins/${plugin}/connections`);
-
-export const get = (plugin: string, connectionId: ID): Promise<T.Connection> =>
+export const get = (plugin: string, connectionId: ID): Promise<IConnectionAPI> =>
   request(`/plugins/${plugin}/connections/${connectionId}`);
 
-export const create = (plugin: string, payload: T.ConnectionForm): Promise<T.Connection> =>
+export const create = (plugin: string, payload: Omit<IConnectionAPI, 'id'>): Promise<IConnectionAPI> =>
   request(`/plugins/${plugin}/connections`, { method: 'post', data: payload });
 
-export const remove = (plugin: string, id: ID): Promise<T.Connection> =>
+export const remove = (plugin: string, id: ID): Promise<IConnectionAPI> =>
   request(`/plugins/${plugin}/connections/${id}`, { method: 'delete' });
 
-export const update = (plugin: string, id: ID, payload: T.ConnectionForm): Promise<T.Connection> =>
+export const update = (plugin: string, id: ID, payload: Omit<IConnectionAPI, 'id'>): Promise<IConnectionAPI> =>
   request(`/plugins/${plugin}/connections/${id}`, {
     method: 'patch',
     data: payload,
@@ -40,7 +39,7 @@ export const update = (plugin: string, id: ID, payload: T.ConnectionForm): Promi
 export const test = (
   plugin: string,
   payload: Pick<
-    T.ConnectionForm,
+    IConnectionAPI,
     'endpoint' | 'authMethod' | 'username' | 'password' | 'token' | 'appId' | 'secretKey' | 'proxy' | 'dbUrl'
   >,
-): Promise<T.ConnectionTest> => request(`/plugins/${plugin}/test`, { method: 'post', data: payload });
+): Promise<IConnectionTestResult> => request(`/plugins/${plugin}/test`, { method: 'post', data: payload });
diff --git a/config-ui/src/api/connection/types.ts b/config-ui/src/api/connection/types.ts
deleted file mode 100644
index 2d83c0c2b..000000000
--- a/config-ui/src/api/connection/types.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- *
- */
-
-export type Connection = {
-  id: ID;
-  name: string;
-  endpoint: string;
-  authMethod?: string;
-  token?: string;
-  username?: string;
-  password?: string;
-  proxy: string;
-  apiKey?: string;
-  dbUrl?: string;
-  appId?: string;
-  secretKey?: string;
-};
-
-export type ConnectionForm = {
-  name: string;
-  endpoint?: string;
-  authMethod?: string;
-  username?: string;
-  password?: string;
-  token?: string;
-  appId?: string;
-  secretKey?: string;
-  enableGraphql?: boolean;
-  proxy: string;
-  rateLimitPerHour?: number;
-  dbUrl?: string;
-};
-
-export type ConnectionTest = {
-  message: string;
-  success: boolean;
-  login?: string;
-  installations?: Array<{
-    id: number;
-    account: {
-      login: string;
-    };
-  }>;
-  warning?: string;
-};
diff --git a/config-ui/src/api/pipeline/index.ts b/config-ui/src/api/pipeline/index.ts
index 4b90ccc55..1ec8e025c 100644
--- a/config-ui/src/api/pipeline/index.ts
+++ b/config-ui/src/api/pipeline/index.ts
@@ -16,11 +16,10 @@
  *
  */
 
+import { IPipeline } from '@/types';
 import { request } from '@/utils';
 
-import * as T from './types';
-
-export const list = (): Promise<{ count: number; pipelines: T.Pipeline[] }> => request('/pipelines');
+export const list = (): Promise<{ count: number; pipelines: IPipeline[] }> => request('/pipelines');
 
 export const get = (id: ID) => request(`/pipelines/${id}`);
 
diff --git a/config-ui/src/api/project/index.ts b/config-ui/src/api/project/index.ts
index 21e7ed780..dd6f786a0 100644
--- a/config-ui/src/api/project/index.ts
+++ b/config-ui/src/api/project/index.ts
@@ -16,16 +16,15 @@
  *
  */
 
+import type { IProject } from '@/types';
 import { request } from '@/utils';
 
-import * as T from './types';
-
-export const list = (data: Pagination): Promise<{ count: number; projects: T.Project[] }> =>
+export const list = (data: Pagination): Promise<{ count: number; projects: IProject[] }> =>
   request('/projects', { data });
 
-export const get = (name: string): Promise<T.Project> => request(`/projects/${name}`);
+export const get = (name: string): Promise<IProject> => request(`/projects/${name}`);
 
-export const create = (data: Pick<T.Project, 'name' | 'description' | 'metrics'>) =>
+export const create = (data: Pick<IProject, 'name' | 'description' | 'metrics'>) =>
   request('/projects', {
     method: 'post',
     data,
@@ -36,7 +35,7 @@ export const remove = (name: string) =>
     method: 'delete',
   });
 
-export const update = (name: string, data: Pick<T.Project, 'name' | 'description' | 'metrics'>) =>
+export const update = (name: string, data: Pick<IProject, 'name' | 'description' | 'metrics'>) =>
   request(`/projects/${name}`, {
     method: 'patch',
     data,
diff --git a/config-ui/src/api/scope/index.ts b/config-ui/src/api/scope/index.ts
index 4d19d26af..249aebf61 100644
--- a/config-ui/src/api/scope/index.ts
+++ b/config-ui/src/api/scope/index.ts
@@ -16,15 +16,23 @@
  *
  */
 
+import { IDataScope, IScopeConfig } from '@/types';
 import { request } from '@/utils';
 
-import * as T from './types';
-
 export const list = (
   plugin: string,
   connectionId: ID,
-  data?: T.ListQuery,
-): Promise<{ count: number; scopes: T.List }> =>
+  data?: Pagination & {
+    blueprint?: boolean;
+    searchTerm?: string;
+  },
+): Promise<{
+  count: number;
+  scopes: Array<{
+    scope: IDataScope;
+    scopeConfig?: IScopeConfig;
+  }>;
+}> =>
   request(`/plugins/${plugin}/connections/${connectionId}/scopes`, {
     data,
   });
@@ -49,21 +57,39 @@ export const batch = (plugin: string, connectionId: ID, payload: any) =>
     data: payload,
   });
 
+type RemoteQuery = {
+  groupId: ID | null;
+  pageToken?: string;
+};
+
+type RemoteScope = {
+  type: 'group' | 'scope';
+  parentId: ID | null;
+  id: ID;
+  name: string;
+  fullName: string;
+  data: any;
+};
+
 export const remote = (
   plugin: string,
   connectionId: ID,
-  data: T.RemoteQuery,
-): Promise<{ children: T.RemoteScope[]; nextPageToken: string }> =>
+  data: RemoteQuery,
+): Promise<{ children: RemoteScope[]; nextPageToken: string }> =>
   request(`/plugins/${plugin}/connections/${connectionId}/remote-scopes`, {
     method: 'get',
     data,
   });
 
+type SearchRemoteQuery = {
+  search?: string;
+} & Pagination;
+
 export const searchRemote = (
   plugin: string,
   connectionId: ID,
-  data: T.SearchRemoteQuery,
-): Promise<{ children: T.RemoteScope[]; count: number }> =>
+  data: SearchRemoteQuery,
+): Promise<{ children: RemoteScope[]; count: number }> =>
   request(`/plugins/${plugin}/connections/${connectionId}/search-remote-scopes`, {
     method: 'get',
     data,
diff --git a/config-ui/src/api/scope/types.ts b/config-ui/src/api/scope/types.ts
deleted file mode 100644
index 07f8c4e6b..000000000
--- a/config-ui/src/api/scope/types.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- *
- */
-
-export type ListQuery = Pagination & {
-  blueprint?: boolean;
-  searchTerm?: string;
-};
-
-export type Scope = {
-  name: string;
-  fullName: string;
-};
-
-export type List = Array<{
-  scope: Scope;
-  scopeConfig?: { name: string };
-}>;
-
-export type RemoteQuery = {
-  groupId: ID | null;
-  pageToken?: string;
-};
-
-export type RemoteScope = {
-  type: 'group' | 'scope';
-  parentId: ID | null;
-  id: ID;
-  name: string;
-  fullName: string;
-  data: any;
-};
-
-export type SearchRemoteQuery = {
-  search?: string;
-} & Pagination;
diff --git a/config-ui/src/pages/blueprint/detail/components/update-policy-dialog/index.tsx b/config-ui/src/pages/blueprint/detail/components/update-policy-dialog/index.tsx
index f5c586634..852eacac3 100644
--- a/config-ui/src/pages/blueprint/detail/components/update-policy-dialog/index.tsx
+++ b/config-ui/src/pages/blueprint/detail/components/update-policy-dialog/index.tsx
@@ -19,14 +19,12 @@
 import { useState, useEffect } from 'react';
 
 import { Dialog } from '@/components';
-
-import type { BlueprintType } from '../../../types';
-import { ModeEnum } from '../../../types';
+import { IBlueprint, IBPMode } from '@/types';
 
 import { SyncPolicy } from '../sync-policy';
 
 interface Props {
-  blueprint: BlueprintType;
+  blueprint: IBlueprint;
   isManual: boolean;
   cronConfig: string;
   skipOnFail: boolean;
@@ -74,7 +72,7 @@ export const UpdatePolicyDialog = ({ blueprint, operating, onCancel, onSubmit, .
         isManual={isManual}
         cronConfig={cronConfig}
         skipOnFail={skipOnFail}
-        showTimeFilter={blueprint.mode === ModeEnum.normal}
+        showTimeFilter={blueprint.mode === IBPMode.NORMAL}
         timeAfter={timeAfter}
         onChangeIsManual={setIsManual}
         onChangeCronConfig={setCronConfig}
diff --git a/config-ui/src/pages/blueprint/detail/configuration-panel.tsx b/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
index 9890aea04..cd7848f4c 100644
--- a/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
+++ b/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
@@ -25,12 +25,12 @@ import { IconButton, Table, NoData, Buttons } from '@/components';
 import { getCron } from '@/config';
 import { ConnectionName } from '@/features';
 import { getPluginConfig } from '@/plugins';
+import { IBlueprint, IBPMode } from '@/types';
 import { formatTime, operator } from '@/utils';
 
 import { encodeName } from '../../project/utils';
 
-import { BlueprintType, FromEnum } from '../types';
-import { ModeEnum } from '../types';
+import { FromEnum } from '../types';
 import { validRawPlan } from '../utils';
 
 import { AdvancedEditor, UpdateNameDialog, UpdatePolicyDialog, AddConnectionDialog } from './components';
@@ -38,7 +38,7 @@ import * as S from './styled';
 
 interface Props {
   from: FromEnum;
-  blueprint: BlueprintType;
+  blueprint: IBlueprint;
   onRefresh: () => void;
   onChangeTab: (tab: string) => void;
 }
@@ -139,7 +139,7 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }:
               title: 'Data Time Range',
               dataIndex: 'timeRange',
               key: 'timeRange',
-              render: (val) => (blueprint.mode === ModeEnum.normal ? `${formatTime(val)} to Now` : 'N/A'),
+              render: (val) => (blueprint.mode === IBPMode.NORMAL ? `${formatTime(val)} to Now` : 'N/A'),
             },
             {
               title: 'Sync Frequency',
@@ -169,7 +169,7 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }:
           ]}
         />
       </div>
-      {blueprint.mode === ModeEnum.normal && (
+      {blueprint.mode === IBPMode.NORMAL && (
         <div className="block">
           <h3>Data Connections</h3>
           {!connections.length ? (
@@ -230,7 +230,7 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }:
           )}
         </div>
       )}
-      {blueprint.mode === ModeEnum.advanced && (
+      {blueprint.mode === IBPMode.ADVANCED && (
         <div className="block">
           <h3>JSON Configuration</h3>
           <AdvancedEditor value={rawPlan} onChange={setRawPlan} />
diff --git a/config-ui/src/pages/blueprint/detail/status-panel.tsx b/config-ui/src/pages/blueprint/detail/status-panel.tsx
index 38c4a2456..9506cf127 100644
--- a/config-ui/src/pages/blueprint/detail/status-panel.tsx
+++ b/config-ui/src/pages/blueprint/detail/status-panel.tsx
@@ -25,17 +25,17 @@ import API from '@/api';
 import { Card, IconButton, Dialog, Message } from '@/components';
 import { getCron } from '@/config';
 import { useAutoRefresh } from '@/hooks';
-import * as PipelineT from '@/routes/pipeline/types';
 import { PipelineInfo, PipelineTasks, PipelineTable } from '@/routes/pipeline';
+import { IBlueprint, IPipeline, IPipelineStatus } from '@/types';
 import { formatTime, operator } from '@/utils';
 
-import { BlueprintType, FromEnum } from '../types';
+import { FromEnum } from '../types';
 
 import * as S from './styled';
 
 interface Props {
   from: FromEnum;
-  blueprint: BlueprintType;
+  blueprint: IBlueprint;
   pipelineId?: ID;
   onRefresh: () => void;
 }
@@ -48,7 +48,7 @@ export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props) =
 
   const cron = useMemo(() => getCron(blueprint.isManual, blueprint.cronConfig), [blueprint]);
 
-  const { loading, data } = useAutoRefresh<PipelineT.Pipeline[]>(
+  const { loading, data } = useAutoRefresh<IPipeline[]>(
     async () => {
       const res = await API.blueprint.pipelines(blueprint.id);
       return res.pipelines;
@@ -60,10 +60,10 @@ export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props) =
           data &&
           data.every((it) =>
             [
-              PipelineT.PipelineStatus.COMPLETED,
-              PipelineT.PipelineStatus.PARTIAL,
-              PipelineT.PipelineStatus.CANCELLED,
-              PipelineT.PipelineStatus.FAILED,
+              IPipelineStatus.COMPLETED,
+              IPipelineStatus.PARTIAL,
+              IPipelineStatus.CANCELLED,
+              IPipelineStatus.FAILED,
             ].includes(it.status),
           )
         ),
diff --git a/config-ui/src/pages/blueprint/home/index.tsx b/config-ui/src/pages/blueprint/home/index.tsx
index 98c0d7d49..7dc7d3bca 100644
--- a/config-ui/src/pages/blueprint/home/index.tsx
+++ b/config-ui/src/pages/blueprint/home/index.tsx
@@ -26,10 +26,9 @@ import { PageHeader, Table, IconButton, TextTooltip, Dialog } from '@/components
 import { getCronOptions, cronPresets, getCron } from '@/config';
 import { ConnectionName } from '@/features';
 import { useRefreshData } from '@/hooks';
+import { IBlueprint, IBPMode } from '@/types';
 import { formatTime, operator } from '@/utils';
 
-import { ModeEnum, BlueprintType } from '../types';
-
 import * as S from './styled';
 
 export const BlueprintHomePage = () => {
@@ -39,7 +38,7 @@ export const BlueprintHomePage = () => {
   const [pageSize] = useState(20);
   const [isOpen, setIsOpen] = useState(false);
   const [name, setName] = useState('');
-  const [mode, setMode] = useState(ModeEnum.normal);
+  const [mode, setMode] = useState(IBPMode.NORMAL);
   const [saving, setSaving] = useState(false);
 
   const { ready, data } = useRefreshData(
@@ -53,7 +52,7 @@ export const BlueprintHomePage = () => {
   const handleShowDialog = () => setIsOpen(true);
   const handleHideDialog = () => {
     setName('');
-    setMode(ModeEnum.normal);
+    setMode(IBPMode.NORMAL);
     setIsOpen(false);
   };
 
@@ -67,12 +66,12 @@ export const BlueprintHomePage = () => {
       skipOnFail: true,
     };
 
-    if (mode === ModeEnum.normal) {
+    if (mode === IBPMode.NORMAL) {
       payload.timeAfter = formatTime(dayjs().subtract(6, 'month').startOf('day').toDate(), 'YYYY-MM-DD[T]HH:mm:ssZ');
       payload.connections = [];
     }
 
-    if (mode === ModeEnum.advanced) {
+    if (mode === IBPMode.ADVANCED) {
       payload.timeAfter = undefined;
       payload.connections = undefined;
       payload.plan = [[]];
@@ -129,8 +128,8 @@ export const BlueprintHomePage = () => {
               dataIndex: ['mode', 'connections'],
               key: 'connections',
               align: 'center',
-              render: ({ mode, connections }: Pick<BlueprintType, 'mode' | 'connections'>) => {
-                if (mode === ModeEnum.advanced) {
+              render: ({ mode, connections }: Pick<IBlueprint, 'mode' | 'connections'>) => {
+                if (mode === IBPMode.ADVANCED) {
                   return 'Advanced Mode';
                 }
                 return (
@@ -261,10 +260,10 @@ export const BlueprintHomePage = () => {
             <RadioGroup
               inline
               selectedValue={mode}
-              onChange={(e) => setMode((e.target as HTMLInputElement).value as ModeEnum)}
+              onChange={(e) => setMode((e.target as HTMLInputElement).value as IBPMode)}
             >
-              <Radio value={ModeEnum.normal}>Normal Mode</Radio>
-              <Radio value={ModeEnum.advanced}>Advanced Mode</Radio>
+              <Radio value={IBPMode.NORMAL}>Normal Mode</Radio>
+              <Radio value={IBPMode.ADVANCED}>Advanced Mode</Radio>
             </RadioGroup>
           </FormGroup>
         </S.DialogWrapper>
diff --git a/config-ui/src/pages/blueprint/types.ts b/config-ui/src/pages/blueprint/types.ts
index ff9660fd9..0b4cb559c 100644
--- a/config-ui/src/pages/blueprint/types.ts
+++ b/config-ui/src/pages/blueprint/types.ts
@@ -16,32 +16,7 @@
  *
  */
 
-export enum ModeEnum {
-  advanced = 'ADVANCED',
-  normal = 'NORMAL',
-}
-
 export enum FromEnum {
   project = 'PROJECT',
   blueprint = 'BLUEPRINT',
 }
-
-export type BlueprintType = {
-  projectName: string;
-  id: ID;
-  enable: boolean;
-  name: string;
-  mode: ModeEnum;
-  isManual: boolean;
-  cronConfig: string;
-  skipOnFail: boolean;
-  plan: any;
-  timeAfter: null | string;
-  connections: Array<{
-    pluginName: string;
-    connectionId: ID;
-    scopes?: Array<{
-      scopeId: string;
-    }>;
-  }>;
-};
diff --git a/config-ui/src/pages/project/detail/index.tsx b/config-ui/src/pages/project/detail/index.tsx
index ee4702367..f0509a0d0 100644
--- a/config-ui/src/pages/project/detail/index.tsx
+++ b/config-ui/src/pages/project/detail/index.tsx
@@ -36,7 +36,7 @@ export const ProjectDetailPage = () => {
   const { pname } = useParams() as { pname: string };
   const [query, setQuery] = useUrlState({ tabId: 'blueprint' });
 
-  const { ready, data } = useRefreshData(() => Promise.all([API.project.get(pname)]), [pname, version]);
+  const { ready, data } = useRefreshData(() => API.project.get(pname), [pname, version]);
 
   const handleChangeTabId = (tabId: string) => {
     setQuery({ tabId });
@@ -50,13 +50,11 @@ export const ProjectDetailPage = () => {
     return <PageLoading />;
   }
 
-  const [project] = data;
-
   return (
     <PageHeader
       breadcrumbs={[
         { name: 'Projects', path: '/projects' },
-        { name: project.name, path: `/projects/${pname}` },
+        { name: data.name, path: `/projects/${pname}` },
       ]}
     >
       <S.Wrapper>
@@ -64,10 +62,10 @@ export const ProjectDetailPage = () => {
           <Tab
             id="blueprint"
             title="Blueprint"
-            panel={<BlueprintDetail id={project.blueprint.id} from={FromEnum.project} />}
+            panel={<BlueprintDetail id={data.blueprint.id} from={FromEnum.project} />}
           />
-          <Tab id="webhook" title="Webhooks" panel={<WebhooksPanel project={project} onRefresh={handleRefresh} />} />
-          <Tab id="settings" title="Settings" panel={<SettingsPanel project={project} onRefresh={handleRefresh} />} />
+          <Tab id="webhook" title="Webhooks" panel={<WebhooksPanel project={data} onRefresh={handleRefresh} />} />
+          <Tab id="settings" title="Settings" panel={<SettingsPanel project={data} onRefresh={handleRefresh} />} />
         </Tabs>
       </S.Wrapper>
     </PageHeader>
diff --git a/config-ui/src/pages/project/detail/settings-panel.tsx b/config-ui/src/pages/project/detail/settings-panel.tsx
index 963e97f74..21c2bd119 100644
--- a/config-ui/src/pages/project/detail/settings-panel.tsx
+++ b/config-ui/src/pages/project/detail/settings-panel.tsx
@@ -22,15 +22,15 @@ import { InputGroup, Checkbox, Button, Icon, Intent } from '@blueprintjs/core';
 
 import API from '@/api';
 import { Card, FormItem, Buttons, toast, Dialog } from '@/components';
+import { IProject } from '@/types';
 import { operator } from '@/utils';
 
-import type { ProjectType } from '../types';
 import { validName } from '../utils';
 
 import * as S from './styled';
 
 interface Props {
-  project: ProjectType;
+  project: IProject;
   onRefresh: () => void;
 }
 
diff --git a/config-ui/src/pages/project/detail/webhooks-panel.tsx b/config-ui/src/pages/project/detail/webhooks-panel.tsx
index 00bc1c142..1f2dd4b25 100644
--- a/config-ui/src/pages/project/detail/webhooks-panel.tsx
+++ b/config-ui/src/pages/project/detail/webhooks-panel.tsx
@@ -23,12 +23,11 @@ import API from '@/api';
 import { Alert, NoData } from '@/components';
 import type { WebhookItemType } from '@/plugins/register/webhook';
 import { WebhookCreateDialog, WebhookSelectorDialog, WebHookConnection } from '@/plugins/register/webhook';
+import { IProject } from '@/types';
 import { operator } from '@/utils';
 
-import type { ProjectType } from '../types';
-
 interface Props {
-  project: ProjectType;
+  project: IProject;
   onRefresh: () => void;
 }
 
diff --git a/config-ui/src/pages/project/home/index.tsx b/config-ui/src/pages/project/home/index.tsx
index ef79ce889..8ef59916b 100644
--- a/config-ui/src/pages/project/home/index.tsx
+++ b/config-ui/src/pages/project/home/index.tsx
@@ -29,9 +29,9 @@ import { useRefreshData } from '@/hooks';
 import { DOC_URL } from '@/release';
 import { formatTime, operator } from '@/utils';
 import { PipelineStatus } from '@/routes/pipeline';
+import { IBlueprint, IBPMode } from '@/types';
 
 import { validName, encodeName } from '../utils';
-import { BlueprintType, ModeEnum } from '../../blueprint';
 
 import * as S from './styled';
 
@@ -96,7 +96,7 @@ export const ProjectHomePage = () => {
         return API.blueprint.create({
           name: `${name}-Blueprint`,
           projectName: name,
-          mode: ModeEnum.normal,
+          mode: IBPMode.NORMAL,
           enable: true,
           cronConfig: presets[0],
           isManual: false,
@@ -138,7 +138,7 @@ export const ProjectHomePage = () => {
             title: 'Data Connections',
             dataIndex: 'connections',
             key: 'connections',
-            render: (val: BlueprintType['connections']) =>
+            render: (val: IBlueprint['connections']) =>
               !val || !val.length ? (
                 'N/A'
               ) : (
diff --git a/config-ui/src/pages/project/index.ts b/config-ui/src/pages/project/index.ts
index 40b545722..de11b8b83 100644
--- a/config-ui/src/pages/project/index.ts
+++ b/config-ui/src/pages/project/index.ts
@@ -16,7 +16,6 @@
  *
  */
 
-export * from './types';
 export * from './utils';
 export * from './home';
 export * from './detail';
diff --git a/config-ui/src/routes/pipeline/components/duration.tsx b/config-ui/src/routes/pipeline/components/duration.tsx
index 829cb548c..7558f9fb3 100644
--- a/config-ui/src/routes/pipeline/components/duration.tsx
+++ b/config-ui/src/routes/pipeline/components/duration.tsx
@@ -18,10 +18,10 @@
 
 import dayjs from 'dayjs';
 
-import * as T from '../types';
+import { IPipelineStatus } from '@/types';
 
 interface Props {
-  status: T.PipelineStatus;
+  status: IPipelineStatus;
   beganAt: string | null;
   finishedAt: string | null;
 }
@@ -32,12 +32,9 @@ export const PipelineDuration = ({ status, beganAt, finishedAt }: Props) => {
   }
 
   if (
-    ![
-      T.PipelineStatus.CANCELLED,
-      T.PipelineStatus.COMPLETED,
-      T.PipelineStatus.PARTIAL,
-      T.PipelineStatus.FAILED,
-    ].includes(status)
+    ![IPipelineStatus.CANCELLED, IPipelineStatus.COMPLETED, IPipelineStatus.PARTIAL, IPipelineStatus.FAILED].includes(
+      status,
+    )
   ) {
     return <span>{dayjs(beganAt).toNow(true)}</span>;
   }
diff --git a/config-ui/src/routes/pipeline/components/info.tsx b/config-ui/src/routes/pipeline/components/info.tsx
index 5d4e9c728..103bcb6ef 100644
--- a/config-ui/src/routes/pipeline/components/info.tsx
+++ b/config-ui/src/routes/pipeline/components/info.tsx
@@ -21,9 +21,9 @@ import { useState } from 'react';
 import API from '@/api';
 import { Loading, IconButton } from '@/components';
 import { useAutoRefresh } from '@/hooks';
+import { IPipeline, IPipelineStatus } from '@/types';
 import { formatTime, operator } from '@/utils';
 
-import * as T from '../types';
 import * as S from '../styled';
 
 import { PipelineStatus } from './status';
@@ -36,15 +36,15 @@ interface Props {
 export const PipelineInfo = ({ id }: Props) => {
   const [operating, setOperating] = useState(false);
 
-  const { data } = useAutoRefresh<T.Pipeline>(() => API.pipeline.get(id), [], {
+  const { data } = useAutoRefresh<IPipeline>(() => API.pipeline.get(id), [], {
     cancel: (data) => {
       return !!(
         data &&
         [
-          T.PipelineStatus.COMPLETED,
-          T.PipelineStatus.PARTIAL,
-          T.PipelineStatus.FAILED,
-          T.PipelineStatus.CANCELLED,
+          IPipelineStatus.COMPLETED,
+          IPipelineStatus.PARTIAL,
+          IPipelineStatus.FAILED,
+          IPipelineStatus.CANCELLED,
         ].includes(data.status)
       );
     },
@@ -106,20 +106,20 @@ export const PipelineInfo = ({ id }: Props) => {
           </strong>
         </li>
         <li>
-          {[T.PipelineStatus.ACTIVE, T.PipelineStatus.RUNNING, T.PipelineStatus.RERUN].includes(status) && (
+          {[IPipelineStatus.ACTIVE, IPipelineStatus.RUNNING, IPipelineStatus.RERUN].includes(status) && (
             <IconButton loading={operating} icon="disable" tooltip="Cancel" onClick={handleCancel} />
           )}
           {[
-            T.PipelineStatus.COMPLETED,
-            T.PipelineStatus.PARTIAL,
-            T.PipelineStatus.FAILED,
-            T.PipelineStatus.CANCELLED,
+            IPipelineStatus.COMPLETED,
+            IPipelineStatus.PARTIAL,
+            IPipelineStatus.FAILED,
+            IPipelineStatus.CANCELLED,
           ].includes(status) && (
             <IconButton loading={operating} icon="repeat" tooltip="Rerun failed tasks" onClick={handleRerun} />
           )}
         </li>
       </ul>
-      {T.PipelineStatus.FAILED === status && <p className="'message'">{message}</p>}
+      {IPipelineStatus.FAILED === status && <p className="'message'">{message}</p>}
     </S.Info>
   );
 };
diff --git a/config-ui/src/routes/pipeline/components/status.tsx b/config-ui/src/routes/pipeline/components/status.tsx
index b07226672..9097f1cba 100644
--- a/config-ui/src/routes/pipeline/components/status.tsx
+++ b/config-ui/src/routes/pipeline/components/status.tsx
@@ -20,22 +20,22 @@ import { Icon, IconName } from '@blueprintjs/core';
 import classNames from 'classnames';
 
 import { Loading } from '@/components';
+import { IPipelineStatus } from '@/types';
 
-import * as T from '../types';
 import * as S from '../styled';
 import * as C from '../constant';
 
 interface Props {
-  status: T.PipelineStatus;
+  status: IPipelineStatus;
 }
 
 export const PipelineStatus = ({ status }: Props) => {
   const cls = classNames({
-    ready: [T.PipelineStatus.CREATED, T.PipelineStatus.PENDING].includes(status),
-    loading: [T.PipelineStatus.ACTIVE, T.PipelineStatus.RUNNING, T.PipelineStatus.RERUN].includes(status),
-    success: [T.PipelineStatus.COMPLETED, T.PipelineStatus.PARTIAL].includes(status),
-    error: status === T.PipelineStatus.FAILED,
-    cancel: status === T.PipelineStatus.CANCELLED,
+    ready: [IPipelineStatus.CREATED, IPipelineStatus.PENDING].includes(status),
+    loading: [IPipelineStatus.ACTIVE, IPipelineStatus.RUNNING, IPipelineStatus.RERUN].includes(status),
+    success: [IPipelineStatus.COMPLETED, IPipelineStatus.PARTIAL].includes(status),
+    error: status === IPipelineStatus.FAILED,
+    cancel: status === IPipelineStatus.CANCELLED,
   });
 
   return (
diff --git a/config-ui/src/routes/pipeline/components/table.tsx b/config-ui/src/routes/pipeline/components/table.tsx
index 659d894c9..5ed8334d2 100644
--- a/config-ui/src/routes/pipeline/components/table.tsx
+++ b/config-ui/src/routes/pipeline/components/table.tsx
@@ -24,17 +24,16 @@ import { saveAs } from 'file-saver';
 import API from '@/api';
 import { DEVLAKE_ENDPOINT } from '@/config';
 import { Table, ColumnType, IconButton, Inspector, Dialog } from '@/components';
+import { IPipeline } from '@/types';
 import { formatTime } from '@/utils';
 
-import * as T from '../types';
-
 import { PipelineStatus } from './status';
 import { PipelineDuration } from './duration';
 import { PipelineTasks } from './tasks';
 
 interface Props {
   loading: boolean;
-  dataSource: T.Pipeline[];
+  dataSource: IPipeline[];
   pagination?: {
     total: number;
     page: number;
@@ -52,7 +51,7 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => {
   const [JSON, setJSON] = useState<any>(null);
   const [id, setId] = useState<ID | null>(null);
 
-  const handleShowJSON = (row: T.Pipeline) => {
+  const handleShowJSON = (row: IPipeline) => {
     setJSON(pick(row, ['id', 'name', 'plan', 'skipOnFail']));
   };
 
@@ -116,7 +115,7 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => {
             </ButtonGroup>
           ),
         },
-      ] as ColumnType<T.Pipeline>,
+      ] as ColumnType<IPipeline>,
     [],
   );
 
diff --git a/config-ui/src/routes/pipeline/components/task.tsx b/config-ui/src/routes/pipeline/components/task.tsx
index c4b7a8767..616debaca 100644
--- a/config-ui/src/routes/pipeline/components/task.tsx
+++ b/config-ui/src/routes/pipeline/components/task.tsx
@@ -22,15 +22,15 @@ import { Intent } from '@blueprintjs/core';
 import API from '@/api';
 import { TextTooltip, IconButton } from '@/components';
 import { getPluginConfig } from '@/plugins';
+import { ITask, IPipelineStatus } from '@/types';
 import { operator } from '@/utils';
 
-import * as T from '../types';
 import * as S from '../styled';
 
 import { PipelineDuration } from './duration';
 
 interface Props {
-  task: T.PipelineTask;
+  task: ITask;
 }
 
 export const PipelineTask = ({ task }: Props) => {
@@ -107,9 +107,9 @@ export const PipelineTask = ({ task }: Props) => {
             <TextTooltip content={name}>{name}</TextTooltip>
           </span>
         </div>
-        {[status === T.PipelineStatus.CREATED, T.PipelineStatus.PENDING].includes(status) && <p>Subtasks pending</p>}
+        {[status === IPipelineStatus.CREATED, IPipelineStatus.PENDING].includes(status) && <p>Subtasks pending</p>}
 
-        {[T.PipelineStatus.ACTIVE, T.PipelineStatus.RUNNING].includes(status) && (
+        {[IPipelineStatus.ACTIVE, IPipelineStatus.RUNNING].includes(status) && (
           <p>
             Subtasks running
             <strong style={{ marginLeft: 8 }}>
@@ -118,23 +118,23 @@ export const PipelineTask = ({ task }: Props) => {
           </p>
         )}
 
-        {status === T.PipelineStatus.COMPLETED && <p>All Subtasks completed</p>}
+        {status === IPipelineStatus.COMPLETED && <p>All Subtasks completed</p>}
 
-        {status === T.PipelineStatus.FAILED && (
+        {status === IPipelineStatus.FAILED && (
           <TextTooltip intent={Intent.DANGER} content={message}>
             <p className="error">Task failed: hover to view the reason</p>
           </TextTooltip>
         )}
 
-        {status === T.PipelineStatus.CANCELLED && <p>Subtasks canceled</p>}
+        {status === IPipelineStatus.CANCELLED && <p>Subtasks canceled</p>}
       </div>
       <div className="duration">
         <PipelineDuration status={status} beganAt={beganAt} finishedAt={finishedAt} />
         {[
-          T.PipelineStatus.COMPLETED,
-          T.PipelineStatus.PARTIAL,
-          T.PipelineStatus.FAILED,
-          T.PipelineStatus.CANCELLED,
+          IPipelineStatus.COMPLETED,
+          IPipelineStatus.PARTIAL,
+          IPipelineStatus.FAILED,
+          IPipelineStatus.CANCELLED,
         ].includes(status) && (
           <IconButton loading={operating} icon="repeat" tooltip="Rerun task" onClick={handleRerun} />
         )}
diff --git a/config-ui/src/routes/pipeline/components/tasks.tsx b/config-ui/src/routes/pipeline/components/tasks.tsx
index 9cde98420..3c51ceba7 100644
--- a/config-ui/src/routes/pipeline/components/tasks.tsx
+++ b/config-ui/src/routes/pipeline/components/tasks.tsx
@@ -23,8 +23,8 @@ import { groupBy, sortBy } from 'lodash';
 import API from '@/api';
 import { Loading } from '@/components';
 import { useAutoRefresh } from '@/hooks';
+import { ITask, IPipelineStatus } from '@/types';
 
-import * as T from '../types';
 import * as S from '../styled';
 
 import { PipelineTask } from './task';
@@ -39,7 +39,7 @@ export const PipelineTasks = ({ id, style }: Props) => {
 
   // const { version } = usePipeline();
 
-  const { data } = useAutoRefresh<T.PipelineTask[]>(
+  const { data } = useAutoRefresh<ITask[]>(
     async () => {
       const taskRes = await API.pipeline.tasks(id);
       return taskRes.tasks;
@@ -50,7 +50,7 @@ export const PipelineTasks = ({ id, style }: Props) => {
         return !!(
           data &&
           data.every((task) =>
-            [T.PipelineStatus.COMPLETED, T.PipelineStatus.FAILED, T.PipelineStatus.CANCELLED].includes(task.status),
+            [IPipelineStatus.COMPLETED, IPipelineStatus.FAILED, IPipelineStatus.CANCELLED].includes(task.status),
           )
         );
       },
@@ -70,17 +70,17 @@ export const PipelineTasks = ({ id, style }: Props) => {
 
             switch (true) {
               case !!stages[key].find((task) =>
-                [T.PipelineStatus.ACTIVE, T.PipelineStatus.RUNNING].includes(task.status),
+                [IPipelineStatus.ACTIVE, IPipelineStatus.RUNNING].includes(task.status),
               ):
                 status = 'loading';
                 break;
-              case stages[key].every((task) => task.status === T.PipelineStatus.COMPLETED):
+              case stages[key].every((task) => task.status === IPipelineStatus.COMPLETED):
                 status = 'success';
                 break;
-              case !!stages[key].find((task) => task.status === T.PipelineStatus.FAILED):
+              case !!stages[key].find((task) => task.status === IPipelineStatus.FAILED):
                 status = 'error';
                 break;
-              case !!stages[key].find((task) => task.status === T.PipelineStatus.CANCELLED):
+              case !!stages[key].find((task) => task.status === IPipelineStatus.CANCELLED):
                 status = 'cancel';
                 break;
               default:
diff --git a/config-ui/src/routes/pipeline/constant.ts b/config-ui/src/routes/pipeline/constant.ts
index 79782789b..4bf80bf6e 100644
--- a/config-ui/src/routes/pipeline/constant.ts
+++ b/config-ui/src/routes/pipeline/constant.ts
@@ -16,28 +16,28 @@
  *
  */
 
-import * as T from './types';
+import { IPipelineStatus } from '@/types';
 
 export const PipeLineStatusIcon = {
-  [T.PipelineStatus.CREATED]: 'stopwatch',
-  [T.PipelineStatus.PENDING]: 'stopwatch',
-  [T.PipelineStatus.ACTIVE]: 'loading',
-  [T.PipelineStatus.RUNNING]: 'loading',
-  [T.PipelineStatus.RERUN]: 'loading',
-  [T.PipelineStatus.COMPLETED]: 'tick-circle',
-  [T.PipelineStatus.PARTIAL]: 'tick-circle',
-  [T.PipelineStatus.FAILED]: 'delete',
-  [T.PipelineStatus.CANCELLED]: 'undo',
+  [IPipelineStatus.CREATED]: 'stopwatch',
+  [IPipelineStatus.PENDING]: 'stopwatch',
+  [IPipelineStatus.ACTIVE]: 'loading',
+  [IPipelineStatus.RUNNING]: 'loading',
+  [IPipelineStatus.RERUN]: 'loading',
+  [IPipelineStatus.COMPLETED]: 'tick-circle',
+  [IPipelineStatus.PARTIAL]: 'tick-circle',
+  [IPipelineStatus.FAILED]: 'delete',
+  [IPipelineStatus.CANCELLED]: 'undo',
 };
 
 export const PipeLineStatusLabel = {
-  [T.PipelineStatus.CREATED]: 'Created (Pending)',
-  [T.PipelineStatus.PENDING]: 'Created (Pending)',
-  [T.PipelineStatus.ACTIVE]: 'In Progress',
-  [T.PipelineStatus.RUNNING]: 'In Progress',
-  [T.PipelineStatus.RERUN]: 'In Progress',
-  [T.PipelineStatus.COMPLETED]: 'Succeeded',
-  [T.PipelineStatus.PARTIAL]: 'Partial Success',
-  [T.PipelineStatus.FAILED]: 'Failed',
-  [T.PipelineStatus.CANCELLED]: 'Cancelled',
+  [IPipelineStatus.CREATED]: 'Created (Pending)',
+  [IPipelineStatus.PENDING]: 'Created (Pending)',
+  [IPipelineStatus.ACTIVE]: 'In Progress',
+  [IPipelineStatus.RUNNING]: 'In Progress',
+  [IPipelineStatus.RERUN]: 'In Progress',
+  [IPipelineStatus.COMPLETED]: 'Succeeded',
+  [IPipelineStatus.PARTIAL]: 'Partial Success',
+  [IPipelineStatus.FAILED]: 'Failed',
+  [IPipelineStatus.CANCELLED]: 'Cancelled',
 };
diff --git a/config-ui/src/routes/pipeline/types.ts b/config-ui/src/routes/pipeline/types.ts
deleted file mode 100644
index cd4fecbd4..000000000
--- a/config-ui/src/routes/pipeline/types.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- *
- */
-
-export enum PipelineStatus {
-  CREATED = 'TASK_CREATED',
-  PENDING = 'TASK_PENDING',
-  ACTIVE = 'TASK_ACTIVE',
-  RUNNING = 'TASK_RUNNING',
-  RERUN = 'TASK_RERUN',
-  COMPLETED = 'TASK_COMPLETED',
-  PARTIAL = 'TASK_PARTIAL',
-  FAILED = 'TASK_FAILED',
-  CANCELLED = 'TASK_CANCELLED',
-}
-
-export type Pipeline = {
-  id: ID;
-  status: PipelineStatus;
-  beganAt: string | null;
-  finishedAt: string | null;
-  stage: number;
-  finishedTasks: number;
-  totalTasks: number;
-  message: string;
-};
-
-export type PipelineTask = {
-  id: ID;
-  plugin: string;
-  status: PipelineStatus;
-  pipelineRow: number;
-  pipelineCol: number;
-  beganAt: string | null;
-  finishedAt: string | null;
-  options: any;
-  message: string;
-  progressDetail?: {
-    finishedSubTasks: number;
-    totalSubTasks: number;
-  };
-};
diff --git a/config-ui/src/api/api-key/types.ts b/config-ui/src/types/api-key.ts
similarity index 96%
copy from config-ui/src/api/api-key/types.ts
copy to config-ui/src/types/api-key.ts
index 574b886f8..564cb0896 100644
--- a/config-ui/src/api/api-key/types.ts
+++ b/config-ui/src/types/api-key.ts
@@ -16,9 +16,9 @@
  *
  */
 
-export type Key = {
+export interface IApiKey {
   name: string;
   expiredAt?: string;
   allowedPath: string;
   creator: string;
-};
+}
diff --git a/config-ui/src/api/blueprint/types.ts b/config-ui/src/types/blueprint.ts
similarity index 84%
rename from config-ui/src/api/blueprint/types.ts
rename to config-ui/src/types/blueprint.ts
index ccb1876ac..5402322af 100644
--- a/config-ui/src/api/blueprint/types.ts
+++ b/config-ui/src/types/blueprint.ts
@@ -16,17 +16,17 @@
  *
  */
 
-export enum ModeEnum {
-  advanced = 'ADVANCED',
-  normal = 'NORMAL',
+export enum IBPMode {
+  ADVANCED = 'ADVANCED',
+  NORMAL = 'NORMAL',
 }
 
-export type Blueprint = {
-  projectName: string;
+export interface IBlueprint {
   id: ID;
-  enable: boolean;
   name: string;
-  mode: ModeEnum;
+  projectName: string;
+  mode: IBPMode;
+  enable: boolean;
   isManual: boolean;
   cronConfig: string;
   skipOnFail: boolean;
@@ -39,9 +39,4 @@ export type Blueprint = {
       scopeId: string;
     }>;
   }>;
-};
-
-export type TriggerQuery = {
-  skipCollectors: boolean;
-  fullSync: boolean;
-};
+}
diff --git a/config-ui/src/types/connection.ts b/config-ui/src/types/connection.ts
index 5a4e3625d..d85aaf6a8 100644
--- a/config-ui/src/types/connection.ts
+++ b/config-ui/src/types/connection.ts
@@ -24,11 +24,26 @@ export interface IConnectionAPI {
   token?: string;
   username?: string;
   password?: string;
-  proxy: string;
   apiKey?: string;
   dbUrl?: string;
   appId?: string;
   secretKey?: string;
+  enableGraphql?: boolean;
+  proxy: string;
+  rateLimitPerHour?: number;
+}
+
+export interface IConnectionTestResult {
+  message: string;
+  success: boolean;
+  login?: string;
+  installations?: Array<{
+    id: number;
+    account: {
+      login: string;
+    };
+  }>;
+  warning?: string;
 }
 
 export enum IConnectionStatus {
diff --git a/config-ui/src/routes/api-keys/types.ts b/config-ui/src/types/data-scope.ts
similarity index 90%
rename from config-ui/src/routes/api-keys/types.ts
rename to config-ui/src/types/data-scope.ts
index 574b886f8..b56662ebb 100644
--- a/config-ui/src/routes/api-keys/types.ts
+++ b/config-ui/src/types/data-scope.ts
@@ -16,9 +16,7 @@
  *
  */
 
-export type Key = {
+export interface IDataScope {
   name: string;
-  expiredAt?: string;
-  allowedPath: string;
-  creator: string;
-};
+  fullName: string;
+}
diff --git a/config-ui/src/types/index.ts b/config-ui/src/types/index.ts
index beb1b9f0a..1f99f1113 100644
--- a/config-ui/src/types/index.ts
+++ b/config-ui/src/types/index.ts
@@ -16,7 +16,14 @@
  *
  */
 
+export * from './api-key';
+export * from './blueprint';
 export * from './connection';
+export * from './data-scope';
+export * from './pipeline';
 export * from './plugin';
+export * from './project';
+export * from './scope-config';
 export * from './status';
+export * from './task';
 export * from './webhook';
diff --git a/config-ui/src/api/pipeline/types.ts b/config-ui/src/types/pipeline.ts
similarity index 93%
rename from config-ui/src/api/pipeline/types.ts
rename to config-ui/src/types/pipeline.ts
index f1fbc462b..fcf10610e 100644
--- a/config-ui/src/api/pipeline/types.ts
+++ b/config-ui/src/types/pipeline.ts
@@ -16,7 +16,7 @@
  *
  */
 
-export enum PipelineStatus {
+export enum IPipelineStatus {
   CREATED = 'TASK_CREATED',
   PENDING = 'TASK_PENDING',
   ACTIVE = 'TASK_ACTIVE',
@@ -28,13 +28,13 @@ export enum PipelineStatus {
   CANCELLED = 'TASK_CANCELLED',
 }
 
-export type Pipeline = {
+export interface IPipeline {
   id: ID;
-  status: PipelineStatus;
+  status: IPipelineStatus;
   beganAt: string | null;
   finishedAt: string | null;
   stage: number;
   finishedTasks: number;
   totalTasks: number;
   message: string;
-};
+}
diff --git a/config-ui/src/pages/project/types.ts b/config-ui/src/types/project.ts
similarity index 83%
rename from config-ui/src/pages/project/types.ts
rename to config-ui/src/types/project.ts
index 37d4573ce..eea0d761d 100644
--- a/config-ui/src/pages/project/types.ts
+++ b/config-ui/src/types/project.ts
@@ -16,11 +16,14 @@
  *
  */
 
-import type { BlueprintType } from '@/pages';
+import { IBlueprint } from './blueprint';
+import { IPipeline } from './pipeline';
 
-export type ProjectType = {
+export interface IProject {
   name: string;
   description: string;
-  blueprint: BlueprintType;
+  blueprint: IBlueprint;
   metrics: Array<{ pluginName: string; pluginOption: string; enable: boolean }>;
-};
+  createdAt?: string;
+  lastPipeline?: IPipeline;
+}
diff --git a/config-ui/src/api/api-key/types.ts b/config-ui/src/types/scope-config.ts
similarity index 90%
rename from config-ui/src/api/api-key/types.ts
rename to config-ui/src/types/scope-config.ts
index 574b886f8..a737a8997 100644
--- a/config-ui/src/api/api-key/types.ts
+++ b/config-ui/src/types/scope-config.ts
@@ -16,9 +16,6 @@
  *
  */
 
-export type Key = {
+export interface IScopeConfig {
   name: string;
-  expiredAt?: string;
-  allowedPath: string;
-  creator: string;
-};
+}
diff --git a/config-ui/src/api/project/types.ts b/config-ui/src/types/task.ts
similarity index 69%
rename from config-ui/src/api/project/types.ts
rename to config-ui/src/types/task.ts
index 6f7a3c8a3..631c26ea9 100644
--- a/config-ui/src/api/project/types.ts
+++ b/config-ui/src/types/task.ts
@@ -16,14 +16,20 @@
  *
  */
 
-import { Blueprint } from '../blueprint/types';
-import { Pipeline } from '../pipeline/types';
+import { IPipelineStatus } from './pipeline';
 
-export type Project = {
-  name: string;
-  description: string;
-  metrics: Array<{ pluginName: string; pluginOption: string; enable: boolean }>;
-  createdAt: string;
-  blueprint: Blueprint;
-  lastPipeline: Pipeline;
-};
+export interface ITask {
+  id: ID;
+  plugin: string;
+  status: IPipelineStatus;
+  pipelineRow: number;
+  pipelineCol: number;
+  beganAt: string | null;
+  finishedAt: string | null;
+  options: any;
+  message: string;
+  progressDetail?: {
+    finishedSubTasks: number;
+    totalSubTasks: number;
+  };
+}