- Define the relations
+ Define relations
- After creating your data models in step 2, you can specify how they
- should be joined together by defining the relationships. We will
- automatically create the relations based on the 'primary' and 'foreign'
- in your data sources.{` `}
-
- Learn more
-
+ You can define the relations among selected tables. We will
+ automatically list suggested relations based on the primary and foreign
+ key you have already defined in your data source. Relations will be
+ added into data models.
{Object.entries(relations).map(([modelName, relations = []], index) => (
@@ -217,19 +240,32 @@ export default function DefineRelations(props: Props) {
-
-
{
if (selectedRelation?.defaultValue) {
onUpdateRelation(
@@ -243,12 +279,12 @@ export default function DefineRelations(props: Props) {
setSelectedRelation(null);
}}
onClose={onCloseModal}
- allowSetDescription={false}
defaultValue={
selectedRelation?.defaultValue
? omit(selectedRelation.defaultValue, ['isAutoGenerated'])
: undefined
}
+ relations={relations}
/>
);
diff --git a/wren-ui/src/components/pages/setup/RecommendRelations.tsx b/wren-ui/src/components/pages/setup/RecommendRelations.tsx
deleted file mode 100644
index 3591c4a66..000000000
--- a/wren-ui/src/components/pages/setup/RecommendRelations.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-import Link from 'next/link';
-import { Button, Col, Form, Row, Typography } from 'antd';
-import type { ColumnsType } from 'antd/es/table';
-import ModelRelationSelectionTable, {
- RelationsDataType,
-} from '@/components/table/ModelRelationSelectionTable';
-import { SelectedRecommendRelations } from '@/components/pages/setup/DefineRelations';
-import { makeIterable, IterableComponent } from '@/utils/iteration';
-import { getJoinTypeText } from '@/utils/data';
-
-const { Title, Text } = Typography;
-
-interface Props {
- // TODO: update type when connecting to backend
- recommendRelations: Array<{
- name: string;
- relations: RelationsDataType[];
- }>;
- onNext: (data: SelectedRecommendRelations) => void;
- onBack: () => void;
-}
-
-export const columns: ColumnsType