diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 274d11e..7cd3d79 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -9,7 +9,7 @@ jobs: actionlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: reviewdog/action-actionlint@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index e2f01a6..ec0eb9e 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run Labeler uses: crazy-max/ghaction-github-labeler@v3 diff --git a/aspnetapp/WINGS/ClientApp/package-lock.json b/aspnetapp/WINGS/ClientApp/package-lock.json index 14d818d..75f35aa 100644 --- a/aspnetapp/WINGS/ClientApp/package-lock.json +++ b/aspnetapp/WINGS/ClientApp/package-lock.json @@ -1,12 +1,12 @@ { "name": "wings", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wings", - "version": "3.0.0", + "version": "3.0.1", "dependencies": { "@babel/eslint-parser": "^7.24.7", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", @@ -138,9 +138,10 @@ } }, "node_modules/@babel/eslint-parser": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.24.7.tgz", - "integrity": "sha512-SO5E3bVxDuxyNxM5agFv480YA2HO6ohZbGxbazZdIk3KQOPOGVNw6q78I9/lbviIf95eq6tPozeYnJLbjnC8IA==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.24.8.tgz", + "integrity": "sha512-nYAikI4XTGokU2QX7Jx+v4rxZKhKivaQaREZjuW3mrJrbdWJ5yUfohnoUULge+zEEaKjPYNxhoRgUKktjXtbwA==", + "license": "MIT", "dependencies": { "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", "eslint-visitor-keys": "^2.1.0", @@ -3611,18 +3612,20 @@ } }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.20.tgz", - "integrity": "sha512-DoL2ppgldL16utL8nNyj/P12f8mCNdx/Hb/AJnX9rLY4b52hCMIx1kH83pbXQ6uMy6n54M3StmEbvSGoj2OFuA==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.16.4.tgz", + "integrity": "sha512-rNdHXhclwjEZnK+//3SR43YRx0VtjdHnUFhMSGYmAMJve+KiwEja/41EYh8V3pZKqF2geKyfcFUenTfDTYUR4w==", + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/mui-org" } }, "node_modules/@mui/icons-material": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.15.20.tgz", - "integrity": "sha512-oGcKmCuHaYbAAoLN67WKSXtHmEgyWcJToT1uRtmPyxMj9N5uqwc/mRtEnst4Wj/eGr+zYH2FiZQ79v9k7kSk1Q==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/icons-material/-/icons-material-5.16.4.tgz", + "integrity": "sha512-j9/CWctv6TH6Dou2uR2EH7UOgu79CW/YcozxCYVLJ7l03pCsiOlJ5sBArnWJxJ+nGkFwyL/1d1k8JEPMDR125A==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9" }, @@ -3645,15 +3648,16 @@ } }, "node_modules/@mui/lab": { - "version": "5.0.0-alpha.170", - "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.170.tgz", - "integrity": "sha512-0bDVECGmrNjd3+bLdcLiwYZ0O4HP5j5WSQm5DV6iA/Z9kr8O6AnvZ1bv9ImQbbX7Gj3pX4o43EKwCutj3EQxQg==", + "version": "5.0.0-alpha.172", + "resolved": "https://registry.npmjs.org/@mui/lab/-/lab-5.0.0-alpha.172.tgz", + "integrity": "sha512-stpa3WTsDE1HamFR4eeS6Bhxalm+u9FhzzNph/PrDMdWSRBHlJs2mqvZ6FEoO22O7MOCwNMqbXTkvEwsyEf0ew==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", "@mui/base": "5.0.0-beta.40", - "@mui/system": "^5.15.15", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.14", + "@mui/system": "^5.16.1", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.1", "clsx": "^2.1.0", "prop-types": "^15.8.1" }, @@ -3685,21 +3689,22 @@ } }, "node_modules/@mui/material": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.20.tgz", - "integrity": "sha512-tVq3l4qoXx/NxUgIx/x3lZiPn/5xDbdTE8VrLczNpfblLYZzlrbxA7kb9mI8NoBF6+w9WE9IrxWnKK5KlPI2bg==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.16.4.tgz", + "integrity": "sha512-dBnh3/zRYgEVIS3OE4oTbujse3gifA0qLMmuUk13ywsDCbngJsdgwW5LuYeiT5pfA8PGPGSqM7mxNytYXgiMCw==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/base": "5.0.0-beta.40", - "@mui/core-downloads-tracker": "^5.15.20", - "@mui/system": "^5.15.20", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.20", + "@mui/core-downloads-tracker": "^5.16.4", + "@mui/system": "^5.16.4", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.4", + "@popperjs/core": "^2.11.8", "@types/react-transition-group": "^4.4.10", "clsx": "^2.1.0", "csstype": "^3.1.3", "prop-types": "^15.8.1", - "react-is": "^18.2.0", + "react-is": "^18.3.1", "react-transition-group": "^4.4.5" }, "engines": { @@ -3729,12 +3734,13 @@ } }, "node_modules/@mui/private-theming": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.20.tgz", - "integrity": "sha512-BK8F94AIqSrnaPYXf2KAOjGZJgWfvqAVQ2gVR3EryvQFtuBnG6RwodxrCvd3B48VuMy6Wsk897+lQMUxJyk+6g==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.16.4.tgz", + "integrity": "sha512-ZsAm8cq31SJ37SVWLRlu02v9SRthxnfQofaiv14L5Bht51B0dz6yQEoVU/V8UduZDCCIrWkBHuReVfKhE/UuXA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/utils": "^5.15.20", + "@mui/utils": "^5.16.4", "prop-types": "^15.8.1" }, "engines": { @@ -3755,9 +3761,10 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.15.14", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.14.tgz", - "integrity": "sha512-RILkuVD8gY6PvjZjqnWhz8fu68dVkqhM5+jYWfB5yhlSQKg+2rHkmEwm75XIeAqI3qwOndK6zELK5H6Zxn4NHw==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.16.4.tgz", + "integrity": "sha512-0+mnkf+UiAmTVB8PZFqOhqf729Yh0Cxq29/5cA3VAyDVTRIUUQ8FXQhiAhUIbijFmM72rY80ahFPXIm4WDbzcA==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", "@emotion/cache": "^11.11.0", @@ -3786,15 +3793,16 @@ } }, "node_modules/@mui/system": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.20.tgz", - "integrity": "sha512-LoMq4IlAAhxzL2VNUDBTQxAb4chnBe8JvRINVNDiMtHE2PiPOoHlhOPutSxEbaL5mkECPVWSv6p8JEV+uykwIA==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.16.4.tgz", + "integrity": "sha512-ET1Ujl2/8hbsD611/mqUuNArMCGv/fIWO/f8B3ZqF5iyPHM2aS74vhTNyjytncc4i6dYwGxNk+tLa7GwjNS0/w==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@mui/private-theming": "^5.15.20", - "@mui/styled-engine": "^5.15.14", - "@mui/types": "^7.2.14", - "@mui/utils": "^5.15.20", + "@mui/private-theming": "^5.16.4", + "@mui/styled-engine": "^5.16.4", + "@mui/types": "^7.2.15", + "@mui/utils": "^5.16.4", "clsx": "^2.1.0", "csstype": "^3.1.3", "prop-types": "^15.8.1" @@ -3825,9 +3833,10 @@ } }, "node_modules/@mui/types": { - "version": "7.2.14", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.14.tgz", - "integrity": "sha512-MZsBZ4q4HfzBsywtXgM1Ksj6HDThtiwmOKUXH1pKYISI9gAVXCNHNpo7TlGoGrBaYWZTdNoirIN7JsQcQUjmQQ==", + "version": "7.2.15", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.15.tgz", + "integrity": "sha512-nbo7yPhtKJkdf9kcVOF8JZHPZTmqXjJ/tI0bdWgHg5tp9AnIN4Y7f7wm9T+0SyGYJk76+GYZ8Q5XaTYAsUHN0Q==", + "license": "MIT", "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0" }, @@ -3838,14 +3847,16 @@ } }, "node_modules/@mui/utils": { - "version": "5.15.20", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.20.tgz", - "integrity": "sha512-mAbYx0sovrnpAu1zHc3MDIhPqL8RPVC5W5xcO1b7PiSCJPtckIZmBkp8hefamAvUiAV8gpfMOM6Zb+eSisbI2A==", + "version": "5.16.4", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.16.4.tgz", + "integrity": "sha512-nlppYwq10TBIFqp7qxY0SvbACOXeOjeVL3pOcDsK0FT8XjrEXh9/+lkg8AEIzD16z7YfiJDQjaJG2OLkE7BxNg==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.9", - "@types/prop-types": "^15.7.11", + "@types/prop-types": "^15.7.12", + "clsx": "^2.1.1", "prop-types": "^15.8.1", - "react-is": "^18.2.0" + "react-is": "^18.3.1" }, "engines": { "node": ">=12.0.0" @@ -3865,14 +3876,15 @@ } }, "node_modules/@mui/x-tree-view": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.7.1.tgz", - "integrity": "sha512-r2K287+dN2XI5wdovinbJfTgiBbJLZsdQyYH7EXYO1HvHLjnRmY5UjmwTnsq75LJobjok5TAQNfrz2MXfsRY8w==", + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/@mui/x-tree-view/-/x-tree-view-7.10.0.tgz", + "integrity": "sha512-9OCAIb0wS5uuEDyjcSwSturrB4RUXBfE0UO/xpKjrMvRzCaAvxbCf2aFILP8uH9NyynYZkIGYfGnlqdAPy2OLg==", + "license": "MIT", "dependencies": { "@babel/runtime": "^7.24.7", "@mui/base": "^5.0.0-beta.40", - "@mui/system": "^5.15.20", - "@mui/utils": "^5.15.20", + "@mui/system": "^5.16.0", + "@mui/utils": "^5.16.0", "@types/react-transition-group": "^4.4.10", "clsx": "^2.1.1", "prop-types": "^15.8.1", @@ -4382,9 +4394,10 @@ } }, "node_modules/@reduxjs/toolkit": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.5.tgz", - "integrity": "sha512-aeFA/s5NCG7NoJe/MhmwREJxRkDs0ZaSqt0MxhWUrwCf1UQXpwR87RROJEql0uAkLI6U7snBOYOcKw83ew3FPg==", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.2.6.tgz", + "integrity": "sha512-kH0r495c5z1t0g796eDQAkYbEQ3a1OLYN9o8jQQVZyKyw367pfRGS+qZLkHYvFHiUUdafpoSlQ2QYObIApjPWA==", + "license": "MIT", "dependencies": { "immer": "^10.0.3", "redux": "^5.0.1", @@ -4407,7 +4420,8 @@ "node_modules/@reduxjs/toolkit/node_modules/reselect": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", - "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==" + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT" }, "node_modules/@remix-run/router": { "version": "1.17.0", @@ -7033,9 +7047,9 @@ "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" }, "node_modules/browserslist": { - "version": "4.23.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", - "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", + "version": "4.23.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.2.tgz", + "integrity": "sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==", "funding": [ { "type": "opencollective", @@ -7050,11 +7064,12 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001629", - "electron-to-chromium": "^1.4.796", + "caniuse-lite": "^1.0.30001640", + "electron-to-chromium": "^1.4.820", "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.16" + "update-browserslist-db": "^1.1.0" }, "bin": { "browserslist": "cli.js" @@ -7201,9 +7216,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001638", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001638.tgz", - "integrity": "sha512-5SuJUJ7cZnhPpeLHaH0c/HPAnAHZvS6ElWyHK9GSIbVOQABLzowiI2pjmpvZ1WEbkyz46iFd4UXlOHR5SqgfMQ==", + "version": "1.0.30001642", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001642.tgz", + "integrity": "sha512-3XQ0DoRgLijXJErLSl+bLnJ+Et4KqV1PY6JJBGAFlsNsz31zeAIncyeZfLCabHK/jtSh+671RM9YMldxjUPZtA==", "funding": [ { "type": "opencollective", @@ -7217,7 +7232,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/case-sensitive-paths-webpack-plugin": { "version": "2.4.0", @@ -9051,9 +9067,10 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.814", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.814.tgz", - "integrity": "sha512-GVulpHjFu1Y9ZvikvbArHmAhZXtm3wHlpjTMcXNGKl4IQ4jMQjlnz8yMQYYqdLHKi/jEL2+CBC2akWVCoIGUdw==" + "version": "1.4.829", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.829.tgz", + "integrity": "sha512-5qp1N2POAfW0u1qGAxXEtz6P7bO1m6gpZr5hdf5ve6lxpLM7MpiM4jIPz7xcrNlClQMafbyUDDWjlIQZ1Mw0Rw==", + "license": "ISC" }, "node_modules/emittery": { "version": "0.8.1", @@ -20166,9 +20183,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz", - "integrity": "sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "funding": [ { "type": "opencollective", @@ -20183,6 +20200,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "escalade": "^3.1.2", "picocolors": "^1.0.1" diff --git a/aspnetapp/WINGS/ClientApp/package.json b/aspnetapp/WINGS/ClientApp/package.json index 1cc900f..4817be3 100644 --- a/aspnetapp/WINGS/ClientApp/package.json +++ b/aspnetapp/WINGS/ClientApp/package.json @@ -1,6 +1,6 @@ { "name": "wings", - "version": "3.0.0", + "version": "3.0.1", "private": true, "dependencies": { "@babel/eslint-parser": "^7.24.7", @@ -92,4 +92,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx b/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx index c771fdb..6ce5f22 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx +++ b/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx @@ -225,9 +225,11 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { const executeMultipleRequests = async () => { let row = selectedRow; + let currentVariables = [...cmdFileVariables]; do { - const exeret = await executeRequest(row, cmdType); - sendCmdFileLine(row, exeret); + const exeret = await executeRequest(row, cmdType, currentVariables); + sendCmdFileLine(row, exeret.exeret); + currentVariables = exeret.updatedVariables; if (content[row].request.method === "call") { break; } @@ -237,17 +239,18 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { if (row === content.length) { dispatch(selectedPlanRowAction(-1)); } + setCmdFileVariables(currentVariables); } - const getVariableValue = (variableName: string): GetVariable => { + const getVariableValue = (variables: CmdFileVariable[], variableName: string): GetVariable => { let variableIndex = -1; const outcome: GetVariable = { value: 0, isSuccess: false, convType: "" }; if (variableName.toLowerCase() === "unixtime_now") { outcome.value = Math.floor(new Date().getTime() / 1000); outcome.isSuccess = true; - } else if (cmdFileVariables.findIndex(index => index.variable === variableName) >= 0) { - variableIndex = cmdFileVariables.findIndex(index => index.variable === variableName); - outcome.value = cmdFileVariables[variableIndex].value; + } else if (variables.findIndex(index => index.variable === variableName) >= 0) { + variableIndex = variables.findIndex(index => index.variable === variableName); + outcome.value = variables[variableIndex].value; outcome.isSuccess = true; } else if (variableName.indexOf('.') > -1) { let tlms: Telemetry[] = []; @@ -280,9 +283,9 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { return outcome; } - const compareValue = (compare: string, variable: GetVariable, refValue: string) => { + const compareValue = (compare: string, variable: GetVariable, refValue: string, variables: CmdFileVariable[]) => { const comparedValue = (refValue.indexOf("{") === -1) ? refValue - : getVariableValue(refValue.substring(refValue.indexOf("{") + 1, refValue.indexOf("}"))).value.toString(); + : getVariableValue(variables, refValue.substring(refValue.indexOf("{") + 1, refValue.indexOf("}"))).value.toString(); switch (compare) { case "==": return variable.value === parseTlmValue(comparedValue, variable.convType); @@ -299,7 +302,7 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { case "in": while (refValue.indexOf("{") !== -1) { const cmdFileVar = refValue.substring(refValue.indexOf("{") + 1, refValue.indexOf("}")); - const varValue = getVariableValue(cmdFileVar); + const varValue = getVariableValue(variables, cmdFileVar); if (!varValue.isSuccess) { return false; } @@ -313,9 +316,10 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { } } - const executeRequest = async (row: number, cmdType: string): Promise => { + const executeRequest = async (row: number, cmdType: string, variables: CmdFileVariable[]): Promise<{ exeret: boolean, updatedVariables: CmdFileVariable[] }> => { const req = content[row].request; let exeret = false; + let updatedVariables = [...variables]; switch (req.type) { case "comment": dispatch(execRequestSuccessAction(row)); @@ -329,11 +333,11 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { if ((command.execTimeStr != null) && (command.execTimeStr.indexOf("{") !== -1)) { const varTi = command.execTimeStr.substring(command.execTimeStr.indexOf("{") + 1, command.execTimeStr.indexOf("}")); - const tiValue = getVariableValue(varTi); + const tiValue = getVariableValue(variables, varTi); if (!tiValue.isSuccess) { dispatch(execRequestErrorAction(row)); - return false; + return { exeret, updatedVariables }; } if (command.execType === "TL" || command.execType === "BL") { @@ -342,7 +346,7 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { command.execTimeDouble = Number(tiValue.value); } else { dispatch(execRequestErrorAction(row)); - return false; + return { exeret, updatedVariables }; } } @@ -354,11 +358,11 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { const varStart = commandValue.indexOf("{") + 1; const varEnd = commandValue.indexOf("}"); const varParam = commandValue.substring(varStart, varEnd); - const varValue = getVariableValue(varParam); + const varValue = getVariableValue(variables, varParam); if (!varValue.isSuccess) { dispatch(execRequestErrorAction(row)); - return false; + return { exeret, updatedVariables }; } else { paramsValue.push(varValue.value.toString()); } @@ -373,21 +377,23 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { break; case "control": - const controlret = await executeControlRequest(row); - exeret = controlret; + const controlret = await executeControlRequest(row, updatedVariables); + exeret = controlret.exeret; + updatedVariables = controlret.updatedVariables; break; default: break; } - return exeret; + return { exeret, updatedVariables }; } - const executeControlRequest = async (row: number): Promise => { + const executeControlRequest = async (row: number, variables: CmdFileVariable[]): Promise<{ exeret: boolean, updatedVariables: CmdFileVariable[] }> => { const req = content[row].request; const method = req.method as string; const contollerBody = req.body as CommandController; let reqret = false; + let updatedVariables = [...variables]; switch (method) { case "wait_sec": await _sleep(contollerBody.time * 1000); @@ -412,13 +418,13 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { let timer = 0; const timeoutsec = (contollerBody.timeoutsec === "" || isNaN(contollerBody.timeoutsec as number)) ? 10 : Number(contollerBody.timeoutsec); while (!reqret && timer < timeoutsec) { - const latestTlmValue = getVariableValue(contollerBody.variable); + const latestTlmValue = getVariableValue(variables, contollerBody.variable); if (!latestTlmValue.isSuccess) { dispatch(execRequestErrorAction(row)); break; } - if (compareValue(contollerBody.compare, latestTlmValue, contollerBody.value)) { + if (compareValue(contollerBody.compare, latestTlmValue, contollerBody.value, variables)) { reqret = true; } else { await _sleep(1000); @@ -433,13 +439,13 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { break; case "check_value": - const tlmValue = getVariableValue(contollerBody.variable); + const tlmValue = getVariableValue(variables, contollerBody.variable); if (!tlmValue.isSuccess) { dispatch(execRequestErrorAction(row)); break; } - if (compareValue(contollerBody.compare, tlmValue, contollerBody.value)) { + if (compareValue(contollerBody.compare, tlmValue, contollerBody.value, variables)) { dispatch(execRequestSuccessAction(row)); reqret = true; } else { @@ -449,40 +455,19 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { break; case "let": - let equ = contollerBody.equation; - // const innerVar = tlms[tlmidx]; - // const val = parseTlmValue(innerVar.telemetryValue.value, innerVar.telemetryInfo.convType); - reqret = true; - while (equ.indexOf("{") !== -1) { - const cmdFileVar = equ.substring(equ.indexOf("{") + 1, equ.indexOf("}")); - const varValue = getVariableValue(cmdFileVar); - if (!varValue.isSuccess) { - dispatch(execRequestErrorAction(row)); - return false; - } - equ = equ.replace("{" + cmdFileVar + "}", varValue.value.toString()); - } - let equAns = ""; - try { - equAns = (eval(equ) as string | number).toString(); - } - catch (e) { - equAns = equ; - } - const cmdFileVariablesTemp = [...cmdFileVariables]; - const varIndex = cmdFileVariables.findIndex(index => index.variable === contollerBody.variable); - if (varIndex >= 0) { - cmdFileVariablesTemp[varIndex].value = equAns; + const equ = contollerBody.equation; + const updatedVariablesTemp = setNewVariable(contollerBody.variable, equ, variables); + if (updatedVariablesTemp.isSuccess) { + dispatch(execRequestSuccessAction(row)); + updatedVariables = updatedVariablesTemp.variables; + dispatch(editCmdFileVariableAction(updatedVariables)); } else { - cmdFileVariablesTemp.push({ variable: contollerBody.variable, value: equAns }); + dispatch(execRequestErrorAction(row)); } - setCmdFileVariables(cmdFileVariablesTemp); - dispatch(execRequestSuccessAction(row)); - dispatch(editCmdFileVariableAction(cmdFileVariablesTemp)); break; case "get": - const reqValue = getVariableValue(contollerBody.variable); + const reqValue = getVariableValue(variables, contollerBody.variable); const newText = (req.stopFlag ? "." : " ") + `${method} ${contollerBody.variable} ${reqValue.value}`; await setCmdline(row, newText); if (!reqValue.isSuccess) { @@ -496,9 +481,62 @@ const PlanTabPanel = (props: PlanTabPanelProps) => { default: break; } - return reqret; + return { exeret: reqret, updatedVariables }; }; + interface SetVariable { + isSuccess: boolean, + variables: CmdFileVariable[] + } + + const calculateEquation = (variables: CmdFileVariable[], equ: string): (string | number) => { + while (equ.indexOf("{") != -1) { + const cmdFileVar = equ.substring(equ.indexOf("{") + 1, equ.indexOf("}")); + const varValue = getVariableValue(variables, cmdFileVar); + if (!varValue.isSuccess) { + // dispatch(execRequestErrorAction(row)); + return NaN; + } + equ = equ.replace("{" + cmdFileVar + "}", varValue.value.toString()); + } + try { + if (equ.includes("Math.norm")) { + const values = equ.substring(equ.indexOf("Math.norm([") + 11, equ.indexOf("])")).split(","); + let ansTemp = 0; + values.forEach(value => { ansTemp += parseFloat(value) ** 2; }); + equ = equ.replace(equ.substring(equ.indexOf("Math.norm(["), equ.indexOf("])") + 2), Math.sqrt(ansTemp).toString()); + } + if (equ.includes("Math.degrees")) { + const value = equ.substring(equ.indexOf("Math.degrees(") + 13, equ.indexOf(")")); + const valueDegree = Number(value) * 180 / Math.PI; + equ = equ.replace(equ.substring(equ.indexOf("Math.degrees("), equ.indexOf(")") + 1), valueDegree.toString()); + } else if (equ.includes("Math.radians")) { + const value = equ.substring(equ.indexOf("Math.radians(") + 13, equ.indexOf(")")); + const valueRadian = Number(value) * Math.PI / 180; + equ = equ.replace(equ.substring(equ.indexOf("Math.radians("), equ.indexOf(")") + 1), valueRadian.toString()); + } + return eval(equ) as string; + } catch (e) { + return equ; // 文字列の場合はそのまま出力 + } + } + + const setNewVariable = (variableName: string, equ: string, variables: CmdFileVariable[]): SetVariable => { + const equAns = calculateEquation(variables, equ); + if (typeof equAns == "number" && isNaN(equAns)) { + return { isSuccess: false, variables }; + } + if (variables.findIndex(index => index.variable === variableName) >= 0) { + const varIndex = variables.findIndex(index => index.variable === variableName); + const updateValue: CmdFileVariable = { variable: variableName, value: equAns }; + variables[varIndex] = updateValue; + } else { + const newValue: CmdFileVariable = { variable: variableName, value: equAns }; + variables = [...variables, newValue]; + } + return { isSuccess: true, variables }; + } + const parseTlmValue = (value: string, convType: string): number | string => { switch (convType) { case "NONE": diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx b/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx index 3a50f05..9db0693 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx +++ b/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx @@ -40,27 +40,27 @@ const DisplayTab = styled(Tab)({ textOverflow: "ellipsis", padding: "0", border: 0, + marginTop: 5, "&.Mui-selected": { "& span": { color: "white" + }, + "& .MuiIconButton-root": { + color: "white" } }, + "& .MuiIconButton-root": { + color: grey[300], + marginLeft: 0, + }, "& span": { color: grey[300], whiteSpace: "nowrap", textOverflow: "ellipsis", overflow: "hidden", display: "inline-block", - flexGrow: 0 + flexGrow: 1 }, - "& .MuiTab-wrapper > *:first-child": { - marginBottom: 0, - padding: 0, - marginRight: 15, - marginLeft: 5, - width: 20, - height: 20 - } }) const a11yProps = (index: number) => { @@ -123,7 +123,10 @@ const ViewDisplayBlock = (props: ViewDisplayBlockProps) => { /> ))} - + diff --git a/aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts b/aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts index 7e8b034..58d17a5 100644 --- a/aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts +++ b/aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts @@ -12,10 +12,14 @@ export const commandsSlice = createSlice({ .addCase(Actions.fetchCommandsAction, (state, action) => { const commands = action.payload; const targets = Array.from(new Set(commands.map(command => command.target))); + targets.forEach(target => { + if (!(state.targets.includes(target))) state.targets.push(target); + }) const components = Array.from(new Set(commands.map(command => command.component))); + components.forEach(component => { + if (!(state.components.includes(component))) state.components.push(component); + }) state.list = commands; - state.targets = [...state.targets, ...targets]; - state.components = [...state.components, ...components]; state.logs = []; }) .addCase(Actions.updateCommandLogAction, (state, action) => { diff --git a/aspnetapp/WINGS/Data/CommandDbRepository.cs b/aspnetapp/WINGS/Data/CommandDbRepository.cs index a24a52b..c0a8126 100644 --- a/aspnetapp/WINGS/Data/CommandDbRepository.cs +++ b/aspnetapp/WINGS/Data/CommandDbRepository.cs @@ -58,7 +58,7 @@ private async Task> LoadFileAsync(TlmCmdFileLocation location, Tlm { var cols = parser.ReadFields(); if (parser.LineNumber == 1) { ComponentName = cols[0]; continue; } - else if (parser.LineNumber < 5) { continue; } + else if (parser.LineNumber < 3) { continue; } if (cols.All(x => x == "")) { break; } if (cols[0] != "" && cols[0][0] == '*') { diff --git a/aspnetapp/WINGS/TlmCmd/config.json b/aspnetapp/WINGS/TlmCmd/config.json index c700cf9..d3b153f 100644 --- a/aspnetapp/WINGS/TlmCmd/config.json +++ b/aspnetapp/WINGS/TlmCmd/config.json @@ -1,4 +1,7 @@ [ {"tlmApid": "0x123", "cmdApid": "0x456", "compoName": "ISSL_OBC"}, - {"tlmApid": "0x456", "cmdApid": "0x123", "compoName": "ISSL_SECONDARY_OBC"} -] \ No newline at end of file + {"tlmApid": "0x456", "cmdApid": "0x123", "compoName": "ISSL_SECONDARY_OBC"}, + {"tlmApid": "0x510", "cmdApid": "0x210", "compoName": "MOBC"}, + {"tlmApid": "0x511", "cmdApid": "0x211", "compoName": "AOBC"}, + {"tlmApid": "0x512", "cmdApid": "0x212", "compoName": "TOBC"} +] diff --git a/aspnetapp/WINGS/WINGS.csproj b/aspnetapp/WINGS/WINGS.csproj index 79015c3..7ffb0e3 100644 --- a/aspnetapp/WINGS/WINGS.csproj +++ b/aspnetapp/WINGS/WINGS.csproj @@ -16,18 +16,18 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +