cosmos 5.0.2.pre.beta2 → 5.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/cosmos +1 -1
- data/data/config/microservice.yaml +47 -35
- data/data/config/plugins.yaml +3 -150
- data/data/config/target.yaml +70 -0
- data/data/config/tool.yaml +37 -31
- data/lib/cosmos/api/api.rb +1 -25
- data/lib/cosmos/api/cmd_api.rb +17 -6
- data/lib/cosmos/api/config_api.rb +10 -4
- data/lib/cosmos/api/limits_api.rb +1 -1
- data/lib/cosmos/api/settings_api.rb +19 -7
- data/lib/cosmos/api/target_api.rb +2 -2
- data/lib/cosmos/api/tlm_api.rb +69 -41
- data/lib/cosmos/config/config_parser.rb +19 -22
- data/lib/cosmos/config/meta_config_parser.rb +1 -1
- data/lib/cosmos/conversions/generic_conversion.rb +2 -2
- data/lib/cosmos/conversions/polynomial_conversion.rb +5 -8
- data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +26 -9
- data/lib/cosmos/io/json_drb.rb +5 -1
- data/lib/cosmos/logs/log_writer.rb +2 -2
- data/lib/cosmos/microservices/cleanup_microservice.rb +28 -29
- data/lib/cosmos/microservices/decom_microservice.rb +1 -1
- data/lib/cosmos/microservices/interface_microservice.rb +0 -1
- data/lib/cosmos/microservices/microservice.rb +3 -3
- data/lib/cosmos/microservices/reducer_microservice.rb +12 -10
- data/lib/cosmos/models/cvt_model.rb +6 -6
- data/lib/cosmos/models/gem_model.rb +3 -3
- data/lib/cosmos/models/info_model.rb +1 -1
- data/lib/cosmos/models/interface_status_model.rb +1 -1
- data/lib/cosmos/models/metadata_model.rb +42 -216
- data/lib/cosmos/models/metric_model.rb +2 -2
- data/lib/cosmos/models/microservice_model.rb +1 -1
- data/lib/cosmos/models/microservice_status_model.rb +1 -1
- data/lib/cosmos/models/model.rb +16 -16
- data/lib/cosmos/models/note_model.rb +124 -0
- data/lib/cosmos/models/ping_model.rb +2 -1
- data/lib/cosmos/models/plugin_model.rb +1 -1
- data/lib/cosmos/models/process_status_model.rb +1 -1
- data/lib/cosmos/models/scope_model.rb +9 -26
- data/lib/cosmos/models/settings_model.rb +55 -0
- data/lib/cosmos/models/sorted_model.rb +165 -0
- data/lib/cosmos/models/target_model.rb +120 -13
- data/lib/cosmos/models/tool_config_model.rb +38 -0
- data/lib/cosmos/models/tool_model.rb +1 -1
- data/lib/cosmos/models/widget_model.rb +1 -1
- data/lib/cosmos/operators/microservice_operator.rb +2 -1
- data/lib/cosmos/packets/packet.rb +23 -0
- data/lib/cosmos/packets/packet_config.rb +2 -2
- data/lib/cosmos/packets/packet_item.rb +57 -0
- data/lib/cosmos/packets/packet_item_limits.rb +14 -2
- data/lib/cosmos/packets/parsers/packet_item_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/packet_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/xtce_parser.rb +1 -1
- data/lib/cosmos/packets/structure_item.rb +10 -1
- data/lib/cosmos/script/api_shared.rb +30 -25
- data/lib/cosmos/script/calendar.rb +26 -15
- data/lib/cosmos/script/commands.rb +5 -7
- data/lib/cosmos/script/script.rb +19 -39
- data/lib/cosmos/script/storage.rb +92 -105
- data/lib/cosmos/system/system.rb +2 -1
- data/lib/cosmos/tools/table_manager/table_item.rb +1 -1
- data/lib/cosmos/top_level.rb +5 -1
- data/lib/cosmos/topics/autonomic_topic.rb +2 -2
- data/lib/cosmos/topics/calendar_topic.rb +1 -1
- data/lib/cosmos/topics/command_decom_topic.rb +35 -1
- data/lib/cosmos/topics/command_topic.rb +6 -4
- data/lib/cosmos/topics/interface_topic.rb +8 -8
- data/lib/cosmos/topics/limits_event_topic.rb +5 -3
- data/lib/cosmos/topics/notifications_topic.rb +1 -1
- data/lib/cosmos/topics/router_topic.rb +9 -9
- data/lib/cosmos/topics/telemetry_decom_topic.rb +5 -1
- data/lib/cosmos/topics/telemetry_topic.rb +1 -1
- data/lib/cosmos/topics/timeline_topic.rb +1 -1
- data/lib/cosmos/topics/topic.rb +23 -8
- data/lib/cosmos/utilities/logger.rb +4 -3
- data/lib/cosmos/utilities/metric.rb +32 -26
- data/lib/cosmos/utilities/s3.rb +61 -0
- data/lib/cosmos/utilities/s3_file_cache.rb +12 -6
- data/lib/cosmos/utilities/store.rb +1 -0
- data/lib/cosmos/utilities/store_autoload.rb +25 -134
- data/lib/cosmos/version.rb +6 -5
- data/templates/plugin-template/plugin.gemspec +0 -2
- metadata +9 -6
- data/lib/cosmos/models/narrative_model.rb +0 -280
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a561fd5492c1b282759d45170da4e687b4e53eea086804bde1c549a75a8bdd5
|
4
|
+
data.tar.gz: c88407b16125e7ef2fb9764dd14338f6508e2fbde1567ff3b7d23b24f1b7dd2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f80a81b27f8c00611a730ef329b4c4afc01e572419ee03d1c7621295e2670a1e829d41511ee4a82af5874d43d32f7b51280281c26310ee8f1e79e767e987c542
|
7
|
+
data.tar.gz: 14f36f225ac641ca74dac4eca580ffad8e6ffea7d69bed1c685d387db0ff6d3977c6ad8b148b8a8117914bd7752914423d2691aa899b0ec902fde5c25f4e931a
|
data/bin/cosmos
CHANGED
@@ -99,7 +99,7 @@ def generate(args)
|
|
99
99
|
end
|
100
100
|
base_name.sub!("target.rb", target_lib_filename)
|
101
101
|
base_name.sub!("plugin.gemspec", "#{plugin_name}.gemspec")
|
102
|
-
output = ERB.new(File.read(file)).result(b)
|
102
|
+
output = ERB.new(File.read(file), trim_mode: "-").result(b)
|
103
103
|
File.open(base_name, 'w') do |file|
|
104
104
|
file.write output
|
105
105
|
end
|
@@ -2,65 +2,77 @@
|
|
2
2
|
MICROSERVICE:
|
3
3
|
summary: Defines a new microservice
|
4
4
|
example: MICROSERVICE EXAMPLE example-microservice
|
5
|
+
description: Defines a microservice that the plugin adds to the COSMOS system. Microservices are background software processes that perform persistent processing.
|
5
6
|
parameters:
|
6
|
-
- name: Folder Name
|
7
|
+
- name: Microservice Folder Name
|
8
|
+
description: The exact name of the microservice folder in the plugin. ie. microservices/<Microservice Folder Name>
|
7
9
|
required: true
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
values: .+
|
11
|
+
- name: Microservice Name
|
12
|
+
description: The specific name of this instance of the microservice in the COSMOS system
|
11
13
|
required: true
|
12
|
-
|
13
|
-
values: .*
|
14
|
+
values: .+
|
14
15
|
modifiers:
|
15
16
|
ENV:
|
16
|
-
summary:
|
17
|
+
summary: Sets an environment variable in the microservice.
|
17
18
|
parameters:
|
18
|
-
- name:
|
19
|
+
- name: Key
|
19
20
|
required: true
|
20
21
|
description: Environment variable name
|
21
|
-
values:
|
22
|
+
values: .+
|
22
23
|
- name: Value
|
23
24
|
required: true
|
24
25
|
description: Environment variable value
|
25
|
-
values:
|
26
|
+
values: .+
|
26
27
|
WORK_DIR:
|
27
|
-
summary:
|
28
|
+
summary: Set the working directory
|
29
|
+
description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
|
28
30
|
parameters:
|
29
|
-
- name:
|
31
|
+
- name: Directory
|
30
32
|
required: true
|
31
|
-
description:
|
32
|
-
values:
|
33
|
+
description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
|
34
|
+
values: .+
|
33
35
|
TOPIC:
|
34
|
-
summary:
|
36
|
+
summary: Associate a Redis topic
|
37
|
+
description: Redis topic to associate with this microservice. Standard COSMOS microservices such as decom_microservice use this information to know what packet streams to subscribe to. The TOPIC keyword can be used as many times as necessary to associate all needed topics.
|
35
38
|
parameters:
|
36
|
-
- name: Name
|
39
|
+
- name: Topic Name
|
37
40
|
required: true
|
38
|
-
description: Topic
|
39
|
-
values:
|
41
|
+
description: Redis Topic to associate with the microservice
|
42
|
+
values: .+
|
40
43
|
TARGET_NAME:
|
41
|
-
summary:
|
44
|
+
summary: Associate a COSMOS target
|
45
|
+
description: COSMOS target to associate with the microservice. For standard COSMOS microservices such as decom_microservice this causes the target configuration to get loaded into the container for the microservice.
|
42
46
|
parameters:
|
43
|
-
- name: Name
|
47
|
+
- name: Target Name
|
44
48
|
required: true
|
45
|
-
description:
|
46
|
-
values:
|
49
|
+
description: COSMOS target to associate with the microservice
|
50
|
+
values: .+
|
47
51
|
CMD:
|
48
|
-
summary: Command to
|
52
|
+
summary: Command line to execute to run the microservice.
|
53
|
+
description: Command line to execute to run the microservice.
|
49
54
|
parameters:
|
50
|
-
- name:
|
55
|
+
- name: Args
|
51
56
|
required: true
|
52
|
-
description:
|
53
|
-
values:
|
54
|
-
- name: Command parameters
|
55
|
-
required: false
|
56
|
-
description: Additional parameters used by the command
|
57
|
+
description: One or more arguments to exec to run the microservice.
|
58
|
+
values: .+
|
57
59
|
OPTION:
|
58
|
-
summary:
|
60
|
+
summary: Pass an option to the microservice
|
61
|
+
description: Generic key/value(s) options to pass to the microservice. These take the form of KEYWORD/PARAMS like a line in a COSMOS configuration file. Multiple OPTION keywords can be used to pass multiple options to the microservice.
|
59
62
|
parameters:
|
60
|
-
- name: Name
|
63
|
+
- name: Option Name
|
64
|
+
required: true
|
65
|
+
description: Name of the option
|
66
|
+
values: .+
|
67
|
+
- name: Option Value(s)
|
61
68
|
required: true
|
62
|
-
description:
|
63
|
-
values:
|
64
|
-
|
69
|
+
description: One or more values to associate with the option
|
70
|
+
values: .+
|
71
|
+
CONTAINER:
|
72
|
+
summary: Docker Container.
|
73
|
+
description: Container to execute and run the microservice in.
|
74
|
+
parameters:
|
75
|
+
- name: Args
|
65
76
|
required: false
|
66
|
-
description:
|
77
|
+
description: Name of the container
|
78
|
+
values: .+
|
data/data/config/plugins.yaml
CHANGED
@@ -65,153 +65,6 @@ ROUTER:
|
|
65
65
|
<%= MetaConfigParser.load('_interfaces.yaml').to_meta_config_yaml(8) %>
|
66
66
|
documentation: Additional parameters are required. Please see the [Interfaces](/docs/v5/interfaces)
|
67
67
|
documentation for more details.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
parameters:
|
72
|
-
- name: Target Folder Name
|
73
|
-
description: The exact name of the target folder in the plugin. ie. targets/<Target Folder Name>
|
74
|
-
required: true
|
75
|
-
values: .+
|
76
|
-
- name: Target Name
|
77
|
-
description: The specific name of this instance of the target in the COSMOS system
|
78
|
-
required: true
|
79
|
-
values: .+
|
80
|
-
MICROSERVICE:
|
81
|
-
summary: Define a microservice
|
82
|
-
description: Defines a microservice that the plugin adds to the COSMOS system. Microservices are background software processes that perform persistent processing.
|
83
|
-
parameters:
|
84
|
-
- name: Microservice Folder Name
|
85
|
-
description: The exact name of the microservice folder in the plugin. ie. microservices/<Microservice Folder Name>
|
86
|
-
required: true
|
87
|
-
values: .+
|
88
|
-
- name: Microservice Name
|
89
|
-
description: The specific name of this instance of the microservice in the COSMOS system
|
90
|
-
required: true
|
91
|
-
values: .+
|
92
|
-
modifiers:
|
93
|
-
ENV:
|
94
|
-
summary: Sets an environment variable in the microservice.
|
95
|
-
description: Sets an environment variable in the microservice.
|
96
|
-
parameters:
|
97
|
-
- name: Key
|
98
|
-
required: true
|
99
|
-
description: Name of the environment variable
|
100
|
-
values: .+
|
101
|
-
- name: Value
|
102
|
-
required: true
|
103
|
-
description: Value of the environment variable
|
104
|
-
values: .+
|
105
|
-
WORK_DIR:
|
106
|
-
summary: Set the working directory
|
107
|
-
description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
|
108
|
-
parameters:
|
109
|
-
- name: Directory
|
110
|
-
required: true
|
111
|
-
description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
|
112
|
-
values: .+
|
113
|
-
TOPIC:
|
114
|
-
summary: Associate a Redis topic
|
115
|
-
description: Redis topic to associate with this microservice. Standard COSMOS microservices such as decom_microservice use this information to know what packet streams to subscribe to. The TOPIC keyword can be used as many times as necessary to associate all needed topics.
|
116
|
-
parameters:
|
117
|
-
- name: Topic Name
|
118
|
-
required: true
|
119
|
-
description: Redis Topic to associate with the microservice
|
120
|
-
values: .+
|
121
|
-
TARGET_NAME:
|
122
|
-
summary: Associate a COSMOS target
|
123
|
-
description: COSMOS target to associate with the microservice. For standard COSMOS microservices such as decom_microservice this causes the target configuration to get loaded into the container for the microservice.
|
124
|
-
parameters:
|
125
|
-
- name: Target Name
|
126
|
-
required: true
|
127
|
-
description: COSMOS target to associate with the microservice
|
128
|
-
values: .+
|
129
|
-
CMD:
|
130
|
-
summary: Command line to execute to run the microservice.
|
131
|
-
description: Command line to execute to run the microservice.
|
132
|
-
parameters:
|
133
|
-
- name: Args
|
134
|
-
required: true
|
135
|
-
description: One or more arguments to exec to run the microservice.
|
136
|
-
values: .+
|
137
|
-
CONTAINER:
|
138
|
-
summary: Docker Container.
|
139
|
-
description: Container to execute and run the microservice in.
|
140
|
-
parameters:
|
141
|
-
- name: Args
|
142
|
-
required: false
|
143
|
-
description: Name of the container
|
144
|
-
values: .+
|
145
|
-
OPTION:
|
146
|
-
summary: Pass an option to the microservice
|
147
|
-
description: Generic key/value(s) options to pass to the microservice. These take the form of KEYWORD/PARAMS like a line in a COSMOS configuration file. Multiple OPTION keywords can be used to pass multiple options to the microservice.
|
148
|
-
parameters:
|
149
|
-
- name: Option Name
|
150
|
-
required: true
|
151
|
-
description: Name of the option
|
152
|
-
values: .+
|
153
|
-
- name: Option Value(s)
|
154
|
-
required: true
|
155
|
-
description: One or more values to associate with the option
|
156
|
-
values: .+
|
157
|
-
TOOL:
|
158
|
-
summary: Define a tool
|
159
|
-
description: Defines a tool that the plugin adds to the COSMOS system. Tools are web based applications that make use of the Single-SPA javascript library that allows them to by dynamically added to the running system as independent frontend microservices.
|
160
|
-
parameters:
|
161
|
-
- name: Tool Folder Name
|
162
|
-
description: The exact name of the tool folder in the plugin. ie. tools/<Tool Folder Name>
|
163
|
-
required: true
|
164
|
-
values: .+
|
165
|
-
- name: Tool Name
|
166
|
-
description: Name of the tool that is displayed in the COSMOS Navigation menu
|
167
|
-
required: true
|
168
|
-
values: .+
|
169
|
-
modifiers:
|
170
|
-
URL:
|
171
|
-
summary: Url used to access the tool
|
172
|
-
description: The relative url used to access the tool. Defaults to "/tools/<Tool Folder Name>".
|
173
|
-
parameters:
|
174
|
-
- name: Url
|
175
|
-
required: true
|
176
|
-
description: The url. If not given defaults to tools/<Tool Folder Name>. Generally should not be given unless linking to external tools.
|
177
|
-
values: .+
|
178
|
-
INLINE_URL:
|
179
|
-
summary: Internal url to load a tool
|
180
|
-
description: The url of the javascript file used to load the tool into single-SPA. Defaults to "js/app.js".
|
181
|
-
parameters:
|
182
|
-
- name: Url
|
183
|
-
required: true
|
184
|
-
description: The inline url. If not given defaults to js/app.js. Generally should not be given unless using a non-standard filename.
|
185
|
-
values: .+
|
186
|
-
WINDOW:
|
187
|
-
summary: How to display the tool when navigated to
|
188
|
-
description: The window mode used to display the tool. Currently supported modes are INLINE which opens the tool internally without refreshing the page using the Single-SPA framework, and NEW which opens the tool in a new TAB. A future release will support IFRAME to open external tools in an Iframe within COSMOS.
|
189
|
-
parameters:
|
190
|
-
- name: Window Mode
|
191
|
-
required: true
|
192
|
-
description: INLINE, NEW, or IFRAME
|
193
|
-
values: .+
|
194
|
-
ICON:
|
195
|
-
summary: Set tool icon
|
196
|
-
description: Icon shown next to the tool name in the COSMOS navigation menu.
|
197
|
-
parameters:
|
198
|
-
- name: Icon Name
|
199
|
-
required: true
|
200
|
-
description: Icon to display next to the tool name. Icons come from Font Awesome, Material Design, and Astro. See https://vuetifyjs.com/en/components/icons/
|
201
|
-
values: .+
|
202
|
-
CATEGORY:
|
203
|
-
summary: Category for the tool
|
204
|
-
description: Associates the tool with a category. In a future release this will be able to organize tools into submenus in the Navigation menu.
|
205
|
-
parameters:
|
206
|
-
- name: Category Name
|
207
|
-
required: true
|
208
|
-
description: Category to associate the tool with
|
209
|
-
values: .+
|
210
|
-
SHOWN:
|
211
|
-
summary: Show the tool or not
|
212
|
-
description: Whether or not the tool is shown in the Navigation menu. Should generally be true, except for the cosmos base tool.
|
213
|
-
parameters:
|
214
|
-
- name: Shown
|
215
|
-
required: true
|
216
|
-
description: Whether or not the tool is shown. TRUE or FALSE
|
217
|
-
values: .+
|
68
|
+
<%= MetaConfigParser.load('target.yaml').to_meta_config_yaml() %>
|
69
|
+
<%= MetaConfigParser.load('microservice.yaml').to_meta_config_yaml() %>
|
70
|
+
<%= MetaConfigParser.load('tool.yaml').to_meta_config_yaml() %>
|
data/data/config/target.yaml
CHANGED
@@ -28,6 +28,13 @@ TARGET:
|
|
28
28
|
required: true
|
29
29
|
description: Maximum file size in bytes (default = 50_000_000)
|
30
30
|
values: \d+
|
31
|
+
CMD_LOG_RETAIN_TIME:
|
32
|
+
summary: How long to keep raw command logs in seconds.
|
33
|
+
parameters:
|
34
|
+
- name: Time
|
35
|
+
required: true
|
36
|
+
description: Number of seconds to keep raw command logs (default = nil = Forever)
|
37
|
+
values: \d+
|
31
38
|
CMD_DECOM_LOG_CYCLE_TIME:
|
32
39
|
summary: Command decommutation logs can be cycled on a time interval.
|
33
40
|
parameters:
|
@@ -42,6 +49,13 @@ TARGET:
|
|
42
49
|
required: true
|
43
50
|
description: Maximum file size in bytes (default = 50_000_000)
|
44
51
|
values: \d+
|
52
|
+
CMD_DECOM_LOG_RETAIN_TIME:
|
53
|
+
summary: How long to keep decom command logs in seconds.
|
54
|
+
parameters:
|
55
|
+
- name: Time
|
56
|
+
required: true
|
57
|
+
description: Number of seconds to keep decom command logs (default = nil = Forever)
|
58
|
+
values: \d+
|
45
59
|
TLM_LOG_CYCLE_TIME:
|
46
60
|
summary: Telemetry binary logs can be cycled on a time interval.
|
47
61
|
parameters:
|
@@ -56,6 +70,13 @@ TARGET:
|
|
56
70
|
required: true
|
57
71
|
description: Maximum file size in bytes (default = 50_000_000)
|
58
72
|
values: \d+
|
73
|
+
TLM_LOG_RETAIN_TIME:
|
74
|
+
summary: How long to keep raw telemetry logs in seconds.
|
75
|
+
parameters:
|
76
|
+
- name: Time
|
77
|
+
required: true
|
78
|
+
description: Number of seconds to keep raw telemetry logs (default = nil = Forever)
|
79
|
+
values: \d+
|
59
80
|
TLM_DECOM_LOG_CYCLE_TIME:
|
60
81
|
summary: Telemetry decommutation logs can be cycled on a time interval.
|
61
82
|
parameters:
|
@@ -70,3 +91,52 @@ TARGET:
|
|
70
91
|
required: true
|
71
92
|
description: Maximum file size in bytes (default = 50_000_000)
|
72
93
|
values: \d+
|
94
|
+
TLM_DECOM_LOG_RETAIN_TIME:
|
95
|
+
summary: How long to keep decom telemetry logs in seconds.
|
96
|
+
parameters:
|
97
|
+
- name: Time
|
98
|
+
required: true
|
99
|
+
description: Number of seconds to keep decom telemetry logs (default = nil = Forever)
|
100
|
+
values: \d+
|
101
|
+
REDUCED_MINUTE_LOG_RETAIN_TIME:
|
102
|
+
summary: How long to keep reduced minute telemetry logs in seconds.
|
103
|
+
parameters:
|
104
|
+
- name: Time
|
105
|
+
required: true
|
106
|
+
description: Number of seconds to keep reduced minute telemetry logs (default = nil = Forever)
|
107
|
+
values: \d+
|
108
|
+
REDUCED_HOUR_LOG_RETAIN_TIME:
|
109
|
+
summary: How long to keep reduced hour telemetry logs in seconds.
|
110
|
+
parameters:
|
111
|
+
- name: Time
|
112
|
+
required: true
|
113
|
+
description: Number of seconds to keep reduced hour telemetry logs (default = nil = Forever)
|
114
|
+
values: \d+
|
115
|
+
REDUCED_DAY_LOG_RETAIN_TIME:
|
116
|
+
summary: How long to keep reduced day telemetry logs in seconds.
|
117
|
+
parameters:
|
118
|
+
- name: Time
|
119
|
+
required: true
|
120
|
+
description: Number of seconds to keep reduced day telemetry logs (default = nil = Forever)
|
121
|
+
values: \d+
|
122
|
+
LOG_RETAIN_TIME:
|
123
|
+
summary: How long to keep all regular telemetry logs in seconds.
|
124
|
+
parameters:
|
125
|
+
- name: Time
|
126
|
+
required: true
|
127
|
+
description: Number of seconds to keep all regular telemetry logs (default = nil = Forever)
|
128
|
+
values: \d+
|
129
|
+
REDUCED_LOG_RETAIN_TIME:
|
130
|
+
summary: How long to keep all reduced telemetry logs in seconds.
|
131
|
+
parameters:
|
132
|
+
- name: Time
|
133
|
+
required: true
|
134
|
+
description: Number of seconds to keep all reduced telemetry logs (default = nil = Forever)
|
135
|
+
values: \d+
|
136
|
+
CLEANUP_POLL_TIME:
|
137
|
+
summary: Period at which to run the cleanup process.
|
138
|
+
parameters:
|
139
|
+
- name: Time
|
140
|
+
required: true
|
141
|
+
description: Number of seconds between runs of the cleanup process (default = 900 = 15 minutes)
|
142
|
+
values: \d+
|
data/data/config/tool.yaml
CHANGED
@@ -1,57 +1,63 @@
|
|
1
1
|
---
|
2
2
|
TOOL:
|
3
|
-
summary:
|
3
|
+
summary: Define a tool
|
4
4
|
example: TOOL DEMO Demo
|
5
|
+
description: Defines a tool that the plugin adds to the COSMOS system. Tools are web based applications that make use of the Single-SPA javascript library that allows them to by dynamically added to the running system as independent frontend microservices.
|
5
6
|
parameters:
|
6
|
-
- name: Folder Name
|
7
|
+
- name: Tool Folder Name
|
8
|
+
description: The exact name of the tool folder in the plugin. ie. tools/<Tool Folder Name>
|
7
9
|
required: true
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
values: .+
|
11
|
+
- name: Tool Name
|
12
|
+
description: Name of the tool that is displayed in the COSMOS Navigation menu
|
11
13
|
required: true
|
12
|
-
|
13
|
-
values: .*
|
14
|
+
values: .+
|
14
15
|
modifiers:
|
15
16
|
URL:
|
16
|
-
summary: Url to
|
17
|
+
summary: Url used to access the tool
|
18
|
+
description: The relative url used to access the tool. Defaults to "/tools/<Tool Folder Name>".
|
17
19
|
parameters:
|
18
|
-
- name:
|
20
|
+
- name: Url
|
19
21
|
required: true
|
20
|
-
description:
|
21
|
-
values:
|
22
|
+
description: The url. If not given defaults to tools/<Tool Folder Name>. Generally should not be given unless linking to external tools.
|
23
|
+
values: .+
|
22
24
|
INLINE_URL:
|
23
|
-
summary:
|
24
|
-
|
25
|
+
summary: Internal url to load a tool
|
26
|
+
description: The url of the javascript file used to load the tool into single-SPA. Defaults to "js/app.js".
|
25
27
|
parameters:
|
26
|
-
- name:
|
28
|
+
- name: Url
|
27
29
|
required: true
|
28
|
-
description:
|
29
|
-
values:
|
30
|
-
ICON:
|
31
|
-
summary: Icon used to display the tool link
|
32
|
-
parameters:
|
33
|
-
- name: Name
|
34
|
-
required: true
|
35
|
-
description: Material design icon name (https://materialdesignicons.com/)
|
36
|
-
values: .*
|
30
|
+
description: The inline url. If not given defaults to js/app.js. Generally should not be given unless using a non-standard filename.
|
31
|
+
values: .+
|
37
32
|
WINDOW:
|
38
|
-
summary: How the tool
|
33
|
+
summary: How to display the tool when navigated to
|
34
|
+
description: The window mode used to display the tool. INLINE opens the tool internally without refreshing the page using the Single-SPA framework. IFRAME opens external tools in an Iframe within COSMOS. NEW opens the tool in a new TAB.
|
39
35
|
parameters:
|
40
|
-
- name: Mode
|
36
|
+
- name: Window Mode
|
41
37
|
required: true
|
42
38
|
description: Tool display mode
|
43
39
|
values: ["INLINE", "IFRAME", "NEW"]
|
40
|
+
ICON:
|
41
|
+
summary: Set tool icon
|
42
|
+
description: Icon shown next to the tool name in the COSMOS navigation menu.
|
43
|
+
parameters:
|
44
|
+
- name: Icon Name
|
45
|
+
required: true
|
46
|
+
description: Icon to display next to the tool name. Icons come from Font Awesome, Material Design (https://materialdesignicons.com/), and Astro.
|
47
|
+
values: .+
|
44
48
|
CATEGORY:
|
45
|
-
summary: Category
|
49
|
+
summary: Category for the tool
|
50
|
+
description: Associates the tool with a category. In a future release this will be able to organize tools into submenus in the Navigation menu.
|
46
51
|
parameters:
|
47
|
-
- name: Category
|
52
|
+
- name: Category Name
|
48
53
|
required: true
|
49
|
-
description:
|
50
|
-
values:
|
54
|
+
description: Category to associate the tool with
|
55
|
+
values: .+
|
51
56
|
SHOWN:
|
52
|
-
summary:
|
57
|
+
summary: Show the tool or not
|
58
|
+
description: Whether or not the tool is shown in the Navigation menu. Should generally be true, except for the cosmos base tool.
|
53
59
|
parameters:
|
54
60
|
- name: Shown
|
55
61
|
required: true
|
56
|
-
description:
|
62
|
+
description: Whether or not the tool is shown. TRUE or FALSE
|
57
63
|
values: ["true", "false"]
|
data/lib/cosmos/api/api.rb
CHANGED
@@ -28,36 +28,12 @@ require 'cosmos/api/settings_api'
|
|
28
28
|
require 'cosmos/api/target_api'
|
29
29
|
require 'cosmos/api/tlm_api'
|
30
30
|
require 'cosmos/utilities/authorization'
|
31
|
+
require 'cosmos/topics/topic'
|
31
32
|
|
32
33
|
module Cosmos
|
33
34
|
module Api
|
34
35
|
include Extract
|
35
36
|
include Authorization
|
36
37
|
include ApiShared
|
37
|
-
|
38
|
-
# PRIVATE - Shared by cmd_api and tlm_api
|
39
|
-
|
40
|
-
def _get_cnt(topic)
|
41
|
-
_, packet = Store.instance.read_topic_last(topic)
|
42
|
-
packet ? packet["received_count"].to_i : 0
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_all_cmd_tlm_info(type, scope:, token:)
|
46
|
-
authorize(permission: 'system', scope: scope, token: token)
|
47
|
-
result = []
|
48
|
-
keys = []
|
49
|
-
count = 0
|
50
|
-
loop do
|
51
|
-
count, part = Store.scan(0, :match => "#{scope}__#{type}__*", :count => 1000)
|
52
|
-
keys.concat(part)
|
53
|
-
break if count.to_i == 0
|
54
|
-
end
|
55
|
-
keys.each do |key|
|
56
|
-
_, _, target, packet = key.gsub(/{|}/, '').split('__') # split off scope and type
|
57
|
-
result << [target, packet, _get_cnt(key)]
|
58
|
-
end
|
59
|
-
# Return the results sorted by target, packet
|
60
|
-
result.sort_by { |a| [a[0], a[1]] }
|
61
|
-
end
|
62
38
|
end
|
63
39
|
end
|
data/lib/cosmos/api/cmd_api.rb
CHANGED
@@ -35,6 +35,7 @@ module Cosmos
|
|
35
35
|
'cmd_raw_no_checks',
|
36
36
|
'send_raw',
|
37
37
|
'get_all_commands',
|
38
|
+
'get_all_commands_list',
|
38
39
|
'get_command',
|
39
40
|
'get_parameter',
|
40
41
|
'get_cmd_buffer',
|
@@ -194,7 +195,7 @@ module Cosmos
|
|
194
195
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
195
196
|
TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
|
196
197
|
topic = "#{scope}__COMMAND__{#{target_name}}__#{command_name}"
|
197
|
-
msg_id, msg_hash =
|
198
|
+
msg_id, msg_hash = Topic.get_newest_message(topic)
|
198
199
|
if msg_id
|
199
200
|
msg_hash['buffer'] = msg_hash['buffer'].b
|
200
201
|
return msg_hash
|
@@ -212,6 +213,16 @@ module Cosmos
|
|
212
213
|
TargetModel.packets(target_name, type: :CMD, scope: scope)
|
213
214
|
end
|
214
215
|
|
216
|
+
# Returns an array of all the command names and their descriptions
|
217
|
+
#
|
218
|
+
# @since 5.0.3
|
219
|
+
# @param target_name [String] Name of the target
|
220
|
+
# @return [Array<Hash>] Array of all commands as a hash
|
221
|
+
def get_all_commands_list(target_name, scope: $cosmos_scope, token: $cosmos_token)
|
222
|
+
authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token)
|
223
|
+
TargetModel.all_packet_name_descriptions(target_name, type: :CMD, scope: scope)
|
224
|
+
end
|
225
|
+
|
215
226
|
# Returns a hash of the given command
|
216
227
|
#
|
217
228
|
# @since 5.0.0
|
@@ -291,7 +302,7 @@ module Cosmos
|
|
291
302
|
# @return [Varies] value
|
292
303
|
def get_cmd_value(target_name, command_name, parameter_name, value_type = :CONVERTED, scope: $cosmos_scope, token: $cosmos_token)
|
293
304
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
294
|
-
|
305
|
+
CommandDecomTopic.get_cmd_item(target_name, command_name, parameter_name, type: value_type, scope: scope)
|
295
306
|
end
|
296
307
|
|
297
308
|
# Returns the time the most recent command was sent
|
@@ -304,7 +315,7 @@ module Cosmos
|
|
304
315
|
def get_cmd_time(target_name = nil, command_name = nil, scope: $cosmos_scope, token: $cosmos_token)
|
305
316
|
authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
306
317
|
if target_name and command_name
|
307
|
-
time =
|
318
|
+
time = CommandDecomTopic.get_cmd_item(target_name, command_name, 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
|
308
319
|
[target_name, command_name, time.to_i, ((time.to_f - time.to_i) * 1_000_000).to_i]
|
309
320
|
else
|
310
321
|
if target_name.nil?
|
@@ -316,7 +327,7 @@ module Cosmos
|
|
316
327
|
time = 0
|
317
328
|
command_name = nil
|
318
329
|
TargetModel.packets(target_name, type: :CMD, scope: scope).each do |packet|
|
319
|
-
cur_time =
|
330
|
+
cur_time = CommandDecomTopic.get_cmd_item(target_name, packet["packet_name"], 'RECEIVED_TIMESECONDS', type: :CONVERTED, scope: scope)
|
320
331
|
next unless cur_time
|
321
332
|
|
322
333
|
if cur_time > time
|
@@ -338,7 +349,7 @@ module Cosmos
|
|
338
349
|
def get_cmd_cnt(target_name, command_name, scope: $cosmos_scope, token: $cosmos_token)
|
339
350
|
authorize(permission: 'system', target_name: target_name, packet_name: command_name, scope: scope, token: token)
|
340
351
|
TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
|
341
|
-
|
352
|
+
Topic.get_cnt("#{scope}__COMMAND__{#{target_name}}__#{command_name}")
|
342
353
|
end
|
343
354
|
|
344
355
|
# Get information on all command packets
|
@@ -351,7 +362,7 @@ module Cosmos
|
|
351
362
|
TargetModel.packets(target_name, type: :CMD, scope: scope).each do | packet |
|
352
363
|
command_name = packet['packet_name']
|
353
364
|
key = "#{scope}__COMMAND__{#{target_name}}__#{command_name}"
|
354
|
-
result << [target_name, command_name,
|
365
|
+
result << [target_name, command_name, Topic.get_cnt(key)]
|
355
366
|
end
|
356
367
|
end
|
357
368
|
# Return the results sorted by target, packet
|
@@ -17,6 +17,8 @@
|
|
17
17
|
# enterprise edition license of COSMOS if purchased from the
|
18
18
|
# copyright holder
|
19
19
|
|
20
|
+
require 'cosmos/models/tool_config_model'
|
21
|
+
|
20
22
|
module Cosmos
|
21
23
|
module Api
|
22
24
|
WHITELIST ||= []
|
@@ -34,19 +36,23 @@ module Cosmos
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def list_configs(tool, scope: $cosmos_scope, token: $cosmos_token)
|
37
|
-
|
39
|
+
authorize(permission: 'system', scope: scope, token: token)
|
40
|
+
ToolConfigModel.list_configs(tool, scope: scope)
|
38
41
|
end
|
39
42
|
|
40
43
|
def load_config(tool, name, scope: $cosmos_scope, token: $cosmos_token)
|
41
|
-
|
44
|
+
authorize(permission: 'system', scope: scope, token: token)
|
45
|
+
ToolConfigModel.load_config(tool, name, scope: scope)
|
42
46
|
end
|
43
47
|
|
44
48
|
def save_config(tool, name, data, scope: $cosmos_scope, token: $cosmos_token)
|
45
|
-
|
49
|
+
authorize(permission: 'system_set', scope: scope, token: token)
|
50
|
+
ToolConfigModel.save_config(tool, name, data, scope: scope)
|
46
51
|
end
|
47
52
|
|
48
53
|
def delete_config(tool, name, scope: $cosmos_scope, token: $cosmos_token)
|
49
|
-
|
54
|
+
authorize(permission: 'system_set', scope: scope, token: token)
|
55
|
+
ToolConfigModel.delete_config(tool, name, scope: scope)
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
@@ -64,7 +64,7 @@ module Cosmos
|
|
64
64
|
targets.each do |target_name|
|
65
65
|
get_all_telemetry(target_name, scope: scope).each do |packet|
|
66
66
|
topic = "#{scope}__TELEMETRY__{#{target_name}}__#{packet['packet_name']}"
|
67
|
-
_, msg_hash =
|
67
|
+
_, msg_hash = Topic.get_newest_message(topic)
|
68
68
|
unless msg_hash && msg_hash['time'].to_i > stale_time
|
69
69
|
next if with_limits_only && packet['items'].find { |item| item['limits'] }.nil?
|
70
70
|
|