From 048bf777997bdbf599240645fc66612c98abf3c2 Mon Sep 17 00:00:00 2001 From: vincent van beek Date: Fri, 27 Mar 2026 16:49:40 +0100 Subject: Add import topology (#393) * add a the posibility to import and export topogies in JSON format * fix web-runner integration, there were several bugs and mismatches between new implementations in OpenDC and the UI --- .../src/main/webui/components/projects/NewTopologyModal.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'opendc-web/opendc-web-server/src/main/webui/components/projects/NewTopologyModal.js') diff --git a/opendc-web/opendc-web-server/src/main/webui/components/projects/NewTopologyModal.js b/opendc-web/opendc-web-server/src/main/webui/components/projects/NewTopologyModal.js index 780ec034..68b7f150 100644 --- a/opendc-web/opendc-web-server/src/main/webui/components/projects/NewTopologyModal.js +++ b/opendc-web/opendc-web-server/src/main/webui/components/projects/NewTopologyModal.js @@ -54,7 +54,10 @@ const NewTopologyModal = ({ projectId, isOpen, onSubmit: onSubmitUpstream, onCan const name = nameInput.current.value if (!name) { - setErrors({ name: true }) + setErrors({ name: 'empty' }) + return false + } else if (topologies.some((topology) => topology.name === name)) { + setErrors({ name: 'duplicate' }) return false } else { const candidate = topologies.find((topology) => topology.id === originTopology) || { rooms: [] } @@ -83,7 +86,11 @@ const NewTopologyModal = ({ projectId, isOpen, onSubmit: onSubmitUpstream, onCan fieldId="name" isRequired validated={isSubmitted && errors.name ? 'error' : 'default'} - helperTextInvalid="This field cannot be empty" + helperTextInvalid={ + errors.name === 'empty' + ? 'This field cannot be empty' + : 'This topology name already exists' + } > -- cgit v1.2.3