Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Script Runner to render UTF-8 chars #1661

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1029,19 +1029,20 @@ export default {
this.startOrGoButton = GO
this.scriptId = id
this.editor.setReadOnly(true)
this.cable.createSubscription(
'RunningScriptChannel',
localStorage.scope,
{
received: (data) => this.received(data)
},
{
id: this.scriptId,
}
)
.then((subscription) => {
this.subscription = subscription
})
this.cable
.createSubscription(
'RunningScriptChannel',
localStorage.scope,
{
received: (data) => this.received(data),
},
{
id: this.scriptId,
}
)
.then((subscription) => {
this.subscription = subscription
})
},
scriptComplete() {
this.disableSuiteButtons = false
Expand Down
12 changes: 8 additions & 4 deletions cosmos-script-runner-api/app/controllers/scripts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# enterprise edition license of COSMOS if purchased from the
# copyright holder

require 'json'

class ScriptsController < ApplicationController
def index
begin
Expand Down Expand Up @@ -49,17 +51,19 @@ def body
end
breakpoints = Script.get_breakpoints(params[:scope], params[:name])
results = {
"contents" => file,
"breakpoints" => breakpoints,
"locked" => locked
contents: file,
breakpoints: breakpoints,
locked: locked
}
if params[:name].include?('suite')
results_suites, results_error, success = Script.process_suite(params[:name], file, scope: params[:scope])
results['suites'] = results_suites
results['error'] = results_error
results['success'] = success
end
render :json => results
# Using 'render :json => results' results in a raw json string like:
# {"contents":"{\"json_class\":\"String\",\"raw\":[35,226,128...]}","breakpoints":[],"locked":false}
render plain: JSON.generate(results)
else
head :not_found
end
Expand Down
2 changes: 1 addition & 1 deletion cosmos-script-runner-api/config/cable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ production:
url: <%= "redis://#{ENV['COSMOS_REDIS_USERNAME']}:#{ENV['COSMOS_REDIS_PASSWORD']}@#{ENV['COSMOS_REDIS_HOSTNAME']}:#{ENV['COSMOS_REDIS_PORT']}" %>
# The channel_prefix is used in scripts/run_script.rb to subscribe to the channel
# and app/models/running_script.rb to publish to the channel
channel_prefix: script-api
channel_prefix: script-api