openc3 5.8.1 → 5.9.0

Sign up to get free protection for your applications and to get access to all the features.
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,51 @@
1
+ import { Component, ViewChild, AfterViewInit, OnDestroy } from '@angular/core';
2
+ import {CdkPortal, DomPortalOutlet} from '@angular/cdk/portal';
3
+ import { OpenC3Api } from "@openc3/tool-common/src/services/openc3-api";
4
+
5
+ @Component({
6
+ selector: 'openc3-tool-<%= tool_name %>-root',
7
+ templateUrl: './app.component.html',
8
+ styleUrls: ['./app.component.scss'],
9
+ })
10
+ export class AppComponent implements AfterViewInit, OnDestroy {
11
+ @ViewChild(CdkPortal)
12
+ private portal: CdkPortal | undefined;
13
+ private host: DomPortalOutlet | undefined;
14
+
15
+ clickHandler = function() {
16
+ let api = new OpenC3Api();
17
+ api.cmd("INST", "COLLECT", { TYPE: "NORMAL" }).then((response: any) => {
18
+ alert("Command Sent!");
19
+ });
20
+ }
21
+ getMenuElement() {
22
+ let elem = document.getElementById("openc3-menu")
23
+ if (elem) {
24
+ return elem
25
+ } else {
26
+ return new HTMLElement()
27
+ }
28
+ }
29
+ ngAfterViewInit(): void {
30
+ this.host = new DomPortalOutlet(
31
+ this.getMenuElement()
32
+ );
33
+ this.host.attach(this.portal);
34
+ document.title = "<%= tool_name_display %>";
35
+ let tool = document.querySelector('#openc3-tool');
36
+ if (tool == null) {
37
+ tool = new HTMLElement()
38
+ }
39
+ let overlay = document.querySelector('.cdk-overlay-container');
40
+ if (overlay == null) {
41
+ overlay = new HTMLElement()
42
+ }
43
+ // Move stuff
44
+ tool.append(overlay);
45
+ }
46
+ ngOnDestroy(): void {
47
+ if (this.host) {
48
+ this.host.detach();
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,30 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { BrowserModule } from '@angular/platform-browser';
3
+ import { PortalModule } from '@angular/cdk/portal';
4
+
5
+ import { AppRoutingModule } from './app-routing.module';
6
+ import { AppComponent } from './app.component';
7
+ import {MatCardModule} from '@angular/material/card';
8
+ import {MatButtonModule} from '@angular/material/button';
9
+ import {MatMenuModule} from '@angular/material/menu';
10
+ import {OverlayContainer} from '@angular/cdk/overlay';
11
+ import {AppOverlayContainer} from './custom-overlay-container';
12
+
13
+ @NgModule({
14
+ declarations: [
15
+ AppComponent
16
+ ],
17
+ imports: [
18
+ BrowserModule,
19
+ AppRoutingModule,
20
+ PortalModule,
21
+ MatCardModule,
22
+ MatButtonModule,
23
+ MatMenuModule
24
+ ],
25
+ providers: [
26
+ { provide: OverlayContainer, useClass: AppOverlayContainer },
27
+ ],
28
+ bootstrap: [AppComponent]
29
+ })
30
+ export class AppModule { }
@@ -0,0 +1,17 @@
1
+ import { Injectable, OnDestroy } from '@angular/core';
2
+ import { OverlayContainer } from '@angular/cdk/overlay';
3
+
4
+ export class AppOverlayContainer extends OverlayContainer {
5
+
6
+ override _createContainer(): void {
7
+ let container = document.createElement('div');
8
+ container.classList.add('cdk-overlay-container');
9
+
10
+ let elem = document.querySelector('#openc3-tool');
11
+ if (!elem) {
12
+ elem = new HTMLElement();
13
+ }
14
+ elem.appendChild(container);
15
+ this._containerElement = container;
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ import { Component } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'openc3-tool-<%= tool_name %>-empty-route',
5
+ template: '',
6
+ })
7
+ export class EmptyRouteComponent {}
@@ -0,0 +1 @@
1
+ declare module '@openc3/tool-common/src/services/openc3-api';
File without changes
@@ -0,0 +1,3 @@
1
+ export const environment = {
2
+ production: true
3
+ };
@@ -0,0 +1,16 @@
1
+ // This file can be replaced during build by using the `fileReplacements` array.
2
+ // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3
+ // The list of file replacements can be found in `angular.json`.
4
+
5
+ export const environment = {
6
+ production: false
7
+ };
8
+
9
+ /*
10
+ * For easier debugging in development mode, you can import the following file
11
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12
+ *
13
+ * This import should be commented out in production mode because it will have a negative impact
14
+ * on performance if an error is thrown.
15
+ */
16
+ import 'zone.js/dist/zone-error'; // Included with Angular CLI.
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Openc3ToolTemplateAngular</title>
6
+ <base href="/">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
9
+ </head>
10
+ <body>
11
+ <openc3-tool-template-angular-root></openc3-tool-template-angular-root>
12
+ </body>
13
+ </html>
@@ -0,0 +1,40 @@
1
+ import 'zone.js/dist/zone'
2
+
3
+ import { enableProdMode, NgZone } from '@angular/core';
4
+
5
+ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
6
+ import { Router, NavigationStart } from '@angular/router';
7
+
8
+ import { singleSpaAngular, getSingleSpaExtraProviders } from 'single-spa-angular';
9
+
10
+
11
+ import { AppModule } from './app/app.module';
12
+ import { environment } from './environments/environment';
13
+ import { singleSpaPropsSubject } from './single-spa/single-spa-props';
14
+
15
+ if (environment.production) {
16
+ enableProdMode();
17
+ }
18
+
19
+ const lifecycles = singleSpaAngular({
20
+ bootstrapFunction: singleSpaProps => {
21
+ singleSpaPropsSubject.next(singleSpaProps);
22
+ return platformBrowserDynamic(getSingleSpaExtraProviders()).bootstrapModule(AppModule);
23
+ },
24
+ template: '<openc3-tool-<%= tool_name %>-root />',
25
+ Router,
26
+ NavigationStart,
27
+ NgZone,
28
+ domElementGetter: function() {
29
+ let elem = document.getElementById("openc3-tool")
30
+ if (elem) {
31
+ return elem
32
+ } else {
33
+ return new HTMLElement()
34
+ }
35
+ },
36
+ });
37
+
38
+ export const bootstrap = lifecycles.bootstrap;
39
+ export const mount = lifecycles.mount;
40
+ export const unmount = lifecycles.unmount;
@@ -0,0 +1,12 @@
1
+ // In single-spa, the assets need to be loaded from a dynamic location,
2
+ // instead of hard coded to `/assets`. We use webpack public path for this.
3
+ // See https://webpack.js.org/guides/public-path/#root
4
+
5
+ export function assetUrl(url: string): string {
6
+ // @ts-ignore
7
+ const publicPath = __webpack_public_path__;
8
+ const publicPathSuffix = publicPath.endsWith('/') ? '' : '/';
9
+ const urlPrefix = url.startsWith('/') ? '' : '/';
10
+
11
+ return `${publicPath}${publicPathSuffix}assets${urlPrefix}${url}`;
12
+ }
@@ -0,0 +1,8 @@
1
+ import { ReplaySubject } from 'rxjs';
2
+ import { AppProps } from 'single-spa';
3
+
4
+ export const singleSpaPropsSubject = new ReplaySubject<SingleSpaProps>(1);
5
+
6
+ // Add any custom single-spa props you have to this type def
7
+ // https://single-spa.js.org/docs/building-applications.html#custom-props
8
+ export type SingleSpaProps = AppProps & {};
@@ -0,0 +1 @@
1
+ /* You can add global styles to this file, and also import other style files */
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./out-tsc/app",
5
+ "types": []
6
+ },
7
+ "files": [
8
+ "src/main.single-spa.ts"
9
+ ],
10
+ "include": [
11
+ "src/**/*.d.ts"
12
+ ]
13
+ }
@@ -0,0 +1,33 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "compileOnSave": false,
4
+ "compilerOptions": {
5
+ "baseUrl": "./",
6
+ "outDir": "./dist/out-tsc",
7
+ "forceConsistentCasingInFileNames": true,
8
+ "strict": true,
9
+ "noImplicitOverride": true,
10
+ "noPropertyAccessFromIndexSignature": true,
11
+ "noImplicitReturns": true,
12
+ "noFallthroughCasesInSwitch": true,
13
+ "sourceMap": true,
14
+ "declaration": false,
15
+ "downlevelIteration": true,
16
+ "experimentalDecorators": true,
17
+ "moduleResolution": "node",
18
+ "importHelpers": true,
19
+ "target": "ES2022",
20
+ "module": "ES2022",
21
+ "useDefineForClassFields": false,
22
+ "lib": [
23
+ "ES2022",
24
+ "dom"
25
+ ]
26
+ },
27
+ "angularCompilerOptions": {
28
+ "enableI18nLegacyMessageIdFormat": false,
29
+ "strictInjectionParameters": true,
30
+ "strictInputAccessModifiers": true,
31
+ "strictTemplates": true
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
+ {
3
+ "extends": "./tsconfig.json",
4
+ "compilerOptions": {
5
+ "outDir": "./out-tsc/spec",
6
+ "types": [
7
+ "jasmine"
8
+ ]
9
+ },
10
+ "include": [
11
+ "src/**/*.spec.ts",
12
+ "src/**/*.d.ts"
13
+ ]
14
+ }