openc3 5.11.2 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/bin/openc3cli +26 -12
  4. data/data/config/_id_items.yaml +6 -4
  5. data/data/config/_id_params.yaml +9 -6
  6. data/data/config/_items.yaml +6 -4
  7. data/data/config/_params.yaml +3 -2
  8. data/data/config/interface_modifiers.yaml +1 -1
  9. data/data/config/microservice.yaml +10 -1
  10. data/data/config/plugins.yaml +13 -3
  11. data/data/config/target.yaml +9 -0
  12. data/data/config/target_config.yaml +12 -0
  13. data/data/config/tool.yaml +12 -3
  14. data/lib/openc3/api/api.rb +1 -1
  15. data/lib/openc3/api/cmd_api.rb +24 -24
  16. data/lib/openc3/api/config_api.rb +12 -12
  17. data/lib/openc3/api/limits_api.rb +4 -3
  18. data/lib/openc3/api/settings_api.rb +5 -2
  19. data/lib/openc3/api/tlm_api.rb +7 -10
  20. data/lib/openc3/conversions/unix_time_conversion.rb +8 -6
  21. data/lib/openc3/interfaces/tcpip_server_interface.rb +0 -7
  22. data/lib/openc3/io/json_drb.rb +3 -2
  23. data/lib/openc3/io/json_rpc.rb +6 -6
  24. data/lib/openc3/logs/buffered_packet_log_writer.rb +4 -2
  25. data/lib/openc3/logs/packet_log_writer.rb +22 -7
  26. data/lib/openc3/microservices/cleanup_microservice.rb +8 -1
  27. data/lib/openc3/microservices/decom_microservice.rb +1 -1
  28. data/lib/openc3/microservices/interface_microservice.rb +2 -2
  29. data/lib/openc3/microservices/microservice.rb +5 -2
  30. data/lib/openc3/microservices/reaction_microservice.rb +1 -0
  31. data/lib/openc3/microservices/timeline_microservice.rb +7 -5
  32. data/lib/openc3/migrations/20231022000000_tlm_viewer_config.rb +22 -0
  33. data/lib/openc3/models/activity_model.rb +21 -3
  34. data/lib/openc3/models/cvt_model.rb +2 -1
  35. data/lib/openc3/models/gem_model.rb +4 -1
  36. data/lib/openc3/models/interface_model.rb +11 -5
  37. data/lib/openc3/models/metadata_model.rb +11 -0
  38. data/lib/openc3/models/microservice_model.rb +16 -3
  39. data/lib/openc3/models/model.rb +18 -0
  40. data/lib/openc3/models/note_model.rb +11 -0
  41. data/lib/openc3/models/plugin_model.rb +18 -0
  42. data/lib/openc3/models/python_package_model.rb +104 -0
  43. data/lib/openc3/models/scope_model.rb +2 -0
  44. data/lib/openc3/models/sorted_model.rb +17 -8
  45. data/lib/openc3/models/target_model.rb +53 -18
  46. data/lib/openc3/models/tool_config_model.rb +9 -3
  47. data/lib/openc3/models/tool_model.rb +22 -7
  48. data/lib/openc3/models/widget_model.rb +19 -3
  49. data/lib/openc3/operators/microservice_operator.rb +2 -0
  50. data/lib/openc3/packets/limits.rb +6 -18
  51. data/lib/openc3/packets/packet.rb +1 -0
  52. data/lib/openc3/packets/parsers/format_string_parser.rb +4 -4
  53. data/lib/openc3/packets/parsers/limits_parser.rb +4 -4
  54. data/lib/openc3/packets/parsers/limits_response_parser.rb +5 -5
  55. data/lib/openc3/packets/parsers/processor_parser.rb +4 -4
  56. data/lib/openc3/packets/parsers/state_parser.rb +3 -3
  57. data/lib/openc3/script/api_shared.rb +50 -32
  58. data/lib/openc3/script/calendar.rb +109 -0
  59. data/lib/openc3/script/commands.rb +1 -8
  60. data/lib/openc3/script/{gems.rb → packages.rb} +20 -16
  61. data/lib/openc3/script/script.rb +49 -38
  62. data/lib/openc3/system/system.rb +2 -0
  63. data/lib/openc3/system/target.rb +10 -1
  64. data/lib/openc3/top_level.rb +2 -2
  65. data/lib/openc3/utilities/aws_bucket.rb +3 -2
  66. data/lib/openc3/utilities/bucket_file_cache.rb +1 -1
  67. data/lib/openc3/utilities/local_mode.rb +3 -1
  68. data/lib/openc3/utilities/logger.rb +1 -1
  69. data/lib/openc3/utilities/ruby_lex_utils.rb +0 -8
  70. data/lib/openc3/version.rb +6 -6
  71. data/templates/tool_angular/package.json +14 -14
  72. data/templates/tool_angular/yarn.lock +282 -129
  73. data/templates/tool_react/package.json +11 -11
  74. data/templates/tool_react/yarn.lock +356 -303
  75. data/templates/tool_svelte/package.json +12 -12
  76. data/templates/tool_svelte/src/services/openc3-api.js +16 -60
  77. data/templates/tool_svelte/yarn.lock +338 -212
  78. data/templates/tool_vue/package.json +9 -9
  79. data/templates/tool_vue/yarn.lock +55 -41
  80. data/templates/widget/package.json +10 -10
  81. data/templates/widget/yarn.lock +59 -45
  82. metadata +36 -5
@@ -14,7 +14,7 @@
14
14
  # GNU Affero General Public License for more details.
15
15
 
16
16
  # Modified by OpenC3, Inc.
17
- # All changes Copyright 2022, OpenC3, Inc.
17
+ # All changes Copyright 2023, OpenC3, Inc.
18
18
  # All Rights Reserved
19
19
  #
20
20
  # This file may also be used under the terms of a commercial license
@@ -24,6 +24,7 @@ require 'openc3'
24
24
  require 'openc3/api/api'
25
25
  require 'openc3/io/json_drb_object'
26
26
  require 'openc3/script/api_shared'
27
+ require 'openc3/script/calendar'
27
28
  require 'openc3/script/metadata'
28
29
  require 'openc3/script/commands'
29
30
  require 'openc3/script/telemetry'
@@ -33,7 +34,7 @@ require 'openc3/script/screen'
33
34
  require 'openc3/script/script_runner'
34
35
  require 'openc3/script/storage'
35
36
  require 'openc3/script/web_socket_api'
36
- require 'openc3/script/gems'
37
+ require 'openc3/script/packages'
37
38
  require 'openc3/script/plugins'
38
39
  require 'openc3/utilities/authentication'
39
40
 
@@ -92,27 +93,48 @@ module OpenC3
92
93
  $script_runner_api_server = nil
93
94
  end
94
95
 
96
+ # This isn't part of the public API because users should use wait()
97
+ def openc3_script_sleep(sleep_time = nil)
98
+ if sleep_time
99
+ sleep(sleep_time)
100
+ else
101
+ prompt("Press any key to continue...")
102
+ end
103
+ return false
104
+ end
105
+
106
+ # Internal method used in scripts when encountering a hazardous command
107
+ def prompt_for_hazardous(target_name, cmd_name, hazardous_description)
108
+ loop do
109
+ message = "Warning: Command #{target_name} #{cmd_name} is Hazardous. "
110
+ message << "\n#{hazardous_description}\n" if hazardous_description
111
+ message << "Send? (y): "
112
+ print message
113
+ answer = gets.chomp
114
+ if answer.downcase == 'y'
115
+ return true
116
+ end
117
+ end
118
+ end
119
+
120
+ ###########################################################################
121
+ # START PUBLIC API
122
+ ###########################################################################
123
+
95
124
  def disconnect_script
96
125
  $disconnect = true
97
126
  end
98
127
 
128
+ # DEPRECATED
99
129
  def play_wav_file(wav_filename)
100
130
  # NOOP
101
131
  end
102
132
 
133
+ # DEPRECATED
103
134
  def status_bar(message)
104
135
  # NOOP
105
136
  end
106
137
 
107
- def openc3_script_sleep(sleep_time = nil)
108
- if sleep_time
109
- sleep(sleep_time)
110
- else
111
- prompt("Press any key to continue...")
112
- end
113
- return false
114
- end
115
-
116
138
  def ask_string(question, blank_or_default = false, password = false)
117
139
  answer = ''
118
140
  default = ''
@@ -174,19 +196,6 @@ module OpenC3
174
196
  _file_dialog(title, message, filter)
175
197
  end
176
198
 
177
- def prompt_for_hazardous(target_name, cmd_name, hazardous_description)
178
- loop do
179
- message = "Warning: Command #{target_name} #{cmd_name} is Hazardous. "
180
- message << "\n#{hazardous_description}\n" if hazardous_description
181
- message << "Send? (y): "
182
- print message
183
- answer = gets.chomp
184
- if answer.downcase == 'y'
185
- return true
186
- end
187
- end
188
- end
189
-
190
199
  def prompt(string, text_color: nil, background_color: nil, font_size: nil, font_family: nil, details: nil)
191
200
  print "#{string}: "
192
201
  print "Details: #{details}\n" if details
@@ -200,6 +209,10 @@ module OpenC3
200
209
  def run_mode
201
210
  # NOOP
202
211
  end
212
+
213
+ ###########################################################################
214
+ # END PUBLIC API
215
+ ###########################################################################
203
216
  end
204
217
 
205
218
  # Provides a proxy to the JsonDRbObject which communicates with the API server
@@ -253,18 +266,18 @@ module OpenC3
253
266
  when :request
254
267
  @json_drb.request(*method_params, **kw_params)
255
268
  else
269
+ # If :disconnect is there delete it and return the value
270
+ # If it is not there, delete returns nil
271
+ disconnect = kw_params.delete(:disconnect)
256
272
  if $disconnect
257
- result = nil
258
- # If :disconnect is there delete it and return the value
259
- # If it is not there, delete returns nil
260
- disconnect = kw_params.delete(:disconnect)
273
+ return disconnect if disconnect
261
274
  # The only commands allowed through in disconnect mode are read-only
262
275
  # Thus we allow the get, list, tlm and limits_enabled and subscribe methods
263
276
  if method_name =~ /\w*_get$|^get_\w*|\w*_list$|^list_\w*|^tlm|^limits_enabled$|^subscribe$/
264
- result = @json_drb.method_missing(method_name, *method_params, **kw_params)
277
+ return @json_drb.method_missing(method_name, *method_params, **kw_params)
278
+ else
279
+ return nil
265
280
  end
266
- # If they overrode the return value using the disconnect keyword then return that
267
- return disconnect ? disconnect : result
268
281
  else
269
282
  @json_drb.method_missing(method_name, *method_params, **kw_params)
270
283
  end
@@ -317,14 +330,12 @@ module OpenC3
317
330
 
318
331
  def request(*method_params, **kw_params)
319
332
  kw_params[:scope] = $openc3_scope unless kw_params[:scope]
320
- if $disconnect
321
- result = nil
322
- # If :disconnect is there delete it and return the value
323
- # If it is not there, delete returns nil
324
- disconnect = kw_params.delete(:disconnect)
325
-
333
+ # If :disconnect is there delete it and return the value
334
+ # If it is not there, delete returns nil
335
+ disconnect = kw_params.delete(:disconnect)
336
+ if $disconnect and disconnect
326
337
  # If they overrode the return value using the disconnect keyword then return that
327
- return disconnect ? disconnect : result
338
+ return disconnect
328
339
  else
329
340
  @json_api.request(*method_params, **kw_params)
330
341
  end
@@ -73,6 +73,8 @@ module OpenC3
73
73
  end
74
74
 
75
75
  def self.setup_targets(target_names, base_dir, scope:)
76
+ # Nothing to do if there are no targets
77
+ return if target_names.nil? or target_names.length == 0
76
78
  if @@instance.nil?
77
79
  FileUtils.mkdir_p("#{base_dir}/targets")
78
80
  bucket = Bucket.getClient()
@@ -32,6 +32,9 @@ module OpenC3
32
32
  # the system processes the target.
33
33
  attr_reader :name
34
34
 
35
+ # @return [String] Programming language. Must be 'ruby' or 'python'.
36
+ attr_reader :language
37
+
35
38
  # @return [Array<String>] List of filenames that must be required by Ruby
36
39
  # before parsing the command and telemetry definitions for this target
37
40
  attr_reader :requires
@@ -83,6 +86,7 @@ module OpenC3
83
86
  # @param path [String] Path to the target directory
84
87
  # @param gem_path [String] Path to the gem file or nil if there is no gem
85
88
  def initialize(target_name, path, gem_path = nil)
89
+ @language = 'ruby'
86
90
  @requires = []
87
91
  @ignored_parameters = []
88
92
  @ignored_items = []
@@ -110,10 +114,15 @@ module OpenC3
110
114
  #
111
115
  # @param filename [String] The target configuration file to parse
112
116
  def process_file(filename)
113
- Logger.instance.info "Processing target definition in file '#{filename}'"
117
+ Logger.instance.info "Processing ruby target definition in file '#{filename}'"
114
118
  parser = ConfigParser.new("https://openc3.com/docs/v5/target")
115
119
  parser.parse_file(filename) do |keyword, parameters|
116
120
  case keyword
121
+ when 'LANGUAGE'
122
+ usage = "#{keyword} <ruby | python>"
123
+ parser.verify_num_parameters(1, 1, usage)
124
+ @language = parameters[0].downcase
125
+
117
126
  when 'REQUIRE'
118
127
  usage = "#{keyword} <FILENAME>"
119
128
  parser.verify_num_parameters(1, 1, usage)
@@ -232,8 +232,7 @@ module OpenC3
232
232
  def self.create_log_file(filename, log_dir = nil)
233
233
  log_file = nil
234
234
  begin
235
- # The following code goes inside a begin rescue because it reads the
236
- # system.txt configuration file. If this has an error we won't be able
235
+ # If this has an error we won't be able
237
236
  # to determine the log path but we still want to write the log.
238
237
  log_dir = System.instance.paths['LOGS'] unless log_dir
239
238
  # Make sure the log directory exists
@@ -310,6 +309,7 @@ module OpenC3
310
309
  file.puts "GEMRC: #{ENV['GEMRC']}"
311
310
  file.puts "RI_DEVKIT: #{ENV['RI_DEVKIT']}"
312
311
  file.puts "GEM_HOME: #{ENV['GEM_HOME']}"
312
+ file.puts "PYTHONUSERBASE: #{ENV['PYTHONUSERBASE']}"
313
313
  file.puts "PATH: #{ENV['PATH']}"
314
314
  file.puts ""
315
315
  file.puts "Ruby Path:\n #{$:.join("\n ")}\n\n"
@@ -81,7 +81,7 @@ module OpenC3
81
81
  ]
82
82
  }
83
83
  EOL
84
- @client.put_bucket_policy({ bucket: bucket, policy: policy })
84
+ @client.put_bucket_policy({ bucket: bucket, policy: policy, checksum_algorithm: "SHA256" })
85
85
  end
86
86
  end
87
87
 
@@ -193,7 +193,8 @@ module OpenC3
193
193
  # put_object fires off the request to store but does not confirm
194
194
  def put_object(bucket:, key:, body:, content_type: nil, cache_control: nil, metadata: nil)
195
195
  @client.put_object(bucket: bucket, key: key, body: body,
196
- content_type: content_type, cache_control: cache_control, metadata: metadata)
196
+ content_type: content_type, cache_control: cache_control, metadata: metadata,
197
+ checksum_algorithm: "SHA256")
197
198
  end
198
199
 
199
200
  # @returns [Boolean] Whether the file exists
@@ -87,7 +87,7 @@ class BucketFile
87
87
  # Try to retrieve the file three times
88
88
  retry_count += 1
89
89
  raise err if retry_count >= 3
90
- Logger.warn("Error retrieving log file from bucket - retry #{retry_count}: #{@bucket_path}\n#{err.formatted}")
90
+ OpenC3::Logger.warn("Error retrieving log file from bucket - retry #{retry_count}: #{@bucket_path}\n#{err.formatted}")
91
91
  sleep(1)
92
92
  retry
93
93
  end
@@ -26,7 +26,7 @@ require 'openc3/utilities/bucket'
26
26
  module OpenC3
27
27
  module LocalMode
28
28
  OPENC3_LOCAL_MODE_PATH = ENV['OPENC3_LOCAL_MODE_PATH'] || "/plugins"
29
-
29
+ # When updating update local_mode.py, PluginsTab.vue, plugins.spec.ts
30
30
  DEFAULT_PLUGINS = [
31
31
  'openc3-cosmos-tool-admin',
32
32
  'openc3-cosmos-tool-autonomic',
@@ -36,7 +36,9 @@ module OpenC3
36
36
  'openc3-cosmos-tool-cmdtlmserver',
37
37
  'openc3-cosmos-tool-dataextractor',
38
38
  'openc3-cosmos-tool-dataviewer',
39
+ 'openc3-cosmos-tool-docs',
39
40
  'openc3-cosmos-tool-handbooks',
41
+ 'openc3-cosmos-tool-iframe',
40
42
  'openc3-cosmos-tool-limitsmonitor',
41
43
  'openc3-cosmos-tool-packetviewer',
42
44
  'openc3-cosmos-tool-scriptrunner',
@@ -180,7 +180,7 @@ module OpenC3
180
180
  data = { time: time.to_nsec_from_epoch, '@timestamp' => time.xmlschema(3), severity: severity_string }
181
181
  data[:microservice_name] = @microservice_name if @microservice_name
182
182
  data[:detail] = @detail_string if @detail_string
183
- data[:user] = user['username'] || 'Unknown' if user # EE: If a user is passed, put its name ('Unknown' if it doesn't have a name). Don't include user data if no user was passed
183
+ data[:user] = user if user # EE: If a user is passed, put its name. Don't include user data if no user was passed.
184
184
  if block_given?
185
185
  message = yield
186
186
  end
@@ -41,14 +41,6 @@ class RubyLex
41
41
  @prompt = nil
42
42
  initialize_input()
43
43
  end
44
-
45
- major, minor, _ = RUBY_VERSION.split('.')
46
- if major == '3' and minor.to_i < 2
47
- alias orig_lex lex
48
- def lex(context)
49
- orig_lex()
50
- end
51
- end
52
44
  end
53
45
  $VERBOSE = old_verbose
54
46
 
@@ -1,14 +1,14 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- OPENC3_VERSION = '5.11.2'
3
+ OPENC3_VERSION = '5.12.0'
4
4
  module OpenC3
5
5
  module Version
6
6
  MAJOR = '5'
7
- MINOR = '11'
8
- PATCH = '2'
7
+ MINOR = '12'
8
+ PATCH = '0'
9
9
  OTHER = ''
10
- BUILD = '88e94fd126464b6e8f8bdbda57b0e41d5577f5b5'
10
+ BUILD = '8f36977eacfebdcdae21f02223be66e69feaa2bf'
11
11
  end
12
- VERSION = '5.11.2'
13
- GEM_VERSION = '5.11.2'
12
+ VERSION = '5.12.0'
13
+ GEM_VERSION = '5.12.0'
14
14
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "<%= tool_name %>",
3
- "version": "5.11.2",
3
+ "version": "5.12.0",
4
4
  "scripts": {
5
5
  "ng": "ng",
6
6
  "start": "ng serve",
@@ -12,22 +12,22 @@
12
12
  },
13
13
  "private": true,
14
14
  "dependencies": {
15
- "@openc3/tool-common": "5.11.2",
16
- "@angular/animations": "^16.2.4",
17
- "@angular/cdk": "^16.2.3",
18
- "@angular/common": "^16.2.4",
19
- "@angular/compiler": "^16.2.4",
20
- "@angular/core": "^16.2.4",
21
- "@angular/forms": "^16.2.4",
22
- "@angular/material": "16.2.3",
23
- "@angular/platform-browser": "^16.2.4",
24
- "@angular/platform-browser-dynamic": "^16.2.4",
25
- "@angular/router": "^16.2.4",
15
+ "@openc3/tool-common": "5.12.0",
16
+ "@angular/animations": "^16.2.12",
17
+ "@angular/cdk": "^16.2.11",
18
+ "@angular/common": "^16.2.12",
19
+ "@angular/compiler": "^16.2.12",
20
+ "@angular/core": "^16.2.12",
21
+ "@angular/forms": "^16.2.12",
22
+ "@angular/material": "16.2.11",
23
+ "@angular/platform-browser": "^16.2.12",
24
+ "@angular/platform-browser-dynamic": "^16.2.12",
25
+ "@angular/router": "^16.2.12",
26
26
  "rxjs": "~7.8.0",
27
27
  "single-spa": ">=5.9.5",
28
- "single-spa-angular": "^8.1.0",
28
+ "single-spa-angular": "^9.0.1",
29
29
  "tslib": "^2.6.2",
30
- "zone.js": "~0.13.3"
30
+ "zone.js": "~0.14.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@angular-builders/custom-webpack": "16.0.1",