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/29 06:18:33 UTC
[incubator-devlake] branch main updated: fix(config-ui): missed initial value in data scope (#4806)
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 0f11e3f70 fix(config-ui): missed initial value in data scope (#4806)
0f11e3f70 is described below
commit 0f11e3f70381bbb45fc955de3766d2f8c4c8ca5e
Author: 青湛 <0x...@gmail.com>
AuthorDate: Wed Mar 29 14:18:28 2023 +0800
fix(config-ui): missed initial value in data scope (#4806)
---
.../pages/blueprint/connection-detail/index.tsx | 1 -
.../src/plugins/components/data-scope/index.tsx | 24 +++++++---------------
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/config-ui/src/pages/blueprint/connection-detail/index.tsx b/config-ui/src/pages/blueprint/connection-detail/index.tsx
index 60d9c8984..acc028a33 100644
--- a/config-ui/src/pages/blueprint/connection-detail/index.tsx
+++ b/config-ui/src/pages/blueprint/connection-detail/index.tsx
@@ -172,7 +172,6 @@ export const BlueprintConnectionDetailPage = () => {
>
<DataScope
connections={[connection]}
- initialScope={connection.origin}
onCancel={handleHideDataScope}
onSubmit={handleChangeDataScope}
onNext={handleHideDataScope}
diff --git a/config-ui/src/plugins/components/data-scope/index.tsx b/config-ui/src/plugins/components/data-scope/index.tsx
index 3722cd221..e4bb535d8 100644
--- a/config-ui/src/plugins/components/data-scope/index.tsx
+++ b/config-ui/src/plugins/components/data-scope/index.tsx
@@ -26,8 +26,6 @@ import * as S from './styled';
interface Props {
connections: MixConnection[];
- initialScope?: any[];
- initialEntities?: string[];
cancelBtnProps?: {
text?: string;
};
@@ -39,16 +37,7 @@ interface Props {
onNext?: () => void;
}
-export const DataScope = ({
- connections,
- initialScope,
- initialEntities,
- cancelBtnProps,
- submitBtnProps,
- onCancel,
- onSubmit,
- onNext,
-}: Props) => {
+export const DataScope = ({ connections, cancelBtnProps, submitBtnProps, onCancel, onSubmit, onNext }: Props) => {
const [connection, setConnection] = useState<MixConnection>();
const error = useMemo(() => (!connections.every((cs) => cs.scope.length) ? true : false), [connections]);
@@ -72,13 +61,14 @@ export const DataScope = ({
};
if (connections.length === 1) {
- const [{ plugin, connectionId, ...props }] = connections;
+ const [{ plugin, connectionId, scope, origin, ...props }] = connections;
+ const [{ entities }] = scope;
return (
<DataScopeForm
plugin={plugin}
connectionId={connectionId}
- initialScope={initialScope}
- initialEntities={initialEntities}
+ initialScope={origin}
+ initialEntities={entities}
cancelBtnProps={cancelBtnProps}
submitBtnProps={submitBtnProps}
onCancel={onCancel}
@@ -170,8 +160,8 @@ export const DataScope = ({
<DataScopeForm
plugin={connection.plugin}
connectionId={connection.connectionId}
- initialScope={initialScope}
- initialEntities={initialEntities}
+ initialScope={connection.origin}
+ initialEntities={connection.scope[0].entities}
onCancel={handleCancel}
onSubmit={(scope: MixConnection['scope'], origin: MixConnection['origin']) =>
handleSubmit(connection, scope, origin)