summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2025-05-16 21:40:23 +0530
committerSunil Shetye2025-05-16 21:40:23 +0530
commitbd896c5877a1293647b1a6ee486bb64df387be10 (patch)
tree5432224262d58bf542a17cb039be4fe36717ccb3
parentcceb2aeacd867e76e4efbf41920bf23f5cb0a260 (diff)
downloadCommon-Interface-Project-bd896c5877a1293647b1a6ee486bb64df387be10.tar.gz
Common-Interface-Project-bd896c5877a1293647b1a6ee486bb64df387be10.tar.bz2
Common-Interface-Project-bd896c5877a1293647b1a6ee486bb64df387be10.zip
remove child edges also
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js32
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js3
-rw-r--r--blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js3
3 files changed, 16 insertions, 22 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
index c09c333d..6715ef77 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js
@@ -43,8 +43,6 @@ export function saveXml (description = '') {
const node = enc.encode(model)
const pins = node.querySelectorAll('Object[as="errorFields"],Object[as="pins"]')
pins.forEach(pin => { pin.remove() })
- const id2 = node.querySelectorAll('[id="2"]')
- id2.forEach(id => { id.remove() })
const xcosDiagram = document.createElementNS('', 'XcosDiagram')
xcosDiagram.setAttribute('background', '-1')
xcosDiagram.setAttribute('finalIntegrationTime', '0.5')
@@ -363,7 +361,8 @@ function parseXmlToGraph (xmlDoc, graph) {
let v1
let blockrotation
let firstportrotation
- graph.getModel().beginUpdate()
+ const model = graph.getModel()
+ model.beginUpdate()
let oldcellslength = 0
@@ -526,8 +525,8 @@ function parseXmlToGraph (xmlDoc, graph) {
const source = cellAttrs.sourceVertex.value
const target = cellAttrs.targetVertex.value
- const sourceCell = graph.getModel().getCell(source)
- const targetCell = graph.getModel().getCell(target)
+ const sourceCell = model.getCell(source)
+ const targetCell = model.getCell(target)
const msgSource = (sourceCell == null) ? ' (not found)' : ''
const msgTarget = (targetCell == null) ? ' (not found)' : ''
if (sourceCell == null || targetCell == null) {
@@ -564,19 +563,6 @@ function parseXmlToGraph (xmlDoc, graph) {
try {
const edge = graph.insertEdge(parent, edgeId, null, sourceCell, targetCell)
- if (edgeId == "2") {
- console.log("ID=2")
- }
- const enc = new mxCodec(mxUtils.createXmlDocument())
- const model = graph.getModel()
- const node = enc.encode(model)
- const element = node.querySelector('[id="2"]');
- if (element != null) {
- const ele = node.querySelector('[id="' + edgeId + '"]');
- console.log('edgeId:', edgeId, edge)
- console.log('ele:', ele)
- }
-
edge.tarx = cellAttrs.tarx.value
edge.tary = cellAttrs.tary.value
edge.tar2x = cellAttrs.tar2x.value
@@ -613,12 +599,18 @@ function parseXmlToGraph (xmlDoc, graph) {
}
graph.view.refresh()
} finally {
- graph.getModel().endUpdate()
+ model.endUpdate()
}
}
export function renderGalleryXML (xml) {
- graph.removeCells(graph.getChildVertices(graph.getDefaultParent()))
+ if (!graph) {
+ console.log('graph is not initialized')
+ return
+ }
+ const parent = graph.getDefaultParent()
+ graph.removeCells(graph.getChildVertices(parent))
+ graph.removeCells(graph.getChildEdges(parent))
graph.view.refresh()
const xmlDoc = mxUtils.parseXml(xml)
parseXmlToGraph(xmlDoc, graph)
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js b/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
index eb654c3a..b4e7db1e 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SchematicToolbar.js
@@ -33,6 +33,7 @@ import mxGraphFactory from 'mxgraph'
import { NetlistModal, HelpScreen, ImageExportDialog, OpenSchDialog, ScriptScreen } from './ToolbarExtension'
import { editorZoomIn, editorZoomOut, editorZoomAct, deleteComp, PrintPreview, Rotate, editorUndo, editorRedo, saveXml, ClearGrid, renderGalleryXML } from './Helper/ToolbarTools'
import { useSelector, useDispatch } from 'react-redux'
+import store from '../../redux/store'
import { closeCompProperties } from '../../redux/componentPropertiesSlice'
import { setSchXmlData, saveSchematic, openLocalSch, setLoadingDiagram } from '../../redux/saveSchematicSlice'
import { toggleSimulate } from '../../redux/schematicEditorSlice'
@@ -101,7 +102,6 @@ export default function SchematicToolbar ({ mobileClose, gridRef }) {
const description = useSelector(state => state.saveSchematic.description)
const xmlData = useSelector(state => state.saveSchematic.xmlData)
const title2 = useSelector(state => state.saveSchematic.title)
- const scriptTaskId = useSelector(state => state.simulation.scriptTaskId)
const scriptDump = useSelector(state => state.saveSchematic.scriptDump)
const showDot = useSelector(state => state.saveSchematic.showDot)
@@ -331,6 +331,7 @@ export default function SchematicToolbar ({ mobileClose, gridRef }) {
const xmlBlob = new Blob([xmlContent], { type: 'application/xml' })
const xmlFileName = title2 + '.xml'
+ const scriptTaskId = store.getState().simulation.scriptTaskId
const formData = new FormData()
formData.append('file', xmlBlob, xmlFileName)
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js b/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
index 388ae451..8461f1ce 100644
--- a/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
+++ b/blocks/eda-frontend/src/components/SchematicEditor/SimulationProperties.js
@@ -15,6 +15,7 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore'
import { makeStyles } from '@material-ui/core/styles'
import { useSelector, useDispatch } from 'react-redux'
+import store from '../../redux/store'
import { setResultTitle, setResultTaskId, resetResult } from '../../redux/simulationSlice'
import { saveXml } from './Helper/ToolbarTools'
import SimulationScreen, { setGraphStatusClosed } from './SimulationScreen'
@@ -46,7 +47,6 @@ const useStyles = makeStyles((theme) => ({
export default function SimulationProperties () {
const title = useSelector(state => state.saveSchematic.title)
const isSimRes = useSelector(state => state.simulation.isSimRes)
- const scriptTaskId = useSelector(state => state.simulation.scriptTaskId)
const dispatch = useDispatch()
const classes = useStyles()
const [transientAnalysisControlLine, setTransientAnalysisControlLine] = useState({
@@ -109,6 +109,7 @@ export default function SimulationProperties () {
// Upload the nelist
async function netlistConfig (file, type) {
+ const scriptTaskId = store.getState().simulation.scriptTaskId
const formData = new FormData()
formData.append('app_name', process.env.REACT_APP_NAME)
formData.append('file', file)