openc3 5.8.1 → 5.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/ext/openc3/ext/crc/crc.c +1 -1
  3. data/lib/openc3/api/cmd_api.rb +1 -1
  4. data/lib/openc3/microservices/decom_microservice.rb +10 -2
  5. data/lib/openc3/microservices/reaction_microservice.rb +152 -81
  6. data/lib/openc3/microservices/timeline_microservice.rb +1 -1
  7. data/lib/openc3/microservices/trigger_group_microservice.rb +188 -118
  8. data/lib/openc3/migrations/20230615000000_autonomic.rb +86 -0
  9. data/lib/openc3/models/activity_model.rb +2 -4
  10. data/lib/openc3/models/microservice_model.rb +6 -2
  11. data/lib/openc3/models/model.rb +1 -3
  12. data/lib/openc3/models/reaction_model.rb +124 -119
  13. data/lib/openc3/models/scope_model.rb +15 -3
  14. data/lib/openc3/models/timeline_model.rb +1 -3
  15. data/lib/openc3/models/trigger_group_model.rb +16 -50
  16. data/lib/openc3/models/trigger_model.rb +86 -123
  17. data/lib/openc3/packets/json_packet.rb +2 -3
  18. data/lib/openc3/script/commands.rb +10 -0
  19. data/lib/openc3/script/script.rb +1 -0
  20. data/lib/openc3/top_level.rb +0 -12
  21. data/lib/openc3/utilities/authorization.rb +1 -1
  22. data/lib/openc3/utilities/bucket_require.rb +5 -1
  23. data/lib/openc3/utilities/bucket_utilities.rb +4 -1
  24. data/lib/openc3/utilities/cli_generator.rb +56 -4
  25. data/lib/openc3/utilities/ruby_lex_utils.rb +4 -0
  26. data/lib/openc3/version.rb +6 -6
  27. data/templates/plugin/README.md +54 -4
  28. data/templates/plugin/Rakefile +31 -3
  29. data/templates/tool_angular/.editorconfig +16 -0
  30. data/templates/tool_angular/.gitignore +44 -0
  31. data/templates/tool_angular/.vscode/extensions.json +4 -0
  32. data/templates/tool_angular/.vscode/launch.json +20 -0
  33. data/templates/tool_angular/.vscode/tasks.json +42 -0
  34. data/templates/tool_angular/angular.json +111 -0
  35. data/templates/tool_angular/extra-webpack.config.js +8 -0
  36. data/templates/tool_angular/package.json +47 -0
  37. data/templates/tool_angular/src/app/app-routing.module.ts +15 -0
  38. data/templates/tool_angular/src/app/app.component.html +31 -0
  39. data/templates/tool_angular/src/app/app.component.scss +26 -0
  40. data/templates/tool_angular/src/app/app.component.spec.ts +29 -0
  41. data/templates/tool_angular/src/app/app.component.ts +51 -0
  42. data/templates/tool_angular/src/app/app.module.ts +30 -0
  43. data/templates/tool_angular/src/app/custom-overlay-container.ts +17 -0
  44. data/templates/tool_angular/src/app/empty-route/empty-route.component.ts +7 -0
  45. data/templates/tool_angular/src/app/openc3-api.d.ts +1 -0
  46. data/templates/tool_angular/src/assets/.gitkeep +0 -0
  47. data/templates/tool_angular/src/environments/environment.prod.ts +3 -0
  48. data/templates/tool_angular/src/environments/environment.ts +16 -0
  49. data/templates/tool_angular/src/favicon.ico +0 -0
  50. data/templates/tool_angular/src/index.html +13 -0
  51. data/templates/tool_angular/src/main.single-spa.ts +40 -0
  52. data/templates/tool_angular/src/single-spa/asset-url.ts +12 -0
  53. data/templates/tool_angular/src/single-spa/single-spa-props.ts +8 -0
  54. data/templates/tool_angular/src/styles.scss +1 -0
  55. data/templates/tool_angular/tsconfig.app.json +13 -0
  56. data/templates/tool_angular/tsconfig.json +33 -0
  57. data/templates/tool_angular/tsconfig.spec.json +14 -0
  58. data/templates/tool_angular/yarn.lock +8080 -0
  59. data/templates/tool_react/.eslintrc +7 -0
  60. data/templates/tool_react/.gitignore +72 -0
  61. data/templates/tool_react/.prettierignore +8 -0
  62. data/templates/tool_react/babel.config.json +29 -0
  63. data/templates/tool_react/jest.config.js +12 -0
  64. data/templates/tool_react/package.json +53 -0
  65. data/templates/tool_react/src/openc3-tool_name.js +24 -0
  66. data/templates/tool_react/src/root.component.js +88 -0
  67. data/templates/tool_react/src/root.component.test.js +9 -0
  68. data/templates/tool_react/webpack.config.js +27 -0
  69. data/templates/tool_react/yarn.lock +6854 -0
  70. data/templates/tool_svelte/.gitignore +72 -0
  71. data/templates/tool_svelte/.prettierignore +8 -0
  72. data/templates/tool_svelte/babel.config.js +12 -0
  73. data/templates/tool_svelte/build/smui.css +5 -0
  74. data/templates/tool_svelte/jest.config.js +9 -0
  75. data/templates/tool_svelte/package.json +46 -0
  76. data/templates/tool_svelte/rollup.config.js +72 -0
  77. data/templates/tool_svelte/src/App.svelte +42 -0
  78. data/templates/tool_svelte/src/App.test.js +9 -0
  79. data/templates/tool_svelte/src/services/api.js +92 -0
  80. data/templates/tool_svelte/src/services/axios.js +85 -0
  81. data/templates/tool_svelte/src/services/cable.js +65 -0
  82. data/templates/tool_svelte/src/services/config-parser.js +199 -0
  83. data/templates/tool_svelte/src/services/openc3-api.js +647 -0
  84. data/templates/tool_svelte/src/theme/_smui-theme.scss +25 -0
  85. data/templates/tool_svelte/src/tool_name.js +17 -0
  86. data/templates/tool_svelte/yarn.lock +5052 -0
  87. data/templates/tool_vue/.browserslistrc +16 -0
  88. data/templates/tool_vue/.env.standalone +1 -0
  89. data/templates/tool_vue/.eslintrc.js +43 -0
  90. data/templates/tool_vue/.gitignore +2 -0
  91. data/templates/tool_vue/.nycrc +3 -0
  92. data/templates/tool_vue/.prettierrc.js +5 -0
  93. data/templates/tool_vue/babel.config.json +11 -0
  94. data/templates/tool_vue/jsconfig.json +6 -0
  95. data/templates/tool_vue/package.json +52 -0
  96. data/templates/tool_vue/src/App.vue +15 -0
  97. data/templates/tool_vue/src/main.js +38 -0
  98. data/templates/tool_vue/src/router.js +29 -0
  99. data/templates/tool_vue/src/tools/tool_name/tool_name.vue +63 -0
  100. data/templates/tool_vue/vue.config.js +30 -0
  101. data/templates/tool_vue/yarn.lock +9145 -0
  102. data/templates/widget/package.json +9 -9
  103. data/templates/widget/yarn.lock +77 -73
  104. metadata +76 -2
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": [
3
+ "react-important-stuff",
4
+ "plugin:prettier/recommended"
5
+ ],
6
+ "parser": "@babel/eslint-parser"
7
+ }
@@ -0,0 +1,72 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+
8
+ # Runtime data
9
+ pids
10
+ *.pid
11
+ *.seed
12
+ *.pid.lock
13
+
14
+ # Directory for instrumented libs generated by jscoverage/JSCover
15
+ lib-cov
16
+
17
+ # Coverage directory used by tools like istanbul
18
+ coverage
19
+
20
+ # nyc test coverage
21
+ .nyc_output
22
+
23
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24
+ .grunt
25
+
26
+ # Bower dependency directory (https://bower.io/)
27
+ bower_components
28
+
29
+ # node-waf configuration
30
+ .lock-wscript
31
+
32
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
33
+ build/Release
34
+
35
+ # Dependency directories
36
+ node_modules/
37
+ jspm_packages/
38
+
39
+ # TypeScript v1 declaration files
40
+ typings/
41
+
42
+ # Optional npm cache directory
43
+ .npm
44
+
45
+ # Optional eslint cache
46
+ .eslintcache
47
+
48
+ # Optional REPL history
49
+ .node_repl_history
50
+
51
+ # Output of 'npm pack'
52
+ *.tgz
53
+
54
+ # Yarn Integrity file
55
+ .yarn-integrity
56
+
57
+ # dotenv environment variables file
58
+ .env
59
+
60
+ # next.js build output
61
+ .next
62
+ tools
63
+
64
+ # Editor directories and files
65
+ .idea
66
+ .vscode
67
+ *.suo
68
+ *.ntvs*
69
+ *.njsproj
70
+ *.sln
71
+ *.sw?
72
+ .DS_Store
@@ -0,0 +1,8 @@
1
+ .gitignore
2
+ .prettierignore
3
+ yarn.lock
4
+ yarn-error.log
5
+ package-lock.json
6
+ dist
7
+ coverage
8
+ pnpm-lock.yaml
@@ -0,0 +1,29 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-env",
4
+ [
5
+ "@babel/preset-react",
6
+ {
7
+ "runtime": "automatic"
8
+ }
9
+ ],
10
+ ],
11
+ "plugins": [
12
+ [
13
+ "@babel/plugin-transform-runtime",
14
+ {
15
+ "useESModules": true,
16
+ "regenerator": false
17
+ }
18
+ ]
19
+ ],
20
+ "env": {
21
+ "test": {
22
+ "presets": [
23
+ ["@babel/preset-env", {
24
+ "targets": "current node"
25
+ }]
26
+ ]
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ rootDir: "src",
3
+ testEnvironment: "jsdom",
4
+ transform: {
5
+ "^.+\\.(j|t)sx?$": "babel-jest",
6
+ },
7
+ moduleNameMapper: {
8
+ "\\.(css)$": "identity-obj-proxy",
9
+ "single-spa-react/parcel": "single-spa-react/lib/cjs/parcel.cjs",
10
+ },
11
+ setupFilesAfterEnv: ["@testing-library/jest-dom"],
12
+ };
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "<%= tool_name %>",
3
+ "scripts": {
4
+ "start": "webpack serve",
5
+ "start:standalone": "webpack serve --env standalone",
6
+ "build": "concurrently yarn:build:*",
7
+ "build:webpack": "webpack --mode=production",
8
+ "analyze": "webpack --mode=production --env analyze",
9
+ "lint": "eslint src --ext js",
10
+ "format": "prettier --write .",
11
+ "check-format": "prettier --check .",
12
+ "test": "cross-env BABEL_ENV=test jest",
13
+ "watch-tests": "cross-env BABEL_ENV=test jest --watch",
14
+ "prepare": "husky install",
15
+ "coverage": "cross-env BABEL_ENV=test jest --coverage"
16
+ },
17
+ "devDependencies": {
18
+ "@babel/core": "^7.15.0",
19
+ "@babel/eslint-parser": "^7.15.0",
20
+ "@babel/plugin-transform-runtime": "^7.15.0",
21
+ "@babel/preset-env": "^7.15.0",
22
+ "@babel/preset-react": "^7.14.5",
23
+ "@babel/runtime": "^7.15.3",
24
+ "@testing-library/jest-dom": "^5.14.1",
25
+ "@testing-library/react": "^14.0.0",
26
+ "babel-jest": "^29.5.0",
27
+ "concurrently": "^8.2.0",
28
+ "cross-env": "^7.0.3",
29
+ "eslint": "^8.44.0",
30
+ "eslint-config-prettier": "^8.3.0",
31
+ "eslint-config-react-important-stuff": "^3.0.0",
32
+ "eslint-plugin-prettier": "^4.2.1",
33
+ "identity-obj-proxy": "^3.0.0",
34
+ "jest": "^29.5.0",
35
+ "jest-cli": "^29.5.0",
36
+ "prettier": "^2.3.2",
37
+ "pretty-quick": "^3.1.1",
38
+ "webpack": "^5.88.1",
39
+ "webpack-cli": "^5.1.4",
40
+ "webpack-config-single-spa-react": "^4.0.0",
41
+ "webpack-dev-server": "^4.0.0",
42
+ "webpack-merge": "^5.8.0"
43
+ },
44
+ "dependencies": {
45
+ "@emotion/react": "^11.11.1",
46
+ "@emotion/styled": "^11.11.0",
47
+ "@mui/material": "^5.13.6",
48
+ "@openc3/tool-common": "5.9.0",
49
+ "react": "^18.2.0",
50
+ "react-dom": "^18.2.0",
51
+ "single-spa-react": "^5.1.1"
52
+ }
53
+ }
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import ReactDOM from "react-dom";
3
+ import singleSpaReact from "single-spa-react";
4
+ import Root from "./root.component";
5
+
6
+ const lifecycles = singleSpaReact({
7
+ React,
8
+ ReactDOM,
9
+ rootComponent: Root,
10
+ errorBoundary(err, info, props) {
11
+ // Customize the root error boundary for your microfrontend here.
12
+ return null;
13
+ },
14
+ domElementGetter: function () {
15
+ let elem = document.getElementById("openc3-tool");
16
+ if (elem) {
17
+ return elem;
18
+ } else {
19
+ return new HTMLElement();
20
+ }
21
+ },
22
+ });
23
+
24
+ export const { bootstrap, mount, unmount } = lifecycles;
@@ -0,0 +1,88 @@
1
+ import React from "react";
2
+ import { createPortal } from "react-dom";
3
+ import Button from "@mui/material/Button";
4
+ import Card from "@mui/material/Card";
5
+ import CardContent from "@mui/material/CardContent";
6
+ import Menu from "@mui/material/Menu";
7
+ import MenuItem from "@mui/material/MenuItem";
8
+ import { OpenC3Api } from "@openc3/tool-common/src/services/openc3-api";
9
+
10
+ export default function Root(props) {
11
+ const [anchorEl, setAnchorEl] = React.useState();
12
+ const open = Boolean(anchorEl);
13
+ const handleClick = (event) => {
14
+ setAnchorEl(event.currentTarget);
15
+ };
16
+ const sendCommand = () => {
17
+ let api = new OpenC3Api();
18
+ api.cmd("INST", "COLLECT", { TYPE: "NORMAL" }).then((response) => {
19
+ alert("Command Sent!");
20
+ });
21
+ };
22
+ const handleClose = () => {
23
+ setAnchorEl(null);
24
+ sendCommand();
25
+ };
26
+
27
+ document.title = "<%= tool_name_display %>";
28
+
29
+ return (
30
+ <Card variant="outlined">
31
+ <CardContent>
32
+ <Button variant="contained" onClick={sendCommand}>
33
+ Send Command!
34
+ </Button>
35
+ </CardContent>
36
+ {createPortal(
37
+ <div>
38
+ <Button
39
+ id="basic-button"
40
+ aria-controls={open ? "basic-menu" : undefined}
41
+ aria-haspopup="true"
42
+ aria-expanded={open ? "true" : undefined}
43
+ onClick={handleClick}
44
+ variant="contained"
45
+ disableElevation
46
+ >
47
+ File
48
+ </Button>
49
+ <Menu
50
+ id="basic-menu"
51
+ anchorEl={anchorEl}
52
+ open={open}
53
+ onClose={handleClose}
54
+ MenuListProps={{
55
+ "aria-labelledby": "basic-button",
56
+ }}
57
+ >
58
+ <MenuItem onClick={handleClose}>Send Command</MenuItem>
59
+ </Menu>
60
+ <div
61
+ style={{
62
+ "align-items": "center",
63
+ "text-align": "center",
64
+ width: "80%",
65
+ display: "inline-flex",
66
+ position: "relative",
67
+ "z-index": 0,
68
+ padding: "4px 16px",
69
+ }}
70
+ >
71
+ <div
72
+ style={{
73
+ "font-size": "1.25rem",
74
+ "line-height": 1.5,
75
+ "text-overflow": "ellipsis",
76
+ "white-space": "nowrap",
77
+ width: "100%",
78
+ }}
79
+ >
80
+ <%= tool_name_display %>
81
+ </div>
82
+ </div>
83
+ </div>,
84
+ document.getElementById("openc3-menu")
85
+ )}
86
+ </Card>
87
+ );
88
+ }
@@ -0,0 +1,9 @@
1
+ import { render } from "@testing-library/react";
2
+ import Root from "./root.component";
3
+
4
+ describe("Root component", () => {
5
+ it("should be in the document", () => {
6
+ const { getByText } = render(<Root name="Testapp" />);
7
+ expect(getByText(/Testapp is mounted!/i)).toBeInTheDocument();
8
+ });
9
+ });
@@ -0,0 +1,27 @@
1
+ const { merge } = require("webpack-merge");
2
+ const singleSpaDefaults = require("webpack-config-single-spa-react");
3
+ const path = require("path");
4
+
5
+ function resolve(dir) {
6
+ return path.join(__dirname, "..", dir);
7
+ }
8
+
9
+ module.exports = (webpackConfigEnv, argv) => {
10
+ const defaultConfig = singleSpaDefaults({
11
+ orgName: "openc3",
12
+ projectName: "<%= tool_name %>",
13
+ webpackConfigEnv,
14
+ argv,
15
+ orgPackagesAsExternal: false,
16
+ });
17
+
18
+ delete defaultConfig.externals;
19
+
20
+ return merge(defaultConfig, {
21
+ output: {
22
+ path: path.resolve(__dirname, "tools/<%= tool_name %>"),
23
+ filename: "main.js",
24
+ libraryTarget: "system", // This line is in all the vue.config.js files, is it needed here?
25
+ },
26
+ });
27
+ };