From 31e0880e7af621e7f0ce35b5730fa56cbf316283 Mon Sep 17 00:00:00 2001 From: Mario Pesch Date: Fri, 19 Mar 2021 15:27:18 +0100 Subject: [PATCH] resolve warnings --- src/components/Blockly/blocks/logic.js | 15 ++++++++------- src/components/Blockly/blocks/sensebox-display.js | 2 +- src/components/Blockly/generator/sensebox-osem.js | 2 +- .../Blockly/generator/sensebox-sensors.js | 5 +++-- src/components/Blockly/msg/de/sensebox-display.js | 1 - src/components/Blockly/msg/de/sensebox-lora.js | 2 -- src/components/Blockly/msg/de/sensebox-osem.js | 1 - src/components/Blockly/msg/de/translations.js | 1 - src/components/Blockly/msg/en/sensebox-display.js | 2 -- src/components/Blockly/msg/en/sensebox-lora.js | 1 - src/components/Navbar.js | 12 ++++++++++++ src/components/Tutorial/Tutorial.js | 2 +- src/reducers/authReducer.js | 2 +- src/reducers/generalReducer.js | 2 +- src/reducers/messageReducer.js | 2 +- src/reducers/projectReducer.js | 2 +- src/reducers/tutorialBuilderReducer.js | 2 +- src/reducers/tutorialReducer.js | 4 ++-- src/reducers/workspaceReducer.js | 2 +- 19 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/components/Blockly/blocks/logic.js b/src/components/Blockly/blocks/logic.js index 87074c9..5d25ed9 100644 --- a/src/components/Blockly/blocks/logic.js +++ b/src/components/Blockly/blocks/logic.js @@ -136,11 +136,12 @@ Blockly.Blocks['controls_if'] = { saveConnections: function (containerBlock) { var clauseBlock = containerBlock.nextConnection.targetBlock(); var i = 1; + var inputDo; while (clauseBlock) { switch (clauseBlock.type) { case 'controls_if_elseif': var inputIf = this.getInput('IF' + i); - var inputDo = this.getInput('DO' + i); + inputDo = this.getInput('DO' + i); clauseBlock.valueConnection_ = inputIf && inputIf.connection.targetConnection; clauseBlock.statementConnection_ = @@ -148,7 +149,7 @@ Blockly.Blocks['controls_if'] = { i++; break; case 'controls_if_else': - var inputDo = this.getInput('ELSE'); + inputDo = this.getInput('ELSE'); clauseBlock.statementConnection_ = inputDo && inputDo.connection.targetConnection; break; @@ -169,11 +170,11 @@ Blockly.Blocks['controls_if'] = { if (this.getInput('ELSE')) { this.removeInput('ELSE'); } - var i = 1; - while (this.getInput('IF' + i)) { - this.removeInput('IF' + i); - this.removeInput('DO' + i); - i++; + var j = 1; + while (this.getInput('IF' + j)) { + this.removeInput('IF' + j); + this.removeInput('DO' + j); + j++; } // Rebuild block. for (var i = 1; i <= this.elseifCount_; i++) { diff --git a/src/components/Blockly/blocks/sensebox-display.js b/src/components/Blockly/blocks/sensebox-display.js index dd91705..23f8124 100644 --- a/src/components/Blockly/blocks/sensebox-display.js +++ b/src/components/Blockly/blocks/sensebox-display.js @@ -112,7 +112,7 @@ Blockly.Blocks['sensebox_display_fastPrint'] = { // Is the block nested in a loop? var block = this; do { - if (this.LOOP_TYPES.indexOf(block.type) != -1) { + if (this.LOOP_TYPES.indexOf(block.type) !== -1) { legal = true; break; } diff --git a/src/components/Blockly/generator/sensebox-osem.js b/src/components/Blockly/generator/sensebox-osem.js index 410dc7b..41f9ff2 100644 --- a/src/components/Blockly/generator/sensebox-osem.js +++ b/src/components/Blockly/generator/sensebox-osem.js @@ -24,7 +24,7 @@ Blockly.Arduino.sensebox_osem_connection = function (Block) { var ssl = this.getFieldValue('SSL'); var port = 0; var count = 0; - if (blocks != undefined) { + if (blocks !== undefined) { for (var i = 0; i < blocks.length; i++) { if (blocks[i].type === 'sensebox_send_to_osem') { count++; diff --git a/src/components/Blockly/generator/sensebox-sensors.js b/src/components/Blockly/generator/sensebox-sensors.js index 34bd9c2..34f6eab 100644 --- a/src/components/Blockly/generator/sensebox-sensors.js +++ b/src/components/Blockly/generator/sensebox-sensors.js @@ -350,6 +350,7 @@ Blockly.Arduino.sensebox_sensor_truebner_smt50 = function () { var dropdown_port = this.getFieldValue('Port') var dropdown_value = this.getFieldValue('value'); var dropdown_pin = 1; + var code = ''; if (dropdown_value === 'temp') { if (dropdown_port === 'A') { dropdown_pin = 1; @@ -361,7 +362,7 @@ Blockly.Arduino.sensebox_sensor_truebner_smt50 = function () { dropdown_pin = 5; } Blockly.Arduino.codeFunctions_['sensebox_smt50_temp'] = 'float getSMT50Temperature(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage - 0.5) * 100;\n}'; - var code = 'getSMT50Temperature(' + dropdown_pin + ')'; + code = 'getSMT50Temperature(' + dropdown_pin + ')'; return [code, Blockly.Arduino.ORDER_ATOMIC]; } else if (dropdown_value === 'soil') { @@ -375,7 +376,7 @@ Blockly.Arduino.sensebox_sensor_truebner_smt50 = function () { dropdown_pin = 6; } Blockly.Arduino.codeFunctions_['sensebox_smt50_soil'] = 'float getSMT50Moisture(int analogPin){\n int sensorValue = analogRead(analogPin);\n float voltage = sensorValue * (3.3 / 1024.0);\n return (voltage * 50) / 3;\n}'; - var code = 'getSMT50Moisture(' + dropdown_pin + ')'; + code = 'getSMT50Moisture(' + dropdown_pin + ')'; return [code, Blockly.Arduino.ORDER_ATOMIC]; } diff --git a/src/components/Blockly/msg/de/sensebox-display.js b/src/components/Blockly/msg/de/sensebox-display.js index 63309b4..90bce5c 100644 --- a/src/components/Blockly/msg/de/sensebox-display.js +++ b/src/components/Blockly/msg/de/sensebox-display.js @@ -33,7 +33,6 @@ export const DISPLAY = { senseBox_display_plotYRange2: "Y-Wertebereich Ende", senseBox_display_plotXTick: "X-Linienabstand", senseBox_display_plotYTick: "Y-Linienabstand", - senseBox_display_printDisplay_tooltip: "Mit diesem Block können automatisch Diagramme auf dem Display erstellt werden.", senseBox_display_plotTimeFrame: "Zeitabschnitt", sensebox_display_fillCircle: "Zeichne Punkt", sensebox_display_fillCircle_radius: "Radius", diff --git a/src/components/Blockly/msg/de/sensebox-lora.js b/src/components/Blockly/msg/de/sensebox-lora.js index bc07293..bb82897 100644 --- a/src/components/Blockly/msg/de/sensebox-lora.js +++ b/src/components/Blockly/msg/de/sensebox-lora.js @@ -40,7 +40,5 @@ export const LORA = { senseBox_LoRa_sensor_tip: "Sende einen Sensorwert mit einer bestimmten Anzahl an Bytes", senseBox_LoRa_init_abp_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über ABP. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere den **Network Session Key** und den **App Session Key** im **msb Format** und die **Device ID** im **hex Format**.", senseBox_LoRa_init_helpurl: "https://docs.sensebox.de/blockly/blockly-web-lora/", - senseBox_LoRa_init_otaa_tooltip: "Initialisiere die LoRa übertragung. Die Aktivierung erfolgt über OTAA. Registriere eine Application auf [thethingsnetwork](https://thethingsnetwork.com) und kopiere die **DEVICE EUI** und die **Application EUI** im **lsb Format** den **App Key** im **msb Format**.", - senseBox_LoRa_init_helpurl: "https://docs.sensebox.de/blockly/blockly-web-lora/", } \ No newline at end of file diff --git a/src/components/Blockly/msg/de/sensebox-osem.js b/src/components/Blockly/msg/de/sensebox-osem.js index 0d380ad..c363506 100644 --- a/src/components/Blockly/msg/de/sensebox-osem.js +++ b/src/components/Blockly/msg/de/sensebox-osem.js @@ -8,7 +8,6 @@ export const OSEM = { senseBox_osem_connection: "Verbinde mit openSenseMap:", senseBox_osem_host: "opensensemap.org", senseBox_osem_host_workshop: "workshop.opensensemap.org", - senseBox_osem_connection: "Verbinde mit openSenseMap", senseBox_osem_exposure: "Typ", senseBox_osem_stationary: "Stationär", senseBox_osem_mobile: "Mobil", diff --git a/src/components/Blockly/msg/de/translations.js b/src/components/Blockly/msg/de/translations.js index feec8d2..b375863 100644 --- a/src/components/Blockly/msg/de/translations.js +++ b/src/components/Blockly/msg/de/translations.js @@ -108,7 +108,6 @@ export const TRANSLATIONS = { NEW_VARIABLE_TITLE: "Name der neuen Variable:", ORDINAL_NUMBER_SUFFIX: "", PROCEDURES_ALLOW_STATEMENTS: "Aussagen erlauben", - PROCEDURES_BEFORE_PARAMS: "mit:", PROCEDURES_CALLNORETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29", PROCEDURES_CALLNORETURN_TOOLTIP: "Rufe einen Funktionsblock ohne Rückgabewert auf.", PROCEDURES_CALLRETURN_HELPURL: "https://de.wikipedia.org/wiki/Prozedur_%28Programmierung%29", diff --git a/src/components/Blockly/msg/en/sensebox-display.js b/src/components/Blockly/msg/en/sensebox-display.js index e231acf..3abb4ff 100644 --- a/src/components/Blockly/msg/en/sensebox-display.js +++ b/src/components/Blockly/msg/en/sensebox-display.js @@ -28,10 +28,8 @@ export const DISPLAY = { senseBox_display_plotXRange2: "X-Range End", senseBox_display_plotYRange1: "Y-Range Begin", senseBox_display_plotYRange2: "Y-Range End", - senseBox_display_plotXTick: "X-Linienabstand", senseBox_display_plotYTick: "Y-Tick", senseBox_display_plotXTick: "X-Tick", - senseBox_display_printDisplay_tooltip: "Use this Block to plot values on the OLED Display", senseBox_display_plotTimeFrame: "TimeFrame", sensebox_display_fillCircle: "Draw Point", sensebox_display_fillCircle_radius: "Radius", diff --git a/src/components/Blockly/msg/en/sensebox-lora.js b/src/components/Blockly/msg/en/sensebox-lora.js index bab0377..a5c1b45 100644 --- a/src/components/Blockly/msg/en/sensebox-lora.js +++ b/src/components/Blockly/msg/en/sensebox-lora.js @@ -44,7 +44,6 @@ export const LORA = { senseBox_LoRa_init_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-lora/", senseBox_LoRa_init_otaa_tooltip: "Initialize the LoRa transmission. The activation is done via OTAA. Register an application on [thethingsnetwork](https://thethingsnetwork.com) and copy the **DEVICE EUI** and the **Application EUI** in **lsb format** the **App Key** in **msb format**.", - senseBox_LoRa_init_helpurl: "https://en.docs.sensebox.de/blockly/blockly-web-lora/", } diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 5676d01..226650a 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -167,6 +167,11 @@ class Navbar extends Component { ); } + else { + return( + null + ) + } } )} @@ -188,7 +193,14 @@ class Navbar extends Component { ); } + else { + return( + null + ) + } + } + )} diff --git a/src/components/Tutorial/Tutorial.js b/src/components/Tutorial/Tutorial.js index 299c788..f3f6195 100644 --- a/src/components/Tutorial/Tutorial.js +++ b/src/components/Tutorial/Tutorial.js @@ -38,7 +38,7 @@ class Tutorial extends Component { // authentication is completed this.props.getTutorial(this.props.match.params.tutorialId); } - else if(this.props.tutorial && !this.props.isLoading && this.props.tutorial._id != this.props.match.params.tutorialId) { + else if(this.props.tutorial && !this.props.isLoading && this.props.tutorial._id !== this.props.match.params.tutorialId) { this.props.getTutorial(this.props.match.params.tutorialId); } if (this.props.message.id === 'GET_TUTORIAL_FAIL') { diff --git a/src/reducers/authReducer.js b/src/reducers/authReducer.js index 7de6fb8..5fc01bd 100644 --- a/src/reducers/authReducer.js +++ b/src/reducers/authReducer.js @@ -9,7 +9,7 @@ const initialState = { user: null }; -export default function(state = initialState, action){ +export default function foo(state = initialState, action){ switch(action.type){ case USER_LOADING: return { diff --git a/src/reducers/generalReducer.js b/src/reducers/generalReducer.js index b76d9c2..1571d63 100644 --- a/src/reducers/generalReducer.js +++ b/src/reducers/generalReducer.js @@ -32,7 +32,7 @@ const initialState = { statistics: initialStatistics() }; -export default function(state = initialState, action){ +export default function foo(state = initialState, action){ switch(action.type){ case VISIT: return { diff --git a/src/reducers/messageReducer.js b/src/reducers/messageReducer.js index c8579d7..2cbe8b1 100644 --- a/src/reducers/messageReducer.js +++ b/src/reducers/messageReducer.js @@ -6,7 +6,7 @@ const initialState = { id: null }; -export default function(state = initialState, action){ +export default function foo(state = initialState, action){ switch(action.type){ case GET_ERRORS: case GET_SUCCESS: diff --git a/src/reducers/projectReducer.js b/src/reducers/projectReducer.js index c97d298..98e2859 100644 --- a/src/reducers/projectReducer.js +++ b/src/reducers/projectReducer.js @@ -7,7 +7,7 @@ const initialState = { progress: false }; -export default function (state = initialState, action) { +export default function foo(state = initialState, action) { switch (action.type) { case PROJECT_PROGRESS: return { diff --git a/src/reducers/tutorialBuilderReducer.js b/src/reducers/tutorialBuilderReducer.js index bfbe654..817a892 100644 --- a/src/reducers/tutorialBuilderReducer.js +++ b/src/reducers/tutorialBuilderReducer.js @@ -21,7 +21,7 @@ const initialState = { } }; -export default function(state = initialState, action){ +export default function foo(state = initialState, action){ switch(action.type){ case BUILDER_CHANGE: return { diff --git a/src/reducers/tutorialReducer.js b/src/reducers/tutorialReducer.js index 0e368f8..a44a31f 100644 --- a/src/reducers/tutorialReducer.js +++ b/src/reducers/tutorialReducer.js @@ -1,4 +1,4 @@ -import { TUTORIAL_PROGRESS, GET_TUTORIAL, GET_TUTORIALS, GET_STATUS, TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_ID, TUTORIAL_STEP } from '../actions/types'; +import { TUTORIAL_PROGRESS, GET_TUTORIAL, GET_TUTORIALS, GET_STATUS, TUTORIAL_SUCCESS, TUTORIAL_ERROR, TUTORIAL_CHANGE, TUTORIAL_XML, TUTORIAL_STEP } from '../actions/types'; // @@ -21,7 +21,7 @@ const initialState = { progress: false }; -export default function (state = initialState, action) { +export default function foo(state = initialState, action) { switch (action.type) { case TUTORIAL_PROGRESS: return { diff --git a/src/reducers/workspaceReducer.js b/src/reducers/workspaceReducer.js index b9e3681..6e27fa1 100644 --- a/src/reducers/workspaceReducer.js +++ b/src/reducers/workspaceReducer.js @@ -16,7 +16,7 @@ const initialState = { name: null }; -export default function(state = initialState, action){ +export default function foo(state = initialState, action){ switch(action.type){ case NEW_CODE: return {