完成节点的编辑窗口
This commit is contained in:
parent
6cf0af4528
commit
a469133446
@ -111,7 +111,7 @@ function FlowContent(): ReactNode {
|
|||||||
const handleUpdateNode = (updatedData: NodeData): void => {
|
const handleUpdateNode = (updatedData: NodeData): void => {
|
||||||
setNodes((prev) =>
|
setNodes((prev) =>
|
||||||
prev.map((node) => {
|
prev.map((node) => {
|
||||||
if (node.data.label === editingNode?.label) {
|
if (node.data.id === editingNode?.id) {
|
||||||
return { ...node, data: updatedData };
|
return { ...node, data: updatedData };
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
9
src/TODO.md
Normal file
9
src/TODO.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
## 产品基本功能实现待办事项
|
||||||
|
|
||||||
|
- [x] 完成节点的编辑窗口
|
||||||
|
- [ ] 完成边的编辑窗口
|
||||||
|
- [ ] 完成全局设置编辑窗口以及相关联动
|
||||||
|
- [ ] 实现配置生成逻辑,并验证有效
|
||||||
|
- [ ] 实现配置保存和加载功能
|
||||||
|
- [ ] 实现加密功能(完全加密和只加密私钥)
|
||||||
|
- [ ] 完成!奖励自己
|
||||||
@ -3,7 +3,17 @@ import { NodeData, Settings } from '../types/graph';
|
|||||||
import { generateWireGuardPrivateKey } from '../utils/wireguardConfig'
|
import { generateWireGuardPrivateKey } from '../utils/wireguardConfig'
|
||||||
import './NodeEditor.css';
|
import './NodeEditor.css';
|
||||||
import Folder from './Folder'
|
import Folder from './Folder'
|
||||||
import { randomBytes } from 'tweetnacl';
|
|
||||||
|
|
||||||
|
interface Validation {
|
||||||
|
isValid: boolean,
|
||||||
|
errors: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateNodeConfig(formData : NodeData) : Validation {
|
||||||
|
// todo
|
||||||
|
return {isValid : true, errors: []}
|
||||||
|
}
|
||||||
|
|
||||||
interface NodeEditorProps {
|
interface NodeEditorProps {
|
||||||
node: NodeData;
|
node: NodeData;
|
||||||
@ -30,16 +40,14 @@ export default function NodeEditor({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSave = (): void => {
|
const handleSave = (): void => {
|
||||||
setErrors(["123"])
|
const validation = validateNodeConfig(formData);
|
||||||
// const validation = validateNodeConfig(formData);
|
if (!validation.isValid) {
|
||||||
// if (!validation.isValid) {
|
setErrors(validation.errors);
|
||||||
// setErrors(validation.errors);
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
setErrors([]);
|
||||||
|
onUpdate(formData);
|
||||||
// setErrors([]);
|
onClose();
|
||||||
// onUpdate(formData);
|
|
||||||
// onClose();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGenerateKey = (): void => {
|
const handleGenerateKey = (): void => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user