Skip to content

Commit

Permalink
fix: 修复图构建模块的体验问题 (#37)
Browse files Browse the repository at this point in the history
* fix: 修复bug

* fix: 默认主键为必填
  • Loading branch information
Moyee authored Nov 13, 2023
1 parent bf81854 commit 28e6d3c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export const AddNodesEdges: React.FC<Prop> = ({
configList: Array<IndexData>;
}>({
startList: [],
attrList: [],
attrList: [{
id: 'primary-key',
name: '',
type: '',
optional: false
}],
configList: [],
});
const { startList, attrList, configList } = state;
Expand All @@ -59,7 +64,7 @@ export const AddNodesEdges: React.FC<Prop> = ({

const propertyList = () => {
const attrPropertyNames = map(
filter(attrList, attr => !attr.optional),
filter(attrList, attr => !attr.optional && attr.id !== 'primary-key'),
item => item.name,
);
const indexPropertyNames = map(configList, item => item.propertyName);
Expand Down Expand Up @@ -141,6 +146,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
),
},
];

const defaultColumns: EditColumnsType<AttrData> = [
{
title: (
Expand Down Expand Up @@ -186,6 +192,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
inputType: EditType.SELECT,
prop: {
defaultValue: false,
disabled: record.id === 'primary-key',
options: [
{ label: '否', value: false },
{ label: '是', value: true },
Expand All @@ -198,7 +205,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
title: '操作',
dataIndex: 'operate',
key: 'operate',
render: (_, record: any) => (
render: (_, record: any) => (record.id === 'primary-key' ? <a style={{ color: 'rgba(54,55,64,1)' }}>主键</a> :
<Popconfirm
title="确定要删除吗?"
onConfirm={() => {
Expand Down Expand Up @@ -269,31 +276,31 @@ export const AddNodesEdges: React.FC<Prop> = ({
};
},
},
{
title: (
<>
主键
<Tooltip title="主键必须是唯一索引">
<QuestionCircleOutlined />
</Tooltip>
</>
),
dataIndex: 'primaryField',
width: '17.5%',
key: 'primaryField',
editable: true,
editorConfig: (record: IndexData) => {
return {
inputType: EditType.SELECT,
prop: {
options: [
{ label: '否', value: false },
{ label: '是', value: true },
],
},
};
},
},
// {
// title: (
// <>
// 主键
// <Tooltip title="主键必须是唯一索引">
// <QuestionCircleOutlined />
// </Tooltip>
// </>
// ),
// dataIndex: 'primaryField',
// width: '17.5%',
// key: 'primaryField',
// editable: true,
// editorConfig: (record: IndexData) => {
// return {
// inputType: EditType.SELECT,
// prop: {
// options: [
// { label: '否', value: false },
// { label: '是', value: true },
// ],
// },
// };
// },
// },
{
title: '操作',
dataIndex: 'operate',
Expand Down Expand Up @@ -340,6 +347,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
draft.startList = [...list];
});
};

return (
<SwitchDrawer
visible={visible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"@codemirror/lang-java": "^6.0.1",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-python": "^6.1.2",
"@difizen/cofine-editor-core": "^0.0.1-alpha.4",
"@difizen/cofine-language-cypher": "^0.0.1-alpha.4",
"@uiw/react-codemirror": "^4.20.2",
"@umijs/plugin-request": "^2.9.0",
"ahooks": "^3.7.2",
Expand All @@ -31,9 +33,7 @@
"tsparticles": "2.9.3",
"umi": "^3.5.20",
"umi-request": "^1.4.0",
"use-immer": "^0.8.1",
"@difizen/cofine-editor-core": "^0.0.1-alpha.4",
"@difizen/cofine-language-cypher": "^0.0.1-alpha.4"
"use-immer": "^0.8.1"
},
"devDependencies": {
"@types/react": "^18.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1524,9 +1524,9 @@ export default {
},
"GI_ASSETS_TUGRAPH_DB": {
"name": "@tugraph/gi-assets-tugraph-db",
"version": "0.6.33",
"version": "0.6.35",
"global": "GI_ASSETS_TUGRAPH_DB",
"url": "https://gw.alipayobjects.com/os/lib/tugraph/gi-assets-tugraph-db/0.6.33/dist/index.min.js"
"url": "https://gw.alipayobjects.com/os/lib/tugraph/gi-assets-tugraph-db/0.6.35/dist/index.min.js"
}
}
}

0 comments on commit 28e6d3c

Please sign in to comment.