diff options
author | Sunil Shetye | 2025-01-30 18:01:02 +0530 |
---|---|---|
committer | Sunil Shetye | 2025-01-31 11:19:37 +0530 |
commit | 71a410e0cb24429cbac00d4b170731ec6d265fea (patch) | |
tree | 4b85eddc6f51c3f0d6b7893587c78676c97b4df7 | |
parent | 9ec5ca0c07da1acac50ae721f7b3dbe06799ad7d (diff) | |
download | Common-Interface-Project-71a410e0cb24429cbac00d4b170731ec6d265fea.tar.gz Common-Interface-Project-71a410e0cb24429cbac00d4b170731ec6d265fea.tar.bz2 Common-Interface-Project-71a410e0cb24429cbac00d4b170731ec6d265fea.zip |
replace substr with substring
remove unused variables
5 files changed, 14 insertions, 15 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js index 87fd3653..a8d24ff0 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js @@ -225,7 +225,7 @@ export default function ComponentProperties () { const getInputValues = (evt) => { const value = evt.target.value.trim() // Trim to remove leading and trailing whitespace const fieldName = evt.target.id - const fieldRoot = fieldName.substr(0, 4) + const fieldRoot = fieldName.substring(0, 4) const typeId = fieldRoot + '_type' const fieldType = compProperties && compProperties[typeId] let isValid = true @@ -242,7 +242,7 @@ export default function ComponentProperties () { // For double type, check if the input is a valid number isValid = !isNaN(value) && !Number.isNaN(parseFloat(value)) break - // Add more cases for other types as needed + // Add more cases for other types as needed default: // For other types, no specific validation isValid = true diff --git a/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js index 75de22d9..997614c0 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/SimulationScreen.js @@ -469,7 +469,7 @@ export default function SimulationScreen ({ open, close }) { const x = parseFloat(data[8]) const y = parseFloat(data[9]) // store 2d-data - if (block !== 12) { + if (block !== SinkBlocks.CMATVIEW) { addPointToGraph(figureId, [x, y]) } else { const values = getPointsForData(data, data[8], data[10]) @@ -770,19 +770,19 @@ export default function SimulationScreen ({ open, close }) { }) : <div /> } - </> + </> : (isGraph === 'false') ? <span>{typography1}</span> : <span /> } {/* Diplay of Simulation parameter Not present */} { (error !== '') ? <Grid item xs={12} sm={12}> - <Paper className={classes.paper}> - <Typography variant='h4' align='center' gutterBottom> - {error} - </Typography> - </Paper> - </Grid> + <Paper className={classes.paper}> + <Typography variant='h4' align='center' gutterBottom> + {error} + </Typography> + </Paper> + </Grid> : <span /> } {/* Display text result */} diff --git a/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js b/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js index 39e4c9ce..6db29aec 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js @@ -34,7 +34,7 @@ import { import { makeStyles } from '@material-ui/core/styles' import CloseIcon from '@material-ui/icons/Close' import { useSelector, useDispatch } from 'react-redux' -import { fetchSchematics, fetchSchematic, loadGallery, fetchGallery } from '../../redux/actions/index' +import { fetchSchematics, fetchSchematic, fetchDiagram, fetchGallery } from '../../redux/actions/index' import { blue } from '@material-ui/core/colors' import { getDateTime as getDate } from '../../utils/GalleryUtils' @@ -446,7 +446,7 @@ export function OpenSchDialog (props) { <Button size='small' color='primary' - onClick={() => { dispatch(loadGallery(sch.save_id.substr(7, sch.save_id.length))) }} + onClick={() => { dispatch(fetchDiagram(sch.save_id)) }} variant={details.save_id === undefined ? 'outlined' : details.save_id !== sch.save_id ? 'outlined' : 'contained'} > Launch diff --git a/blocks/eda-frontend/src/pages/SchematicEditor.js b/blocks/eda-frontend/src/pages/SchematicEditor.js index 92e87600..61b078aa 100644 --- a/blocks/eda-frontend/src/pages/SchematicEditor.js +++ b/blocks/eda-frontend/src/pages/SchematicEditor.js @@ -35,7 +35,6 @@ export default function SchematicEditor (props) { const dispatch = useDispatch() const [mobileOpen, setMobileOpen] = useState(false) const isLoading = useSelector(state => state.saveSchematicReducer.isLoading) - const data = useSelector(state => state.saveSchematicReducer.data) const handleDrawerToggle = () => { setMobileOpen(!mobileOpen) @@ -52,7 +51,7 @@ export default function SchematicEditor (props) { const query = new URLSearchParams(props.location.search) const cktid = query.get('id') - if (cktid.substr(0, 7) === 'gallery') { + if (cktid.substring(0, 7) === 'gallery') { // Loading Gallery schemaic. dispatch(fetchDiagram(cktid)) diff --git a/blocks/eda-frontend/src/redux/actions/saveSchematicActions.js b/blocks/eda-frontend/src/redux/actions/saveSchematicActions.js index 7fabf2a5..38866273 100644 --- a/blocks/eda-frontend/src/redux/actions/saveSchematicActions.js +++ b/blocks/eda-frontend/src/redux/actions/saveSchematicActions.js @@ -127,7 +127,7 @@ export const fetchSchematic = (saveId) => (dispatch, getState) => { .catch((err) => { console.error(err) }) } -export const fetchDiagram = (saveId) => (dispatch, getState) => { +export const fetchDiagram = (saveId) => (dispatch) => { api.get('save/gallery/' + saveId) .then( (res) => { |