openc3 5.20.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/bin/openc3cli +12 -120
  3. data/data/config/command_modifiers.yaml +13 -1
  4. data/data/config/interface_modifiers.yaml +21 -4
  5. data/data/config/item_modifiers.yaml +1 -1
  6. data/data/config/microservice.yaml +15 -2
  7. data/data/config/param_item_modifiers.yaml +1 -1
  8. data/data/config/parameter_modifiers.yaml +1 -1
  9. data/data/config/table_manager.yaml +2 -2
  10. data/data/config/target.yaml +11 -0
  11. data/data/config/telemetry_modifiers.yaml +17 -1
  12. data/data/config/tool.yaml +12 -0
  13. data/data/config/widgets.yaml +13 -17
  14. data/lib/openc3/accessors/form_accessor.rb +4 -3
  15. data/lib/openc3/accessors/html_accessor.rb +3 -3
  16. data/lib/openc3/accessors/http_accessor.rb +13 -13
  17. data/lib/openc3/accessors/xml_accessor.rb +16 -4
  18. data/lib/openc3/api/target_api.rb +0 -30
  19. data/lib/openc3/config/config_parser.rb +6 -3
  20. data/lib/openc3/core_ext/array.rb +0 -16
  21. data/lib/openc3/core_ext.rb +0 -1
  22. data/lib/openc3/interfaces/file_interface.rb +198 -0
  23. data/lib/openc3/interfaces/http_client_interface.rb +71 -39
  24. data/lib/openc3/interfaces/http_server_interface.rb +0 -7
  25. data/lib/openc3/interfaces/interface.rb +2 -0
  26. data/lib/openc3/interfaces/mqtt_interface.rb +32 -15
  27. data/lib/openc3/interfaces/mqtt_stream_interface.rb +19 -4
  28. data/lib/openc3/interfaces/protocols/crc_protocol.rb +7 -0
  29. data/lib/openc3/interfaces/serial_interface.rb +1 -0
  30. data/lib/openc3/interfaces.rb +2 -4
  31. data/lib/openc3/microservices/multi_microservice.rb +3 -3
  32. data/lib/openc3/migrations/20241208080000_no_critical_cmd.rb +31 -0
  33. data/lib/openc3/migrations/20241208080001_no_trigger_group.rb +46 -0
  34. data/lib/openc3/models/interface_model.rb +9 -3
  35. data/lib/openc3/models/microservice_model.rb +8 -1
  36. data/lib/openc3/models/plugin_model.rb +6 -1
  37. data/lib/openc3/models/python_package_model.rb +6 -1
  38. data/lib/openc3/models/reaction_model.rb +14 -10
  39. data/lib/openc3/models/scope_model.rb +60 -42
  40. data/lib/openc3/models/target_model.rb +17 -1
  41. data/lib/openc3/models/timeline_model.rb +17 -5
  42. data/lib/openc3/models/tool_model.rb +15 -3
  43. data/lib/openc3/models/trigger_group_model.rb +6 -3
  44. data/lib/openc3/operators/microservice_operator.rb +8 -0
  45. data/lib/openc3/packets/commands.rb +17 -6
  46. data/lib/openc3/packets/limits.rb +0 -12
  47. data/lib/openc3/packets/packet.rb +1 -1
  48. data/lib/openc3/packets/packet_item.rb +30 -36
  49. data/lib/openc3/packets/structure_item.rb +2 -2
  50. data/lib/openc3/script/script.rb +0 -10
  51. data/lib/openc3/script/web_socket_api.rb +2 -2
  52. data/lib/openc3/streams/mqtt_stream.rb +41 -33
  53. data/lib/openc3/streams/serial_stream.rb +27 -27
  54. data/lib/openc3/streams/stream.rb +17 -17
  55. data/lib/openc3/streams/tcpip_client_stream.rb +1 -1
  56. data/lib/openc3/streams/tcpip_socket_stream.rb +19 -19
  57. data/lib/openc3/system/system.rb +1 -1
  58. data/lib/openc3/system.rb +2 -3
  59. data/lib/openc3/tools/table_manager/table.rb +2 -2
  60. data/lib/openc3/tools/table_manager/table_parser.rb +1 -1
  61. data/lib/openc3/top_level.rb +0 -5
  62. data/lib/openc3/topics/command_decom_topic.rb +0 -7
  63. data/lib/openc3/utilities/bucket_utilities.rb +1 -1
  64. data/lib/openc3/utilities/cli_generator.rb +0 -1
  65. data/lib/openc3/version.rb +6 -6
  66. data/templates/plugin/README.md +1 -1
  67. data/templates/target/targets/TARGET/lib/target.rb +1 -1
  68. data/templates/tool_angular/package.json +8 -8
  69. data/templates/tool_angular/src/app/app.component.html +4 -13
  70. data/templates/tool_angular/src/app/app.component.scss +5 -13
  71. data/templates/tool_angular/src/app/app.component.ts +5 -4
  72. data/templates/tool_angular/src/app/custom-overlay-container.ts +2 -2
  73. data/templates/tool_angular/src/app/openc3-api.d.ts +1 -1
  74. data/templates/tool_angular/src/main.single-spa.ts +1 -1
  75. data/templates/tool_react/package.json +1 -0
  76. data/templates/tool_react/src/root.component.js +1 -1
  77. data/templates/tool_svelte/package.json +11 -9
  78. data/templates/tool_svelte/rollup.config.js +2 -0
  79. data/templates/tool_svelte/src/App.svelte +2 -2
  80. data/templates/tool_vue/eslint.config.mjs +68 -0
  81. data/templates/tool_vue/jsconfig.json +1 -1
  82. data/templates/tool_vue/package.json +26 -43
  83. data/templates/tool_vue/src/App.vue +3 -5
  84. data/templates/tool_vue/src/main.js +12 -23
  85. data/templates/tool_vue/src/router.js +19 -18
  86. data/templates/tool_vue/src/tools/tool_name/tool_name.vue +2 -2
  87. data/templates/tool_vue/vite.config.js +52 -0
  88. data/templates/widget/package.json +19 -26
  89. data/templates/widget/src/Widget.vue +13 -15
  90. data/templates/widget/vite.config.js +26 -0
  91. metadata +10 -41
  92. data/lib/openc3/core_ext/hash.rb +0 -40
  93. data/lib/openc3/core_ext/httpclient.rb +0 -11
  94. data/lib/openc3/interfaces/linc_interface.rb +0 -480
  95. data/lib/openc3/interfaces/protocols/override_protocol.rb +0 -4
  96. data/lib/openc3/microservices/critical_cmd_microservice.rb +0 -74
  97. data/lib/openc3/microservices/reaction_microservice.rb +0 -607
  98. data/lib/openc3/microservices/timeline_microservice.rb +0 -398
  99. data/lib/openc3/microservices/trigger_group_microservice.rb +0 -698
  100. data/lib/openc3/migrations/20230615000000_autonomic.rb +0 -86
  101. data/lib/openc3/migrations/20240915000000_activity_uuid.rb +0 -28
  102. data/lib/openc3/migrations/20241016000000_scope_critical_cmd.rb +0 -24
  103. data/lib/openc3/system/system_config.rb +0 -413
  104. data/templates/tool_svelte/src/services/api.js +0 -92
  105. data/templates/tool_svelte/src/services/axios.js +0 -85
  106. data/templates/tool_svelte/src/services/cable.js +0 -65
  107. data/templates/tool_svelte/src/services/config-parser.js +0 -198
  108. data/templates/tool_svelte/src/services/openc3-api.js +0 -606
  109. data/templates/tool_vue/.eslintrc.js +0 -43
  110. data/templates/tool_vue/babel.config.json +0 -11
  111. data/templates/tool_vue/vue.config.js +0 -38
  112. data/templates/widget/.eslintrc.js +0 -43
  113. data/templates/widget/babel.config.json +0 -11
  114. data/templates/widget/vue.config.js +0 -28
  115. /data/templates/tool_vue/{.prettierrc.js → .prettierrc.cjs} +0 -0
  116. /data/templates/widget/{.prettierrc.js → .prettierrc.cjs} +0 -0
@@ -1,606 +0,0 @@
1
- /*
2
- # Copyright 2022 Ball Aerospace & Technologies Corp.
3
- # All Rights Reserved.
4
- #
5
- # This program is free software; you can modify and/or redistribute it
6
- # under the terms of the GNU Affero General Public License
7
- # as published by the Free Software Foundation; version 3 with
8
- # attribution addendums as found in the LICENSE.txt
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Affero General Public License for more details.
14
-
15
- # Modified by OpenC3, Inc.
16
- # All changes Copyright 2024, OpenC3, Inc.
17
- # All Rights Reserved
18
- #
19
- # This file may also be used under the terms of a commercial license
20
- # if purchased from OpenC3, Inc.
21
- */
22
-
23
- import axios from './axios.js'
24
-
25
- export class OpenC3Api {
26
- id = 1
27
-
28
- constructor() {}
29
-
30
- async exec(method, params, kwparams = {}, headerOptions = {}) {
31
- try {
32
- let refreshed = await OpenC3Auth.updateToken(
33
- OpenC3Auth.defaultMinValidity,
34
- )
35
- if (refreshed) {
36
- OpenC3Auth.setTokens()
37
- }
38
- } catch (error) {
39
- OpenC3Auth.login()
40
- }
41
- this.id = this.id + 1
42
- try {
43
- kwparams['scope'] = window.openc3Scope
44
- const response = await axios.post(
45
- '/openc3-api/api',
46
- {
47
- jsonrpc: '2.0',
48
- method: method,
49
- params: params,
50
- id: this.id,
51
- keyword_params: kwparams,
52
- },
53
- {
54
- headers: {
55
- Authorization: localStorage.openc3Token,
56
- 'Content-Type': 'application/json-rpc',
57
- ...headerOptions,
58
- },
59
- },
60
- )
61
- // let data = response.data
62
- // if (data.error) {
63
- // let err = new Error()
64
- // err.name = data.error.data.class
65
- // err.message = data.error.data.message
66
- // console.log(data.error.data.backtrace.join('\n'))
67
- // throw err
68
- // }
69
- return response.data.result
70
- } catch (error) {
71
- let err = new Error()
72
- if (error.response) {
73
- // The request was made and the server responded with a
74
- // status code that falls out of the range of 2xx
75
- err.name = error.response.data.error.data.class
76
- err.message = error.response.data.error.data.message
77
- } else if (error.request) {
78
- // The request was made but no response was received, `error.request`
79
- // is an instance of XMLHttpRequest in the browser and an instance
80
- // of http.ClientRequest in Node.js
81
- err.name = 'Request error'
82
- err.message = 'Request error, no response received'
83
- } else {
84
- // Something happened in setting up the request and triggered an Error
85
- err.name = 'Unknown error'
86
- }
87
- // console.log(error)
88
- throw err
89
- }
90
- }
91
-
92
- decode_openc3_type(val) {
93
- if (val !== null && typeof val === 'object') {
94
- if (val.json_class == 'Float' && val.raw) {
95
- if (val.raw == 'NaN') {
96
- return NaN
97
- } else if (val.raw == 'Infinity') {
98
- return Infinity
99
- } else if (val.raw == '-Infinity') {
100
- return -Infinity
101
- }
102
- }
103
- }
104
- return null
105
- }
106
-
107
- encode_openc3_type(val) {
108
- if (Number.isNaN(val)) {
109
- return { json_class: 'Float', raw: 'NaN' }
110
- } else if (val == Number.POSITIVE_INFINITY) {
111
- return { json_class: 'Float', raw: 'Infinity' }
112
- } else if (val == Number.NEGATIVE_INFINITY) {
113
- return { json_class: 'Float', raw: '-Infinity' }
114
- }
115
- return null
116
- }
117
-
118
- ensure_offline_access() {
119
- this.offline_access_needed().then((needed) => {
120
- if (needed) {
121
- if (localStorage.openc3OfflineToken) {
122
- this.set_offline_access(localStorage.openc3OfflineToken).then(() => {
123
- delete localStorage.openc3OfflineToken
124
- })
125
- } else {
126
- OpenC3Auth.getOfflineAccess()
127
- }
128
- }
129
- })
130
- }
131
-
132
- // ***********************************************
133
- // The following APIs are used by the CmdTlmServer
134
- // ***********************************************
135
-
136
- offline_access_needed() {
137
- return this.exec('offline_access_needed', [])
138
- }
139
-
140
- set_offline_access(offline_access_token) {
141
- return this.exec('set_offline_access', [offline_access_token])
142
- }
143
-
144
- get_all_interface_info() {
145
- return this.exec('get_all_interface_info', [])
146
- }
147
-
148
- map_target_to_interface(target_name, interface_name) {
149
- return this.exec('map_target_to_interface', [target_name, interface_name])
150
- }
151
-
152
- connect_interface(interface_name, ...interface_params) {
153
- if (interface_params.length > 0) {
154
- return this.exec('connect_interface', [
155
- interface_name,
156
- ...interface_params,
157
- ])
158
- } else {
159
- return this.exec('connect_interface', [interface_name])
160
- }
161
- }
162
-
163
- disconnect_interface(interface_name) {
164
- return this.exec('disconnect_interface', [interface_name])
165
- }
166
-
167
- interface_cmd(interface_name, command_name, ...command_params) {
168
- return this.exec('interface_cmd', [
169
- interface_name,
170
- command_name,
171
- ...command_params,
172
- ])
173
- }
174
-
175
- get_all_router_info() {
176
- return this.exec('get_all_router_info', [])
177
- }
178
-
179
- connect_router(router_name) {
180
- return this.exec('connect_router', [router_name])
181
- }
182
-
183
- disconnect_router(router_name) {
184
- return this.exec('disconnect_router', [router_name])
185
- }
186
-
187
- get_target_interfaces() {
188
- return this.exec('get_target_interfaces', [])
189
- }
190
-
191
- get_tlm_cnts(target_commands) {
192
- return this.exec('get_tlm_cnts', [target_commands])
193
- }
194
-
195
- get_item(target, packet, item) {
196
- return this.exec('get_item', [target, packet, item])
197
- }
198
-
199
- get_param(target, packet, item) {
200
- return this.exec('get_param', [target, packet, item])
201
- }
202
-
203
- get_limits_sets() {
204
- return this.exec('get_limits_sets', [])
205
- }
206
-
207
- get_limits_set() {
208
- return this.exec('get_limits_set', [])
209
- }
210
-
211
- set_limits_set(limits_set) {
212
- return this.exec('set_limits_set', [limits_set])
213
- }
214
-
215
- // ***********************************************
216
- // End CmdTlmServer APIs
217
- // ***********************************************
218
-
219
- get_target(target_name) {
220
- return this.exec('get_target', [target_name])
221
- }
222
-
223
- get_target_names() {
224
- return this.exec('get_target_names', [])
225
- }
226
-
227
- get_tlm(target_name, packet_name) {
228
- return this.exec('get_tlm', [target_name, packet_name])
229
- }
230
-
231
- get_all_tlm(target_name) {
232
- return this.exec('get_all_tlm', [target_name])
233
- }
234
-
235
- get_all_tlm_names(target_name, hidden = false) {
236
- return this.exec('get_all_tlm_names', [target_name], { hidden: hidden })
237
- }
238
-
239
- async get_tlm_packet(target_name, packet_name, value_type, stale_time = 30) {
240
- const data = await this.exec('get_tlm_packet', [target_name, packet_name], {
241
- type: value_type,
242
- stale_time: stale_time,
243
- })
244
- // Make sure data isn't null or undefined. Note this is the only valid use of == or !=
245
- if (data != null) {
246
- let len = data.length
247
- let converted = null
248
- for (let i = 0; i < len; i++) {
249
- converted = this.decode_openc3_type(data[i][1])
250
- if (converted !== null) {
251
- data[i][1] = converted
252
- }
253
- }
254
- }
255
- return data
256
- }
257
-
258
- get_packet_derived_items(target_name, packet_name) {
259
- return this.exec('get_packet_derived_items', [target_name, packet_name])
260
- }
261
-
262
- get_tlm_buffer(target_name, packet_name) {
263
- return this.exec('get_tlm_buffer', [target_name, packet_name])
264
- }
265
-
266
- async get_tlm_values(items, stale_time = 30) {
267
- const data = await this.exec('get_tlm_values', [items], {
268
- stale_time: stale_time,
269
- })
270
- let len = data[0].length
271
- let converted = null
272
- for (let i = 0; i < len; i++) {
273
- converted = this.decode_openc3_type(data[0][i])
274
- if (converted !== null) {
275
- data[0][i] = converted
276
- }
277
- }
278
- return data
279
- }
280
-
281
- get_limits(target_name, packet_name, item_name) {
282
- return this.exec('get_limits', [target_name, packet_name, item_name])
283
- }
284
-
285
- async tlm(target_name, packet_name, item_name, value_type = 'CONVERTED') {
286
- let data = null
287
- // Check for the single string syntax: tlm("TGT PKT ITEM")
288
- if (packet_name === undefined) {
289
- data = await this.exec('tlm', [target_name])
290
- // Check for the single string syntax with type: tlm("TGT PKT ITEM", "RAW")
291
- } else if (item_name === undefined) {
292
- if (
293
- ['RAW', 'CONVERTED', 'FORMATTED', 'WITH_UNITS'].includes(packet_name)
294
- ) {
295
- data = await this.exec('tlm', [target_name], { type: packet_name })
296
- } else {
297
- let err = new Error()
298
- err.name = 'TypeError'
299
- err.message = `Invalid data type ${packet_name}. Valid options are RAW, CONVERTED, FORMATTED, and WITH_UNITS.`
300
- throw err
301
- }
302
- } else {
303
- data = await this.exec('tlm', [target_name, packet_name, item_name], {
304
- type: value_type,
305
- })
306
- }
307
- let converted = this.decode_openc3_type(data)
308
- if (converted !== null) {
309
- data = converted
310
- }
311
- return data
312
- }
313
-
314
- async inject_tlm(
315
- target_name,
316
- packet_name,
317
- item_hash = null,
318
- value_type = 'CONVERTED',
319
- ) {
320
- data = await this.exec(
321
- 'inject_tlm',
322
- [target_name, packet_name, item_hash],
323
- {
324
- type: value_type,
325
- },
326
- )
327
- }
328
-
329
- set_tlm(target_name, packet_name, item_name, value_type) {
330
- return this.exec('set_tlm', [target_name, packet_name, item_name], {
331
- type: value_type,
332
- })
333
- }
334
-
335
- override_tlm(target_name, packet_name, item_name, value_type) {
336
- return this.exec('override_tlm', [target_name, packet_name, item_name], {
337
- type: value_type,
338
- })
339
- }
340
-
341
- get_overrides() {
342
- return this.exec('get_overrides')
343
- }
344
-
345
- normalize_tlm(target_name, packet_name, item_name, value_type) {
346
- return this.exec('normalize_tlm', [target_name, packet_name, item_name], {
347
- type: value_type,
348
- })
349
- }
350
-
351
- get_all_cmds(target_name) {
352
- return this.exec('get_all_cmds', [target_name])
353
- }
354
-
355
- get_all_cmd_names(target_name, hidden = false) {
356
- return this.exec('get_all_cmd_names', [target_name], { hidden: hidden })
357
- }
358
-
359
- get_cmd(target_name, command_name) {
360
- return this.exec('get_cmd', [target_name, command_name])
361
- }
362
-
363
- get_cmd_cnts(target_commands) {
364
- return this.exec('get_cmd_cnts', [target_commands])
365
- }
366
-
367
- get_cmd_value(
368
- target_name,
369
- packet_name,
370
- parameter_name,
371
- value_type = 'CONVERTED',
372
- ) {
373
- return this.exec('get_cmd_value', [
374
- target_name,
375
- packet_name,
376
- parameter_name,
377
- value_type,
378
- ])
379
- }
380
-
381
- get_cmd_buffer(target_name, packet_name) {
382
- return this.exec('get_cmd_buffer', [target_name, packet_name])
383
- }
384
-
385
- // Implementation of functionality shared by cmd methods with param_lists.
386
- _cmd(method, target_name, command_name, param_list, headerOptions) {
387
- let converted = null
388
- for (let key in param_list) {
389
- if (Object.prototype.hasOwnProperty.call(param_list, key)) {
390
- converted = this.encode_openc3_type(param_list[key])
391
- if (converted !== null) {
392
- param_list[key] = converted
393
- }
394
- }
395
- }
396
- return this.exec(
397
- method,
398
- [target_name, command_name, param_list],
399
- {},
400
- headerOptions,
401
- )
402
- }
403
-
404
- get_cmd_hazardous(target_name, command_name, param_list) {
405
- if (command_name === undefined) {
406
- return this.exec('get_cmd_hazardous', target_name)
407
- } else {
408
- return this._cmd(
409
- 'get_cmd_hazardous',
410
- target_name,
411
- command_name,
412
- param_list,
413
- )
414
- }
415
- }
416
-
417
- cmd(target_name, command_name, param_list, headerOptions = {}) {
418
- if (command_name === undefined) {
419
- return this.exec('cmd', target_name, {}, headerOptions)
420
- } else {
421
- return this._cmd(
422
- 'cmd',
423
- target_name,
424
- command_name,
425
- param_list,
426
- headerOptions,
427
- )
428
- }
429
- }
430
-
431
- cmd_no_range_check(target_name, command_name, param_list) {
432
- if (command_name === undefined) {
433
- return this.exec('cmd_no_range_check', target_name)
434
- } else {
435
- return this._cmd(
436
- 'cmd_no_range_check',
437
- target_name,
438
- command_name,
439
- param_list,
440
- )
441
- }
442
- }
443
-
444
- cmd_raw(target_name, command_name, param_list) {
445
- if (command_name === undefined) {
446
- return this.exec('cmd_raw', target_name)
447
- } else {
448
- return this._cmd('cmd_raw', target_name, command_name, param_list)
449
- }
450
- }
451
-
452
- cmd_raw_no_range_check(target_name, command_name, param_list) {
453
- if (command_name === undefined) {
454
- return this.exec('cmd_raw_no_range_check', target_name)
455
- } else {
456
- return this._cmd(
457
- 'cmd_raw_no_range_check',
458
- target_name,
459
- command_name,
460
- param_list,
461
- )
462
- }
463
- }
464
-
465
- cmd_no_hazardous_check(target_name, command_name, param_list) {
466
- if (command_name === undefined) {
467
- return this.exec('cmd_no_hazardous_check', target_name)
468
- } else {
469
- return this._cmd(
470
- 'cmd_no_hazardous_check',
471
- target_name,
472
- command_name,
473
- param_list,
474
- )
475
- }
476
- }
477
-
478
- cmd_no_checks(target_name, command_name, param_list) {
479
- if (command_name === undefined) {
480
- return this.exec('cmd_no_checks', target_name)
481
- } else {
482
- return this._cmd('cmd_no_checks', target_name, command_name, param_list)
483
- }
484
- }
485
-
486
- cmd_raw_no_hazardous_check(target_name, command_name, param_list) {
487
- if (command_name === undefined) {
488
- return this.exec('cmd_raw_no_hazardous_check', target_name)
489
- } else {
490
- return this._cmd(
491
- 'cmd_raw_no_hazardous_check',
492
- target_name,
493
- command_name,
494
- param_list,
495
- )
496
- }
497
- }
498
-
499
- cmd_raw_no_checks(target_name, command_name, param_list) {
500
- if (command_name === undefined) {
501
- return this.exec('cmd_raw_no_checks', target_name)
502
- } else {
503
- return this._cmd(
504
- 'cmd_raw_no_checks',
505
- target_name,
506
- command_name,
507
- param_list,
508
- )
509
- }
510
- }
511
-
512
- build_cmd(target_name, command_name, param_list) {
513
- if (command_name === undefined) {
514
- return this.exec('build_cmd', target_name)
515
- } else {
516
- return this._cmd('build_cmd', target_name, command_name, param_list)
517
- }
518
- }
519
-
520
- get_interface_names() {
521
- return this.exec('get_interface_names', [])
522
- }
523
-
524
- send_raw(interface_name, data) {
525
- return this.exec('send_raw', [interface_name, data])
526
- }
527
-
528
- list_configs(tool) {
529
- return this.exec('list_configs', [tool])
530
- }
531
-
532
- load_config(tool, name) {
533
- return this.exec('load_config', [tool, name])
534
- }
535
-
536
- save_config(tool, name, data) {
537
- return this.exec('save_config', [tool, name, data])
538
- }
539
-
540
- delete_config(tool, name) {
541
- return this.exec('delete_config', [tool, name])
542
- }
543
-
544
- enable_limits(target, packet, item) {
545
- return this.exec('enable_limits', [target, packet, item])
546
- }
547
-
548
- disable_limits(target, packet, item) {
549
- return this.exec('disable_limits', [target, packet, item])
550
- }
551
-
552
- get_out_of_limits() {
553
- return this.exec('get_out_of_limits', [])
554
- }
555
-
556
- get_overall_limits_state(ignored) {
557
- return this.exec('get_overall_limits_state', [ignored])
558
- }
559
-
560
- list_settings() {
561
- return this.exec('list_settings', [])
562
- }
563
-
564
- get_all_settings() {
565
- return this.exec('get_all_settings', [])
566
- }
567
-
568
- get_setting(name) {
569
- return this.exec('get_setting', [name])
570
- }
571
-
572
- get_settings(array) {
573
- return this.exec('get_settings', array)
574
- }
575
-
576
- set_setting(name, data) {
577
- return this.exec('set_setting', [name, data])
578
- }
579
-
580
- get_metrics() {
581
- return this.exec('get_metrics', [])
582
- }
583
-
584
- // TODO: Currently unused but seemed like a useful function
585
- async hashString(string) {
586
- if (window.isSecureContext) {
587
- // Encode the string as an arrayBuffer which the subtle crypto API uses
588
- const arrayBuffer = new TextEncoder().encode(string)
589
- // Use the subtle crypto API to perform a SHA256 Sum of the array buffer
590
- // The resulting hash is stored in an array buffer
591
- const hashAsArrayBuffer = await crypto.subtle.digest(
592
- 'SHA-256',
593
- arrayBuffer,
594
- )
595
- // To create a string we will get the hexadecimal value of each byte of the array buffer
596
- // This gets us an array where each byte of the array buffer becomes one item in the array
597
- const uint8ViewOfHash = new Uint8Array(hashAsArrayBuffer)
598
- // We then convert it to a regular array so we can convert each item to hexadecimal strings
599
- // Where to characters of 0-9 or a-f represent a number between 0 and 16, containing 4 bits of information, so 2 of them is 8 bits (1 byte).
600
- return Array.from(uint8ViewOfHash)
601
- .map((b) => b.toString(16).padStart(2, '0'))
602
- .join('')
603
- }
604
- // else ?
605
- }
606
- }
@@ -1,43 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: {
4
- node: true,
5
- },
6
- extends: [
7
- 'plugin:vue/essential',
8
- 'plugin:prettier/recommended',
9
- '@vue/prettier',
10
- ],
11
- plugins: ['prettier'],
12
- rules: {
13
- 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
14
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
15
- 'prettier/prettier': [
16
- 'warn',
17
- {
18
- endOfLine: 'auto',
19
- },
20
- ],
21
- 'vue/multi-word-component-names': 'off',
22
- 'vue/valid-v-slot': [
23
- 'error',
24
- {
25
- allowModifiers: true,
26
- },
27
- ],
28
- },
29
- parserOptions: {
30
- parser: '@babel/eslint-parser',
31
- },
32
- overrides: [
33
- {
34
- files: [
35
- '**/__tests__/*.{j,t}s?(x)',
36
- '**/tests/unit/**/*.spec.{j,t}s?(x)',
37
- ],
38
- env: {
39
- jest: true,
40
- },
41
- },
42
- ],
43
- }
@@ -1,11 +0,0 @@
1
- {
2
- "presets": ["@vue/cli-plugin-babel/preset"],
3
- "plugins": [
4
- [
5
- "babel-plugin-istanbul",
6
- {
7
- "extension": [".js", ".vue"]
8
- }
9
- ]
10
- ]
11
- }
@@ -1,38 +0,0 @@
1
- const path = require('path')
2
-
3
- module.exports = {
4
- publicPath: '/tools/<%= tool_name %>',
5
- outputDir: 'tools/<%= tool_name %>',
6
- filenameHashing: false,
7
- transpileDependencies: ['vuetify'],
8
- devServer: {
9
- port: 2999,
10
- headers: {
11
- 'Access-Control-Allow-Origin': '*',
12
- },
13
- client: {
14
- webSocketURL: {
15
- hostname: 'localhost',
16
- pathname: '/tools/<%= tool_name %>',
17
- port: 2999,
18
- },
19
- },
20
- },
21
- configureWebpack: {
22
- output: {
23
- libraryTarget: 'system',
24
- },
25
- },
26
- chainWebpack: (config) => {
27
- config.module.rule('js').use('babel-loader')
28
- config.module
29
- .rule('vue')
30
- .use('vue-loader')
31
- .tap((options) => {
32
- return {
33
- prettify: false,
34
- }
35
- })
36
- config.externals(['vue', 'vuetify', 'vuex', 'vue-router'])
37
- },
38
- }