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/03/27 07:23:02 UTC
[incubator-devlake] branch main updated: fix(config-ui): some plugins do not have transformation (#4782)
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 83e7c3e22 fix(config-ui): some plugins do not have transformation (#4782)
83e7c3e22 is described below
commit 83e7c3e22f3c24b09b978e4e65c1fa6dd29ebb66
Author: 青湛 <0x...@gmail.com>
AuthorDate: Mon Mar 27 15:22:55 2023 +0800
fix(config-ui): some plugins do not have transformation (#4782)
---
config-ui/src/global.d.ts | 1 +
.../blueprint/connection-add/components/step-1.tsx | 1 +
.../pages/blueprint/connection-detail/index.tsx | 1 +
.../pages/blueprint/create/components/step-1.tsx | 1 +
.../plugins/components/transformation/index.tsx | 46 ++++++++++++----------
config-ui/src/store/connections/types.ts | 1 +
.../src/store/connections/use-context-value.ts | 4 +-
7 files changed, 33 insertions(+), 22 deletions(-)
diff --git a/config-ui/src/global.d.ts b/config-ui/src/global.d.ts
index 2c326fff9..b4ada8935 100644
--- a/config-ui/src/global.d.ts
+++ b/config-ui/src/global.d.ts
@@ -29,6 +29,7 @@ type MixConnection = {
entities: string[];
}>;
origin: Array<any>;
+ noTS: boolean;
};
declare module '*.svg' {
diff --git a/config-ui/src/pages/blueprint/connection-add/components/step-1.tsx b/config-ui/src/pages/blueprint/connection-add/components/step-1.tsx
index 1188c448d..e771d1a14 100644
--- a/config-ui/src/pages/blueprint/connection-add/components/step-1.tsx
+++ b/config-ui/src/pages/blueprint/connection-add/components/step-1.tsx
@@ -52,6 +52,7 @@ export const Step1 = () => {
icon: connection.icon,
scope: [],
origin: [],
+ noTS: connection.noTS,
});
},
}}
diff --git a/config-ui/src/pages/blueprint/connection-detail/index.tsx b/config-ui/src/pages/blueprint/connection-detail/index.tsx
index 966706e49..4e57deec4 100644
--- a/config-ui/src/pages/blueprint/connection-detail/index.tsx
+++ b/config-ui/src/pages/blueprint/connection-detail/index.tsx
@@ -60,6 +60,7 @@ export const BlueprintConnectionDetailPage = () => {
icon: config.icon,
scope,
origin,
+ noTS: connection.noTS,
},
};
}, [version]);
diff --git a/config-ui/src/pages/blueprint/create/components/step-1.tsx b/config-ui/src/pages/blueprint/create/components/step-1.tsx
index 72732196a..99b44a05c 100644
--- a/config-ui/src/pages/blueprint/create/components/step-1.tsx
+++ b/config-ui/src/pages/blueprint/create/components/step-1.tsx
@@ -99,6 +99,7 @@ export const Step1 = ({ from }: Props) => {
icon: sc.icon,
scope: [],
origin: [],
+ noTS: sc.noTS,
})),
);
}}
diff --git a/config-ui/src/plugins/components/transformation/index.tsx b/config-ui/src/plugins/components/transformation/index.tsx
index 73c97be03..1cf47732a 100644
--- a/config-ui/src/plugins/components/transformation/index.tsx
+++ b/config-ui/src/plugins/components/transformation/index.tsx
@@ -99,16 +99,18 @@ export const Transformation = ({
<span>{cs.name}</span>
</S.Title>
)}
- <S.Action>
- <Button
- intent={Intent.PRIMARY}
- icon="annotation"
- disabled={!selected[cs.unique] || !selected[cs.unique].length}
- onClick={() => setConnection(cs)}
- >
- Select Transformation
- </Button>
- </S.Action>
+ {!cs.noTS && (
+ <S.Action>
+ <Button
+ intent={Intent.PRIMARY}
+ icon="annotation"
+ disabled={!selected[cs.unique] || !selected[cs.unique].length}
+ onClick={() => setConnection(cs)}
+ >
+ Select Transformation
+ </Button>
+ </S.Action>
+ )}
<Table
columns={[
{ title: 'Data Scope', dataIndex: 'name', key: 'name' },
@@ -120,17 +122,19 @@ export const Transformation = ({
render: (val, row) => (
<div>
<span>{val ?? 'N/A'}</span>
- <IconButton
- icon="annotation"
- tooltip="Select Transformation"
- onClick={() => {
- setSelected({
- ...selected,
- [`${cs.unique}`]: [row[getPluginId(cs.plugin)]],
- });
- setConnection(cs);
- }}
- />
+ {!cs.noTS && (
+ <IconButton
+ icon="annotation"
+ tooltip="Select Transformation"
+ onClick={() => {
+ setSelected({
+ ...selected,
+ [`${cs.unique}`]: [row[getPluginId(cs.plugin)]],
+ });
+ setConnection(cs);
+ }}
+ />
+ )}
</div>
),
},
diff --git a/config-ui/src/store/connections/types.ts b/config-ui/src/store/connections/types.ts
index f9c543b7d..e19f73823 100644
--- a/config-ui/src/store/connections/types.ts
+++ b/config-ui/src/store/connections/types.ts
@@ -31,6 +31,7 @@ export type ConnectionItemType = {
name: string;
icon: string;
entities: string[];
+ noTS: boolean;
endpoint: string;
proxy: string;
token?: string;
diff --git a/config-ui/src/store/connections/use-context-value.ts b/config-ui/src/store/connections/use-context-value.ts
index 036790d54..d86e54b7c 100644
--- a/config-ui/src/store/connections/use-context-value.ts
+++ b/config-ui/src/store/connections/use-context-value.ts
@@ -57,13 +57,14 @@ export const useContextValue = ({ plugin, filterBeta = false, filter }: UseConte
const resWithPlugin = res.map((cs, i) =>
cs.map((it: any) => {
- const { plugin, icon, entities } = allConnections[i];
+ const { plugin, icon, entities, transformation } = allConnections[i];
return {
...it,
plugin,
icon,
entities,
+ noTS: !transformation,
};
}),
);
@@ -77,6 +78,7 @@ export const useContextValue = ({ plugin, filterBeta = false, filter }: UseConte
name: it.name,
icon: it.icon,
entities: it.entities,
+ noTS: it.noTS,
endpoint: it.endpoint,
proxy: it.proxy,
token: it.token,