Skip to content

Commit

Permalink
rename loadingDiagram to setLoadingDiagram
Browse files Browse the repository at this point in the history
  • Loading branch information
sunilshetye committed Oct 14, 2024
1 parent 9b19fdf commit 46e5ca3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import mxGraphFactory from 'mxgraph'
import { NetlistModal, HelpScreen, ImageExportDialog, OpenSchDialog } from './ToolbarExtension'
import { editorZoomIn, editorZoomOut, editorZoomAct, deleteComp, PrintPreview, Rotate, generateNetList, editorUndo, editorRedo, saveXml, ClearGrid } from './Helper/ToolbarTools'
import { useSelector, useDispatch } from 'react-redux'
import { toggleSimulate, closeCompProperties, setSchXmlData, saveSchematic, openLocalSch, loadingDiagram } from '../../redux/actions/index'
import { toggleSimulate, closeCompProperties, setSchXmlData, saveSchematic, openLocalSch, setLoadingDiagram } from '../../redux/actions/index'
import api from '../../utils/Api'
import { transformXcos } from '../../utils/GalleryUtils'

Expand Down Expand Up @@ -402,7 +402,7 @@ export default function SchematicToolbar ({ mobileClose, gridRef }) {
if (re.test(filename)) {
const reader = new FileReader()
reader.onload = function (event) {
dispatch(loadingDiagram(true))
dispatch(setLoadingDiagram(true))
const title = filename.replace(re, '')
let dataDump = event.target.result
const xmlDoc = mxUtils.parseXml(dataDump)
Expand All @@ -411,11 +411,11 @@ export default function SchematicToolbar ({ mobileClose, gridRef }) {
transformXcos(xmlDoc).then(xmlDoc => {
dataDump = new XMLSerializer().serializeToString(xmlDoc)
readXmlFile(xmlDoc, dataDump, title)
dispatch(loadingDiagram(false))
dispatch(setLoadingDiagram(false))
})
} else {
readXmlFile(xmlDoc, dataDump, title)
dispatch(loadingDiagram(false))
dispatch(setLoadingDiagram(false))
}
}
reader.readAsText(file)
Expand Down
8 changes: 4 additions & 4 deletions blocks/eda-frontend/src/redux/actions/saveSchematicActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { renderGalleryXML } from '../../components/SchematicEditor/Helper/Toolba
import { setTitle } from './index'
import { transformXcos } from '../../utils/GalleryUtils'

export const loadingDiagram = (isLoading) => (dispatch) => {
export const setLoadingDiagram = (isLoading) => (dispatch) => {
dispatch({
type: actions.LOADING_DIAGRAM,
payload: {
Expand Down Expand Up @@ -174,7 +174,7 @@ export const loadGallery = (saveId) => (dispatch, getState) => {
return
}

dispatch(loadingDiagram(true))
dispatch(setLoadingDiagram(true))
// Check if the data is xcos or xml
const parser = new DOMParser()
const xmlDoc = parser.parseFromString(data.data_dump, 'application/xml')
Expand All @@ -196,13 +196,13 @@ export const loadGallery = (saveId) => (dispatch, getState) => {
transformXcos(xmlDoc).then(xmlDoc => {
const dataDump = new XMLSerializer().serializeToString(xmlDoc)
handleGalleryLoad(dispatch, data, dataDump)
dispatch(loadingDiagram(false))
dispatch(setLoadingDiagram(false))
}).catch(error => {
console.error('Error converting xcos to xml:', error)
})
} else {
handleGalleryLoad(dispatch, data, data.dataDump)
dispatch(loadingDiagram(false))
dispatch(setLoadingDiagram(false))
}
window.loadGalleryComplete = true
}
Expand Down

0 comments on commit 46e5ca3

Please sign in to comment.