openc3 5.8.1 → 5.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/openc3/ext/crc/crc.c +1 -1
- data/lib/openc3/api/cmd_api.rb +1 -1
- data/lib/openc3/api/limits_api.rb +4 -20
- data/lib/openc3/api/target_api.rb +11 -8
- data/lib/openc3/api/tlm_api.rb +29 -38
- data/lib/openc3/microservices/decom_microservice.rb +10 -2
- data/lib/openc3/microservices/reaction_microservice.rb +152 -81
- data/lib/openc3/microservices/timeline_microservice.rb +1 -1
- data/lib/openc3/microservices/trigger_group_microservice.rb +188 -118
- data/lib/openc3/migrations/20230615000000_autonomic.rb +86 -0
- data/lib/openc3/models/activity_model.rb +2 -4
- data/lib/openc3/models/auth_model.rb +18 -6
- data/lib/openc3/models/cvt_model.rb +113 -50
- data/lib/openc3/models/microservice_model.rb +6 -2
- data/lib/openc3/models/model.rb +1 -3
- data/lib/openc3/models/reaction_model.rb +124 -119
- data/lib/openc3/models/scope_model.rb +15 -3
- data/lib/openc3/models/target_model.rb +43 -1
- data/lib/openc3/models/timeline_model.rb +1 -3
- data/lib/openc3/models/trigger_group_model.rb +16 -50
- data/lib/openc3/models/trigger_model.rb +86 -123
- data/lib/openc3/packets/json_packet.rb +2 -3
- data/lib/openc3/script/commands.rb +10 -0
- data/lib/openc3/script/script.rb +1 -0
- data/lib/openc3/top_level.rb +0 -12
- data/lib/openc3/utilities/authorization.rb +1 -1
- data/lib/openc3/utilities/bucket_require.rb +5 -1
- data/lib/openc3/utilities/bucket_utilities.rb +4 -1
- data/lib/openc3/utilities/cli_generator.rb +56 -4
- data/lib/openc3/utilities/local_mode.rb +1 -1
- data/lib/openc3/utilities/ruby_lex_utils.rb +4 -0
- data/lib/openc3/version.rb +5 -5
- data/templates/plugin/README.md +54 -4
- data/templates/plugin/Rakefile +31 -3
- data/templates/tool_angular/.editorconfig +16 -0
- data/templates/tool_angular/.gitignore +44 -0
- data/templates/tool_angular/.vscode/extensions.json +4 -0
- data/templates/tool_angular/.vscode/launch.json +20 -0
- data/templates/tool_angular/.vscode/tasks.json +42 -0
- data/templates/tool_angular/angular.json +111 -0
- data/templates/tool_angular/extra-webpack.config.js +8 -0
- data/templates/tool_angular/package.json +47 -0
- data/templates/tool_angular/src/app/app-routing.module.ts +15 -0
- data/templates/tool_angular/src/app/app.component.html +31 -0
- data/templates/tool_angular/src/app/app.component.scss +26 -0
- data/templates/tool_angular/src/app/app.component.spec.ts +29 -0
- data/templates/tool_angular/src/app/app.component.ts +51 -0
- data/templates/tool_angular/src/app/app.module.ts +30 -0
- data/templates/tool_angular/src/app/custom-overlay-container.ts +17 -0
- data/templates/tool_angular/src/app/empty-route/empty-route.component.ts +7 -0
- data/templates/tool_angular/src/app/openc3-api.d.ts +1 -0
- data/templates/tool_angular/src/assets/.gitkeep +0 -0
- data/templates/tool_angular/src/environments/environment.prod.ts +3 -0
- data/templates/tool_angular/src/environments/environment.ts +16 -0
- data/templates/tool_angular/src/favicon.ico +0 -0
- data/templates/tool_angular/src/index.html +13 -0
- data/templates/tool_angular/src/main.single-spa.ts +40 -0
- data/templates/tool_angular/src/single-spa/asset-url.ts +12 -0
- data/templates/tool_angular/src/single-spa/single-spa-props.ts +8 -0
- data/templates/tool_angular/src/styles.scss +1 -0
- data/templates/tool_angular/tsconfig.app.json +13 -0
- data/templates/tool_angular/tsconfig.json +33 -0
- data/templates/tool_angular/tsconfig.spec.json +14 -0
- data/templates/tool_angular/yarn.lock +8080 -0
- data/templates/tool_react/.eslintrc +7 -0
- data/templates/tool_react/.gitignore +72 -0
- data/templates/tool_react/.prettierignore +8 -0
- data/templates/tool_react/babel.config.json +29 -0
- data/templates/tool_react/jest.config.js +12 -0
- data/templates/tool_react/package.json +53 -0
- data/templates/tool_react/src/openc3-tool_name.js +24 -0
- data/templates/tool_react/src/root.component.js +88 -0
- data/templates/tool_react/src/root.component.test.js +9 -0
- data/templates/tool_react/webpack.config.js +27 -0
- data/templates/tool_react/yarn.lock +6854 -0
- data/templates/tool_svelte/.gitignore +72 -0
- data/templates/tool_svelte/.prettierignore +8 -0
- data/templates/tool_svelte/babel.config.js +12 -0
- data/templates/tool_svelte/build/smui.css +5 -0
- data/templates/tool_svelte/jest.config.js +9 -0
- data/templates/tool_svelte/package.json +46 -0
- data/templates/tool_svelte/rollup.config.js +72 -0
- data/templates/tool_svelte/src/App.svelte +42 -0
- data/templates/tool_svelte/src/App.test.js +9 -0
- data/templates/tool_svelte/src/services/api.js +92 -0
- data/templates/tool_svelte/src/services/axios.js +85 -0
- data/templates/tool_svelte/src/services/cable.js +65 -0
- data/templates/tool_svelte/src/services/config-parser.js +199 -0
- data/templates/tool_svelte/src/services/openc3-api.js +647 -0
- data/templates/tool_svelte/src/theme/_smui-theme.scss +25 -0
- data/templates/tool_svelte/src/tool_name.js +17 -0
- data/templates/tool_svelte/yarn.lock +5052 -0
- data/templates/tool_vue/.browserslistrc +16 -0
- data/templates/tool_vue/.env.standalone +1 -0
- data/templates/tool_vue/.eslintrc.js +43 -0
- data/templates/tool_vue/.gitignore +2 -0
- data/templates/tool_vue/.nycrc +3 -0
- data/templates/tool_vue/.prettierrc.js +5 -0
- data/templates/tool_vue/babel.config.json +11 -0
- data/templates/tool_vue/jsconfig.json +6 -0
- data/templates/tool_vue/package.json +52 -0
- data/templates/tool_vue/src/App.vue +15 -0
- data/templates/tool_vue/src/main.js +38 -0
- data/templates/tool_vue/src/router.js +29 -0
- data/templates/tool_vue/src/tools/tool_name/tool_name.vue +63 -0
- data/templates/tool_vue/vue.config.js +30 -0
- data/templates/tool_vue/yarn.lock +9145 -0
- data/templates/widget/package.json +9 -9
- data/templates/widget/yarn.lock +77 -73
- metadata +76 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c24a28732bfd8c275b65639cd566b4823d78b70b43781bf14a82e114397e7677
|
4
|
+
data.tar.gz: a8567e57ec8008d505e7f6a30cd3462e435988a46729908fbc17775f2b92e976
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc287a9895e3ae60c6332389d0b7926bb84aa04d7d65e51c936ba65f66640b179b0baefdcec232d7775a70f2e95d88557faf5e960663c4c28840428e7cb52904
|
7
|
+
data.tar.gz: 578c1f1fe45512344390492e9aa15d7af851bb81e608fbc874189dcc73bc998c472e62d449c114fb300fc58bb0d9cc269cc3dfbcbb31aaaf76c9003abd63c8e7
|
data/ext/openc3/ext/crc/crc.c
CHANGED
data/lib/openc3/api/cmd_api.rb
CHANGED
@@ -393,7 +393,7 @@ module OpenC3
|
|
393
393
|
# Check if any of the parameters have DISABLE_MESSAGES
|
394
394
|
cmd_params.each do |key, value|
|
395
395
|
item = packet['items'].find { |item| item['name'] == key.to_s }
|
396
|
-
if item['states'] && item['states'][value] && item['states'][value]["messages_disabled"]
|
396
|
+
if item && item['states'] && item['states'][value] && item['states'][value]["messages_disabled"]
|
397
397
|
log_message = false
|
398
398
|
end
|
399
399
|
end
|
@@ -373,26 +373,10 @@ module OpenC3
|
|
373
373
|
# @param item_name [String] item name
|
374
374
|
# @param scope [String] scope
|
375
375
|
# @return Hash The requested item based on the packet name
|
376
|
-
def _get_item(target_name, packet_name, item_name, scope:)
|
377
|
-
|
378
|
-
if packet_name == 'LATEST'
|
379
|
-
|
380
|
-
TargetModel.packets(target_name, scope: scope).each do |packet|
|
381
|
-
item = packet['items'].find { |item| item['name'] == item_name }
|
382
|
-
if item
|
383
|
-
hash = CvtModel.get(target_name: target_name, packet_name: packet['packet_name'], scope: scope)
|
384
|
-
if hash['PACKET_TIMESECONDS'] && hash['PACKET_TIMESECONDS'] > latest
|
385
|
-
latest = hash['PACKET_TIMESECONDS']
|
386
|
-
requested_item = item
|
387
|
-
end
|
388
|
-
end
|
389
|
-
end
|
390
|
-
raise "Item '#{target_name} LATEST #{item_name}' does not exist" if latest == -1
|
391
|
-
else
|
392
|
-
# Determine if this item exists, it will raise appropriate errors if not
|
393
|
-
requested_item = TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
|
394
|
-
end
|
395
|
-
return requested_item
|
376
|
+
def _get_item(target_name, packet_name, item_name, cache_timeout: 0.1, scope:)
|
377
|
+
# Determine if this item exists, it will raise appropriate errors if not
|
378
|
+
packet_name = CvtModel.determine_latest_packet_for_item(target_name, item_name, cache_timeout: cache_timeout, scope: $openc3_scope) if packet_name == 'LATEST'
|
379
|
+
return TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
|
396
380
|
end
|
397
381
|
end
|
398
382
|
end
|
@@ -26,19 +26,22 @@ module OpenC3
|
|
26
26
|
module Api
|
27
27
|
WHITELIST ||= []
|
28
28
|
WHITELIST.concat([
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
'get_target_names',
|
30
|
+
'get_target_list', # DEPRECATED
|
31
|
+
'get_target',
|
32
|
+
'get_target_interfaces',
|
33
|
+
'get_all_target_info', # DEPRECATED
|
34
|
+
])
|
34
35
|
|
35
36
|
# Returns the list of all target names
|
36
37
|
#
|
37
38
|
# @return [Array<String>] All target names
|
38
|
-
def
|
39
|
+
def get_target_names(scope: $openc3_scope, token: $openc3_token)
|
39
40
|
authorize(permission: 'tlm', scope: scope, token: token)
|
40
41
|
TargetModel.names(scope: scope)
|
41
42
|
end
|
43
|
+
# get_target_list is DEPRECATED
|
44
|
+
alias get_target_list get_target_names
|
42
45
|
|
43
46
|
# Gets the full target hash
|
44
47
|
#
|
@@ -57,7 +60,7 @@ module OpenC3
|
|
57
60
|
authorize(permission: 'system', scope: scope, token: token)
|
58
61
|
info = []
|
59
62
|
interfaces = InterfaceModel.all(scope: scope)
|
60
|
-
|
63
|
+
get_target_names(scope: scope, token: token).each do |target_name|
|
61
64
|
interface_names = []
|
62
65
|
interfaces.each do |name, interface|
|
63
66
|
if interface['target_names'].include? target_name
|
@@ -76,7 +79,7 @@ module OpenC3
|
|
76
79
|
def get_all_target_info(scope: $openc3_scope, token: $openc3_token)
|
77
80
|
authorize(permission: 'system', scope: scope, token: token)
|
78
81
|
info = []
|
79
|
-
|
82
|
+
get_target_names(scope: scope, token: token).each do |target_name|
|
80
83
|
cmd_cnt = 0
|
81
84
|
packets = TargetModel.packets(target_name, type: :CMD, scope: scope)
|
82
85
|
packets.each do |packet|
|
data/lib/openc3/api/tlm_api.rb
CHANGED
@@ -66,30 +66,30 @@ module OpenC3
|
|
66
66
|
# @param args [String|Array<String>] See the description for calling style
|
67
67
|
# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
|
68
68
|
# @return [Object] The telemetry value formatted as requested
|
69
|
-
def tlm(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
70
|
-
target_name, packet_name, item_name = tlm_process_args(args, 'tlm', scope: scope)
|
69
|
+
def tlm(*args, type: :CONVERTED, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
70
|
+
target_name, packet_name, item_name = tlm_process_args(args, 'tlm', cache_timeout: cache_timeout, scope: scope)
|
71
71
|
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
72
|
-
CvtModel.get_item(target_name, packet_name, item_name, type: type.intern, scope: scope)
|
72
|
+
CvtModel.get_item(target_name, packet_name, item_name, type: type.intern, cache_timeout: cache_timeout, scope: scope)
|
73
73
|
end
|
74
74
|
|
75
75
|
# @deprecated Use tlm with type: :RAW
|
76
|
-
def tlm_raw(*args, scope: $openc3_scope, token: $openc3_token)
|
77
|
-
tlm(*args, type: :RAW, scope: scope, token: token)
|
76
|
+
def tlm_raw(*args, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
77
|
+
tlm(*args, type: :RAW, cache_timeout: cache_timeout, scope: scope, token: token)
|
78
78
|
end
|
79
79
|
|
80
80
|
# @deprecated Use tlm with type: :FORMATTED
|
81
|
-
def tlm_formatted(*args, scope: $openc3_scope, token: $openc3_token)
|
82
|
-
tlm(*args, type: :FORMATTED, scope: scope, token: token)
|
81
|
+
def tlm_formatted(*args, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
82
|
+
tlm(*args, type: :FORMATTED, cache_timeout: cache_timeout, scope: scope, token: token)
|
83
83
|
end
|
84
84
|
|
85
85
|
# @deprecated Use tlm with type: :WITH_UNITS
|
86
|
-
def tlm_with_units(*args, scope: $openc3_scope, token: $openc3_token)
|
87
|
-
tlm(*args, type: :WITH_UNITS, scope: scope, token: token)
|
86
|
+
def tlm_with_units(*args, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
87
|
+
tlm(*args, type: :WITH_UNITS, cache_timeout: cache_timeout, scope: scope, token: token)
|
88
88
|
end
|
89
89
|
|
90
90
|
# @deprecated Use tlm with type:
|
91
|
-
def tlm_variable(*args, scope: $openc3_scope, token: $openc3_token)
|
92
|
-
tlm(*args[0..-2], type: args[-1].intern, scope: scope, token: token)
|
91
|
+
def tlm_variable(*args, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
92
|
+
tlm(*args[0..-2], type: args[-1].intern, cache_timeout: cache_timeout, scope: scope, token: token)
|
93
93
|
end
|
94
94
|
|
95
95
|
# Set a telemetry item in the current value table.
|
@@ -227,7 +227,7 @@ module OpenC3
|
|
227
227
|
# @return [Array<String, Object, Symbol|nil>] Returns an Array consisting
|
228
228
|
# of [item name, item value, item limits state] where the item limits
|
229
229
|
# state can be one of {OpenC3::Limits::LIMITS_STATES}
|
230
|
-
def get_tlm_packet(target_name, packet_name, stale_time: 30, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
230
|
+
def get_tlm_packet(target_name, packet_name, stale_time: 30, type: :CONVERTED, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
231
231
|
target_name = target_name.upcase
|
232
232
|
packet_name = packet_name.upcase
|
233
233
|
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
@@ -235,8 +235,8 @@ module OpenC3
|
|
235
235
|
t = _validate_tlm_type(type)
|
236
236
|
raise ArgumentError, "Unknown type '#{type}' for #{target_name} #{packet_name}" if t.nil?
|
237
237
|
items = packet['items'].map { | item | item['name'].upcase }
|
238
|
-
cvt_items = items.map { | item |
|
239
|
-
current_values = CvtModel.get_tlm_values(cvt_items, stale_time: stale_time, scope: scope)
|
238
|
+
cvt_items = items.map { | item | [target_name, packet_name, item, type] }
|
239
|
+
current_values = CvtModel.get_tlm_values(cvt_items, stale_time: stale_time, cache_timeout: cache_timeout, scope: scope)
|
240
240
|
items.zip(current_values).map { | item , values | [item, values[0], values[1]]}
|
241
241
|
end
|
242
242
|
|
@@ -250,25 +250,26 @@ module OpenC3
|
|
250
250
|
# @return [Array<Object, Symbol>]
|
251
251
|
# Array consisting of the item value and limits state
|
252
252
|
# given as symbols such as :RED, :YELLOW, :STALE
|
253
|
-
def get_tlm_values(items, stale_time: 30, scope: $openc3_scope, token: $openc3_token)
|
253
|
+
def get_tlm_values(items, stale_time: 30, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
254
254
|
if !items.is_a?(Array) || !items[0].is_a?(String)
|
255
255
|
raise ArgumentError, "items must be array of strings: ['TGT__PKT__ITEM__TYPE', ...]"
|
256
256
|
end
|
257
|
+
packets = []
|
258
|
+
cvt_items = []
|
257
259
|
items.each_with_index do |item, index|
|
258
|
-
|
260
|
+
item_upcase = item.to_s.upcase
|
261
|
+
target_name, packet_name, item_name, value_type = item_upcase.split('__')
|
259
262
|
raise ArgumentError, "items must be formatted as TGT__PKT__ITEM__TYPE" if target_name.nil? || packet_name.nil? || item_name.nil? || value_type.nil?
|
260
|
-
|
261
|
-
packet_name = packet_name.upcase
|
262
|
-
item_name = item_name.upcase
|
263
|
-
value_type = value_type.upcase
|
264
|
-
if packet_name == 'LATEST'
|
265
|
-
_, packet_name, _ = tlm_process_args([target_name, packet_name, item_name], 'get_tlm_values', scope: scope) # Figure out which packet is LATEST
|
266
|
-
end
|
263
|
+
packet_name = CvtModel.determine_latest_packet_for_item(target_name, item_name, cache_timeout: cache_timeout, scope: scope) if packet_name == 'LATEST'
|
267
264
|
# Change packet_name in case of LATEST and ensure upcase
|
268
|
-
|
265
|
+
cvt_items[index] = [target_name, packet_name, item_name, value_type]
|
266
|
+
packets << [target_name, packet_name]
|
267
|
+
end
|
268
|
+
packets.uniq!
|
269
|
+
packets.each do |target_name, packet_name|
|
269
270
|
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
270
271
|
end
|
271
|
-
CvtModel.get_tlm_values(
|
272
|
+
CvtModel.get_tlm_values(cvt_items, stale_time: stale_time, cache_timeout: cache_timeout, scope: scope)
|
272
273
|
end
|
273
274
|
|
274
275
|
# Returns an array of all the telemetry packet hashes
|
@@ -429,7 +430,7 @@ module OpenC3
|
|
429
430
|
return nil
|
430
431
|
end
|
431
432
|
|
432
|
-
def tlm_process_args(args, method_name, scope: $openc3_scope, token: $openc3_token)
|
433
|
+
def tlm_process_args(args, method_name, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token)
|
433
434
|
case args.length
|
434
435
|
when 1
|
435
436
|
target_name, packet_name, item_name = extract_fields_from_tlm_text(args[0])
|
@@ -444,19 +445,9 @@ module OpenC3
|
|
444
445
|
target_name = target_name.upcase
|
445
446
|
packet_name = packet_name.upcase
|
446
447
|
item_name = item_name.upcase
|
448
|
+
|
447
449
|
if packet_name == 'LATEST'
|
448
|
-
|
449
|
-
TargetModel.packets(target_name, scope: scope).each do |packet|
|
450
|
-
item = packet['items'].find { |item| item['name'] == item_name }
|
451
|
-
if item
|
452
|
-
hash = CvtModel.get(target_name: target_name, packet_name: packet['packet_name'], scope: scope)
|
453
|
-
if hash['PACKET_TIMESECONDS'] && hash['PACKET_TIMESECONDS'] > latest
|
454
|
-
latest = hash['PACKET_TIMESECONDS']
|
455
|
-
packet_name = packet['packet_name']
|
456
|
-
end
|
457
|
-
end
|
458
|
-
end
|
459
|
-
raise "Item '#{target_name} LATEST #{item_name}' does not exist" if latest == -1
|
450
|
+
packet_name = CvtModel.determine_latest_packet_for_item(target_name, item_name, cache_timeout: cache_timeout, scope: scope)
|
460
451
|
else
|
461
452
|
# Determine if this item exists, it will raise appropriate errors if not
|
462
453
|
TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
|
@@ -124,14 +124,22 @@ module OpenC3
|
|
124
124
|
when :BLUE, :GREEN, :GREEN_LOW, :GREEN_HIGH
|
125
125
|
@logger.info message
|
126
126
|
when :YELLOW, :YELLOW_LOW, :YELLOW_HIGH
|
127
|
+
notification = NotificationModel.new(
|
128
|
+
time: time_nsec,
|
129
|
+
severity: "caution",
|
130
|
+
url: "/tools/limitsmonitor",
|
131
|
+
title: "#{packet.target_name} #{packet.packet_name} #{item.name} #{item.limits.state}",
|
132
|
+
body: "#{item.name} is #{item.limits.state}"
|
133
|
+
)
|
134
|
+
NotificationsTopic.write_notification(notification.as_json(:allow_nan => true), scope: @scope)
|
127
135
|
@logger.warn message
|
128
136
|
when :RED, :RED_LOW, :RED_HIGH
|
129
137
|
notification = NotificationModel.new(
|
130
138
|
time: time_nsec,
|
131
139
|
severity: "critical",
|
132
140
|
url: "/tools/limitsmonitor",
|
133
|
-
title: "#{packet.target_name} #{packet.packet_name} #{item.name}
|
134
|
-
body: "
|
141
|
+
title: "#{packet.target_name} #{packet.packet_name} #{item.name} #{item.limits.state}",
|
142
|
+
body: "#{item.name} is #{item.limits.state}"
|
135
143
|
)
|
136
144
|
NotificationsTopic.write_notification(notification.as_json(:allow_nan => true), scope: @scope)
|
137
145
|
@logger.error message
|