Skip to content

Commit

Permalink
Add Edit menu option and log line delay changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Sep 14, 2024
1 parent 57235b3 commit 88ce536
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,27 @@ export default {
this.editor.execCommand('replace')
},
},
{
label: 'Set Line Delay',
icon: 'mdi-invoice-text-clock',
disabled: this.scriptId,
command: () => {
this.$dialog.open({
title: 'Info',
text:
'You can set the line delay in seconds using the api method set_line_delay().<br/><br/>' +
'The default line delay is 0.1 seconds between lines. ' +
'Adding set_line_delay(0) to the top of your script will execute the script at maximum speed. ' +
'However, this can make it difficult to see and pause the script. ' +
'Executing set_line_delay(1) will cause a 1 second delay between lines.',
okText: 'OK',
okClass: 'primary',
validateText: null,
cancelText: null,
html: true,
})
},
},
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ export default {
(this.valueId.includes('PACKET_TIMEFORMATTED') ||
this.valueId.includes('RECEIVED_TIMEFORMATTED'))
) {
// Our dates have / rather than - which results in an invalid date on old browsers
// when they call new Date(value)
value = value.replaceAll('/', '-')
return this.formatUtcToLocal(new Date(value), this.timeZone)
}
// Convert json raw strings into the raw bytes
Expand Down
2 changes: 2 additions & 0 deletions openc3-cosmos-script-runner-api/app/models/running_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def self.line_delay
end

def self.line_delay=(value)
@@instance.scriptrunner_puts("set_line_delay(#{value})")
@@line_delay = value
end

Expand Down Expand Up @@ -1107,6 +1108,7 @@ def run_text(text,
unless close_on_complete
output = "Starting script: #{File.basename(@filename)}"
output += " in DISCONNECT mode" if $disconnect
output += "\nget_line_delay() #=> #{@@line_delay}"
scriptrunner_puts(output)
end
handle_output_io()
Expand Down

0 comments on commit 88ce536

Please sign in to comment.