diff options
author | Sunil Shetye | 2021-09-28 15:17:29 +0530 |
---|---|---|
committer | Sunil Shetye | 2021-10-01 11:37:02 +0530 |
commit | 0b2dcebedeb355d184fd9b309c282f787b3e3bfc (patch) | |
tree | 0d7b31ad05b9760ad5437db3b0e9ecbb3e6e7b46 | |
parent | 15b2d48459e19cd8fca2545f4b2f28bc7d1ee087 (diff) | |
download | Common-Interface-Project-0b2dcebedeb355d184fd9b309c282f787b3e3bfc.tar.gz Common-Interface-Project-0b2dcebedeb355d184fd9b309c282f787b3e3bfc.tar.bz2 Common-Interface-Project-0b2dcebedeb355d184fd9b309c282f787b3e3bfc.zip |
fix some warnings from command
npx standard
7 files changed, 32 insertions, 34 deletions
diff --git a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js index 6888dbd2..9f1f5845 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/ComponentProperties.js @@ -45,8 +45,8 @@ export default function ComponentProperties () { Object.keys(val).map((keyName, i) => { if (keyName.match(/^p[0-9]*_value$/)) { const rootKeyName = keyName.substr(0, 4) - const type_id = rootKeyName + '_type' - if (compProperties !== undefined && compProperties[rootKeyName] !== null && compProperties[type_id] !== null) { + const typeId = rootKeyName + '_type' + if (compProperties !== undefined && compProperties[rootKeyName] !== null && compProperties[typeId] !== null) { return ( <ListItem key={i}> <TextField id={keyName} label={compProperties[rootKeyName]} value={val[keyName] || ''} size='small' variant='outlined' onChange={getInputValues} /> diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js index 5c84a80b..efad015f 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ComponentDrag.js @@ -353,9 +353,8 @@ export default function LoadGrid (container, sidebar, outline) { pt.x = Math.max(pt.x, Math.min(p0.x, pe.x)) } } - } - // Computes constraint connection points on vertices and ports - else if (terminal != null && terminal.cell.geometry.relative) { + } else if (terminal != null && terminal.cell.geometry.relative) { + // Computes constraint connection points on vertices and ports pt = new mxPoint(this.getRoutingCenterX(terminal), this.getRoutingCenterY(terminal)) } diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js index 959b3dce..ed27d855 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SideBar.js @@ -1,7 +1,7 @@ import 'mxgraph/javascript/src/css/common.css' import mxGraphFactory from 'mxgraph' -import { default_scale, getSvgMetadata } from './SvgParser.js' +import { defaultScale, getSvgMetadata } from './SvgParser.js' const { mxClient, @@ -69,8 +69,8 @@ export function AddComponent (component, imgref) { // Creates the element that is being for the actual preview. const dragElt = document.createElement('div') dragElt.style.border = 'dashed black 1px' - dragElt.style.width = (component.block_width / default_scale) + 'px' - dragElt.style.height = (component.block_height / default_scale) + 'px' + dragElt.style.width = (component.block_width / defaultScale) + 'px' + dragElt.style.height = (component.block_height / defaultScale) + 'px' // Drag source is configured to use dragElt for preview and as drag icon // if scalePreview (last) argument is true. Dx and dy are null to force diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js index 537b5076..ec5f5a33 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/SvgParser.js @@ -7,8 +7,8 @@ const { } = new mxGraphFactory() // we need to divide the svg width and height by the same number in order to maintain the aspect ratio. -export const default_scale = parseFloat(process.env.REACT_APP_BLOCK_SCALE) -export const port_size = parseFloat(process.env.REACT_APP_PORT_SIZE) +export const defaultScale = parseFloat(process.env.REACT_APP_BLOCK_SCALE) +export const portSize = parseFloat(process.env.REACT_APP_PORT_SIZE) function getParameter (i) { if (i < 10) { return 'p00' + i.toString() } else if (i < 100) { return 'p0' + i.toString() } else { return 'p' + i.toString() } @@ -19,14 +19,14 @@ export function getSvgMetadata (graph, parent, evt, target, x, y, component) { // initialize information from the svg meta // plots pinnumbers and component labels. - const allowed_part = [0, 1] - const allowed_dmg = [0, 1] + const allowedPart = [0, 1] + const allowedDmg = [0, 1] const block_name = component.block_name const pins = [] // make the component images smaller by scaling - const width = component.block_width / default_scale - const height = component.block_height / default_scale + const width = component.block_width / defaultScale + const height = component.block_height / defaultScale const v1 = graph.insertVertex(parent, null, null, x, y, width, height, block_name) v1.CellType = 'Component' @@ -50,24 +50,24 @@ export function getSvgMetadata (graph, parent, evt, target, x, y, component) { const ports = blockports.length for (let i = 0; i < ports; i++) { const blockport = blockports[i] - if (!allowed_part.includes(blockport.port_part)) { continue } - if (!allowed_dmg.includes(blockport.port_dmg)) { continue } + if (!allowedPart.includes(blockport.port_part)) { continue } + if (!allowedDmg.includes(blockport.port_dmg)) { continue } if (blockport.port_name === 'NC') { continue } - const x_pos = 1 / 2 + blockport.port_x / default_scale / width - const y_pos = 1 / 2 - blockport.port_y / default_scale / height + const xPos = 1 / 2 + blockport.port_x / defaultScale / width + const yPos = 1 / 2 - blockport.port_y / defaultScale / height const port_orientation = blockport.port_orientation let point = null switch (port_orientation) { - case 'ExplicitInputPort': case 'ImplicitInputPort': point = new mxPoint(-port_size, -port_size / 2); break - case 'ControlPort': point = new mxPoint(-port_size / 2, -port_size); break - case 'ExplicitOutputPort': case 'ImplicitOutputPort': point = new mxPoint(0, -port_size / 2); break - case 'CommandPort': point = new mxPoint(-port_size / 2, 0); break - default: point = new mxPoint(-port_size / 2, -port_size / 2); break + case 'ExplicitInputPort': case 'ImplicitInputPort': point = new mxPoint(-portSize, -portSize / 2); break + case 'ControlPort': point = new mxPoint(-portSize / 2, -portSize); break + case 'ExplicitOutputPort': case 'ImplicitOutputPort': point = new mxPoint(0, -portSize / 2); break + case 'CommandPort': point = new mxPoint(-portSize / 2, 0); break + default: point = new mxPoint(-portSize / 2, -portSize / 2); break } - const vp = graph.insertVertex(v1, null, null, x_pos, y_pos, port_size, port_size, port_orientation) + const vp = graph.insertVertex(v1, null, null, xPos, yPos, portSize, portSize, port_orientation) vp.geometry.relative = true vp.geometry.offset = point vp.CellType = 'Pin' diff --git a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js index 05e381d6..689a160f 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/Helper/ToolbarTools.js @@ -1,7 +1,7 @@ import 'mxgraph/javascript/src/css/common.css' import mxGraphFactory from 'mxgraph' -import { port_size } from './SvgParser' +import { portSize } from './SvgParser' import store from '../../../redux/store' import { setModel, setNetlist } from '../../../redux/actions/index' @@ -398,13 +398,13 @@ function parseXmlToGraph (xmlDoc, graph) { const yPos = (geom.y !== undefined) ? Number(geom.y.value) : 0 let point = null switch (style) { - case 'ExplicitInputPort': case 'ImplicitInputPort': point = new mxPoint(-port_size, -port_size / 2); break - case 'ControlPort': point = new mxPoint(-port_size / 2, -port_size); break - case 'ExplicitOutputPort': case 'ImplicitOutputPort': point = new mxPoint(0, -port_size / 2); break - case 'CommandPort': point = new mxPoint(-port_size / 2, 0); break - default: point = new mxPoint(-port_size / 2, -port_size / 2); break + case 'ExplicitInputPort': case 'ImplicitInputPort': point = new mxPoint(-portSize, -portSize / 2); break + case 'ControlPort': point = new mxPoint(-portSize / 2, -portSize); break + case 'ExplicitOutputPort': case 'ImplicitOutputPort': point = new mxPoint(0, -portSize / 2); break + case 'CommandPort': point = new mxPoint(-portSize / 2, 0); break + default: point = new mxPoint(-portSize / 2, -portSize / 2); break } - const vp = graph.insertVertex(v1, vertexId, null, xPos, yPos, port_size, port_size, style) + const vp = graph.insertVertex(v1, vertexId, null, xPos, yPos, portSize, portSize, style) vp.geometry.relative = true vp.geometry.offset = point vp.CellType = 'Pin' diff --git a/blocks/eda-frontend/src/components/Simulator/Editor.js b/blocks/eda-frontend/src/components/Simulator/Editor.js index 2656345b..b1c5fedc 100644 --- a/blocks/eda-frontend/src/components/Simulator/Editor.js +++ b/blocks/eda-frontend/src/components/Simulator/Editor.js @@ -15,7 +15,6 @@ export default function Editor (props) { editorProps={{ $blockScrolling: true }} - setOptions={{ enableBasicAutocompletion: true, enableLiveAutocompletion: true, diff --git a/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js b/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js index 4b05ddc8..296362ed 100644 --- a/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js +++ b/blocks/eda-frontend/src/redux/actions/componentPropertiesActions.js @@ -24,8 +24,8 @@ export const getCompProperties = (block) => (dispatch) => { // Actions for updating entered component properites on clicking set parameters export const setCompProperties = (id, parameter_values) => (dispatch) => { const url = 'setblockparameter' - const filtered_parameter_values = Object.fromEntries(Object.entries(parameter_values).filter(([k, v]) => v != null)) - const data = { block_id: id, ...filtered_parameter_values } + const filteredParameterValues = Object.fromEntries(Object.entries(parameter_values).filter(([k, v]) => v != null)) + const data = { block_id: id, ...filteredParameterValues } api.post(url, data) .then( (res) => { |