Skip to content

Commit

Permalink
Merge pull request #24 from TuGraph-family/update-analysis-0911
Browse files Browse the repository at this point in the history
fix: Update Graph Analysis Model
  • Loading branch information
baizn authored Sep 28, 2023
2 parents b6fb47a + 3526153 commit dbd174c
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 309 deletions.
43 changes: 42 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,48 @@
},
"resolutions": {
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0"
"@types/react-dom": "^17.0.0",
"umzug": "3.1.1",
"tsparticles-engine": "2.9.3",
"tsparticles-move-base": "2.9.3",
"tsparticles-shape-circle": "2.9.3",
"tsparticles-updater-color": "2.9.3",
"tsparticles-updater-opacity": "2.9.3",
"tsparticles-updater-out-modes": "2.9.3",
"tsparticles-updater-size": "2.9.3",
"tsparticles-interaction-external-trail": "2.9.3",
"tsparticles-plugin-absorbers": "2.9.3",
"tsparticles-plugin-emitters": "2.9.3",
"tsparticles-slim": "2.9.3",
"tsparticles-updater-destroy": "2.9.3",
"tsparticles-updater-roll": "2.9.3",
"tsparticles-updater-tilt": "2.9.3",
"tsparticles-updater-twinkle": "2.9.3",
"tsparticles-updater-wobble": "2.9.3",
"tsparticles-interaction-external-attract": "2.9.3",
"tsparticles-interaction-external-bounce": "2.9.3",
"tsparticles-interaction-external-bubble": "2.9.3",
"tsparticles-interaction-external-connect": "2.9.3",
"tsparticles-interaction-external-grab": "2.9.3",
"tsparticles-interaction-external-pause": "2.9.3",
"tsparticles-interaction-external-push": "2.9.3",
"tsparticles-interaction-external-remove": "2.9.3",
"tsparticles-interaction-external-repulse": "2.9.3",
"tsparticles-interaction-external-slow": "2.9.3",
"tsparticles-interaction-particles-attract": "2.9.3",
"tsparticles-interaction-particles-collisions": "2.9.3",
"tsparticles-interaction-particles-links": "2.9.3",
"tsparticles-move-parallax": "2.9.3",
"tsparticles-particles.js": "2.9.3",
"tsparticles-plugin-easing-quad": "2.9.3",
"tsparticles-shape-image": "2.9.3",
"tsparticles-shape-line": "2.9.3",
"tsparticles-shape-polygon": "2.9.3",
"tsparticles-shape-square": "2.9.3",
"tsparticles-shape-star": "2.9.3",
"tsparticles-shape-text": "2.9.3",
"tsparticles-updater-life": "2.9.3",
"tsparticles-updater-stroke-color": "2.9.3"
},
"dependencies": {
"@tugraph/openpiece-cli": "0.0.6",
Expand Down
2 changes: 1 addition & 1 deletion client/packages/app/client/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const umiConfig = getUmiConfig();

process.env.MFSU_AD = 'none';

const ANTD_VERSION = '4.23.5';
const ANTD_VERSION = '4.24.0';
const GI_SDK_APP_VERSION = '1.2.0';

export default defineConfig({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
overflow: hidden;
}
}
.ant-table-cell {
font-weight: 400;
font-size: 14px;
color: #6a6b71;
}
.ant-form-item-required {
color: #363740;
}
}
&-content {
padding: 0 24px 24px;
Expand All @@ -41,6 +49,12 @@
}
&-addbtn {
margin: 8px 0 10px 0;
&:hover {
border: 1px dashed #1650ff;
}
}
&-name:focus {
border: 1px solid #1650ff;
}
&-attr {
margin-bottom: 16px;
Expand All @@ -50,4 +64,7 @@
font-size: 14px;
color: rgba(54, 55, 64, 1);
}
&-attributes {
background-color: #1650ff;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Prop = {
data?: any;
onFinish?: (value?: any) => void;
onSwitch?: (onShow: () => void, onClose: () => void) => void;
onVisible?: (visible: boolean) => void;
};
interface EditColumnsType<T> extends ColumnsType<T> {
editorConfig: {
Expand All @@ -33,6 +34,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
data = [],
onFinish,
onSwitch,
onVisible,
}) => {
const [form] = Form.useForm();
const { visible, onShow, onClose } = useVisible({ defaultVisible: true });
Expand All @@ -50,18 +52,22 @@ export const AddNodesEdges: React.FC<Prop> = ({
useEffect(() => {
onSwitch?.(onShow, onClose);
}, []);
useEffect(() => {
onVisible?.(visible);
}, [visible]);

const propertyList = () => {
const attrPropertyNames = map(
filter(attrList, (attr) => !attr.optional),
(item) => item.name
filter(attrList, attr => !attr.optional),
item => item.name,
);
const indexPropertyNames = map(configList, (item) => item.propertyName);
const indexPropertyNames = map(configList, item => item.propertyName);
return map(
filter(
xor(attrPropertyNames, indexPropertyNames),
(item) => item !== undefined
item => item !== undefined,
),
(item) => ({ label: item, value: item })
item => ({ label: item, value: item }),
);
};
const addButton = (handleAdd?: () => void, text: string = '添加属性') => {
Expand All @@ -87,7 +93,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
return {
inputType: EditType.SELECT,
prop: {
options: map(data.nodes, (item) => ({
options: map(data.nodes, item => ({
label: item.labelName,
value: item.labelName,
})),
Expand All @@ -104,7 +110,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
return {
inputType: EditType.SELECT,
prop: {
options: map(data.nodes, (item) => ({
options: map(data.nodes, item => ({
label: item.labelName,
value: item.labelName,
})),
Expand All @@ -120,9 +126,9 @@ export const AddNodesEdges: React.FC<Prop> = ({
<Popconfirm
title="确定要删除吗?"
onConfirm={() => {
updateState((draft) => {
updateState(draft => {
draft.startList = [
...startList.filter((item) => item.id !== record?.id),
...startList.filter(item => item.id !== record?.id),
];
});
}}
Expand Down Expand Up @@ -194,9 +200,9 @@ export const AddNodesEdges: React.FC<Prop> = ({
<Popconfirm
title="确定要删除吗?"
onConfirm={() => {
updateState((draft) => {
updateState(draft => {
draft.attrList = [
...attrList.filter((item) => item.id !== record?.id),
...attrList.filter(item => item.id !== record?.id),
];
});
}}
Expand Down Expand Up @@ -294,9 +300,9 @@ export const AddNodesEdges: React.FC<Prop> = ({
<Popconfirm
title="确定要删除吗?"
onConfirm={() => {
updateState((draft) => {
updateState(draft => {
draft.configList = [
...configList.filter((item) => item.id !== record?.id),
...configList.filter(item => item.id !== record?.id),
];
});
}}
Expand All @@ -309,14 +315,14 @@ export const AddNodesEdges: React.FC<Prop> = ({
},
];
const addNodeAttr = () => {
updateState((draft) => {
updateState(draft => {
const list = [...attrList];
list.push({ id: attrList.length + 1 });
draft.attrList = [...list];
});
};
const addNodeConfig = () => {
updateState((draft) => {
updateState(draft => {
const list = [...configList];
list.push({
id: configList.length + 1,
Expand All @@ -326,7 +332,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
});
};
const addEdge = () => {
updateState((draft) => {
updateState(draft => {
const list = [...startList];
list.push({ id: `${startList.length + 1}` });
draft.startList = [...list];
Expand All @@ -347,7 +353,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
onClick={() => {
onClose();
form.resetFields();
updateState((draft) => {
updateState(draft => {
draft.startList = [];
draft.configList = [];
draft.attrList = [];
Expand All @@ -359,7 +365,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
<Button
onClick={() => {
const isEdgeRepeat =
uniq(map(startList, (item) => `${item.source}_${item.target}`))
uniq(map(startList, item => `${item.source}_${item.target}`))
.length === startList.length;
if (!isEdgeRepeat) {
return message.error('两条边的起点和终点不能相同');
Expand All @@ -375,7 +381,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
},
indexs: configList,
properties: attrList,
edgeConstraints: map(startList, (item) => {
edgeConstraints: map(startList, item => {
return [item.source, item.target];
}),
});
Expand All @@ -391,7 +397,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
<div className={styles[`${PUBLIC_PERFIX_CLASS}-container-header`]}>
<span> 添加{`${isNode ? '点' : '边'}`}类型</span>
<div>
命令行建模
<span style={{ marginRight: 4 }}>命令行建模</span>
<a href="https://tugraph.antgroup.com/doc" target="_blank">
参见文档
</a>
Expand All @@ -409,12 +415,12 @@ export const AddNodesEdges: React.FC<Prop> = ({
var reg = new RegExp('^[a-zA-Z0-9_\u4e00-\u9fa5]+$');
if (!value) {
return Promise.reject(
`请填写${isNode ? '点' : '边'}类型名称!`
`请填写${isNode ? '点' : '边'}类型名称!`,
);
}
if (!reg.test(value)) {
return Promise.reject(
'名称由中文、字母、数字、下划线组成。'
'名称由中文、字母、数字、下划线组成。',
);
} else {
return Promise.resolve();
Expand All @@ -426,6 +432,7 @@ export const AddNodesEdges: React.FC<Prop> = ({
<Input
autoComplete="off"
placeholder={`请输入${isNode ? '点' : '边'}类型名称`}
className={styles[`${PUBLIC_PERFIX_CLASS}-container-name`]}
/>
</Form.Item>
</Form>
Expand All @@ -434,11 +441,13 @@ export const AddNodesEdges: React.FC<Prop> = ({
属性列表
</p>
<EditTable
// className={styles[`${PUBLIC_PERFIX_CLASS}-container-attributes`]}
// style={{ background: 'red' }}
columns={defaultColumns}
dataSource={attrList}
rowKey="id"
onChange={(newData) => {
updateState((draft) => {
onChange={newData => {
updateState(draft => {
draft.attrList = [...(newData || [])];
});
}}
Expand All @@ -460,9 +469,9 @@ export const AddNodesEdges: React.FC<Prop> = ({
rowKey="id"
bordered
pagination={false}
onChange={(newData) => {
updateState((draft) => {
draft.startList = map([...newData], (item) => ({
onChange={newData => {
updateState(draft => {
draft.startList = map([...newData], item => ({
...item,
label: form.getFieldValue('name'),
style: { label: { value: form.getFieldValue('name') } },
Expand All @@ -485,8 +494,8 @@ export const AddNodesEdges: React.FC<Prop> = ({
columns={nodeConfigColumns}
dataSource={configList}
rowKey="id"
onChange={(newData) => {
updateState((draft) => {
onChange={newData => {
updateState(draft => {
draft.configList = [...newData];
});
}}
Expand Down
Loading

0 comments on commit dbd174c

Please sign in to comment.