Completely remove old non-structured errors and migrate existing ones.
This commit is contained in:
@ -1,40 +0,0 @@
|
||||
module CodeOcean
|
||||
class ErrorsController < ApplicationController
|
||||
before_action :set_execution_environment
|
||||
|
||||
def authorize!
|
||||
authorize(@error || @errors)
|
||||
end
|
||||
private :authorize!
|
||||
|
||||
def create
|
||||
@error = CodeOcean::Error.new(error_params)
|
||||
authorize!
|
||||
respond_to do |format|
|
||||
format.json do
|
||||
head (@error.save ? :created : :unprocessable_entity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def error_params
|
||||
params[:error].permit(:message, :submission_id).merge(execution_environment_id: @execution_environment.id) if params[:error].present?
|
||||
end
|
||||
private :error_params
|
||||
|
||||
def index
|
||||
@errors = CodeOcean::Error.for_execution_environment(@execution_environment).grouped_by_message.paginate(page: params[:page])
|
||||
authorize!
|
||||
end
|
||||
|
||||
def set_execution_environment
|
||||
@execution_environment = ExecutionEnvironment.find(params[:execution_environment_id])
|
||||
end
|
||||
private :set_execution_environment
|
||||
|
||||
def show
|
||||
@error = CodeOcean::Error.find(params[:id])
|
||||
authorize!
|
||||
end
|
||||
end
|
||||
end
|
@ -126,10 +126,6 @@ class SubmissionsController < ApplicationController
|
||||
|
||||
# server_sent_event.write({stdout: output[:stdout]}, event: 'output') if output[:stdout]
|
||||
# server_sent_event.write({stderr: output[:stderr]}, event: 'output') if output[:stderr]
|
||||
|
||||
# unless output[:stderr].nil?
|
||||
# store_error(output[:stderr])
|
||||
# end
|
||||
# end
|
||||
|
||||
hijack do |tubesock|
|
||||
@ -361,11 +357,6 @@ class SubmissionsController < ApplicationController
|
||||
head :ok
|
||||
end
|
||||
|
||||
def store_error(stderr)
|
||||
CodeOcean::Error.create(submission_id: @submission.id, execution_environment_id: @submission.execution_environment.id, message: stderr)
|
||||
end
|
||||
private :store_error
|
||||
|
||||
def test
|
||||
hijack do |tubesock|
|
||||
Thread.new { EventMachine.run } unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
|
||||
|
@ -1,19 +0,0 @@
|
||||
module CodeOcean
|
||||
class Error < ApplicationRecord
|
||||
belongs_to :execution_environment
|
||||
|
||||
scope :for_execution_environment, ->(execution_environment) { where(execution_environment_id: execution_environment.id) }
|
||||
scope :grouped_by_message, -> { select('MAX(created_at) AS created_at, MAX(id) AS id, message, COUNT(id) AS count').group(:message).order('count DESC') }
|
||||
|
||||
validates :execution_environment_id, presence: true
|
||||
validates :message, presence: true
|
||||
|
||||
def self.nested_resource?
|
||||
true
|
||||
end
|
||||
|
||||
def to_s
|
||||
id.to_s
|
||||
end
|
||||
end
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
module CodeOcean
|
||||
class ErrorPolicy < AdminOrAuthorPolicy
|
||||
def author?
|
||||
@user == @record.execution_environment.author
|
||||
end
|
||||
end
|
||||
end
|
@ -1,19 +0,0 @@
|
||||
h1 = CodeOcean::Error.model_name.human(count: 2)
|
||||
|
||||
.table-responsive
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th = t('errors.index.count')
|
||||
th = t('activerecord.attributes.error.message')
|
||||
th = t('shared.created_at')
|
||||
th = t('shared.actions')
|
||||
tbody
|
||||
- @errors.each do |error|
|
||||
tr
|
||||
td = error.count
|
||||
td = error.message
|
||||
td = l(error.created_at, format: :short)
|
||||
td = link_to(t('shared.show'), execution_environment_error_path(params[:execution_environment_id], error))
|
||||
|
||||
p = render('shared/pagination', collection: @errors)
|
@ -1,4 +0,0 @@
|
||||
h1 = CodeOcean::Error.model_name.human
|
||||
|
||||
= row(label: 'error.message', value: @error.message)
|
||||
= row(label: 'shared.created_at', value: l(@error.created_at, format: :short))
|
@ -11,7 +11,6 @@ h1 = ExecutionEnvironment.model_name.human(count: 2)
|
||||
th = t('activerecord.attributes.execution_environment.network_enabled')
|
||||
th = t('activerecord.attributes.execution_environment.permitted_execution_time')
|
||||
th colspan=5 = t('shared.actions')
|
||||
th colspan=2 = t('shared.resources')
|
||||
tbody
|
||||
- @execution_environments.each do |execution_environment|
|
||||
tr
|
||||
@ -26,7 +25,6 @@ h1 = ExecutionEnvironment.model_name.human(count: 2)
|
||||
td = link_to(t('shared.destroy'), execution_environment, data: {confirm: t('shared.confirm_destroy')}, method: :delete)
|
||||
td = link_to(t('.shell'), shell_execution_environment_path(execution_environment))
|
||||
td = link_to(t('shared.statistics'), statistics_execution_environment_path(execution_environment))
|
||||
td = link_to(t('activerecord.models.error.other'), execution_environment_errors_path(execution_environment.id))
|
||||
|
||||
= render('shared/pagination', collection: @execution_environments)
|
||||
p = render('shared/new_button', model: ExecutionEnvironment)
|
||||
|
@ -4,7 +4,7 @@
|
||||
- show_break_interventions = @show_break_interventions || "false"
|
||||
- show_rfc_interventions = @show_rfc_interventions || "false"
|
||||
- hide_rfc_button = @hide_rfc_button || false
|
||||
#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-errors-url=execution_environment_errors_path(exercise.execution_environment) data-submissions-url=submissions_path data-user-id=@current_user.id data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-course_token=@course_token data-search-save-url=search_exercise_path(@exercise)
|
||||
#editor.row data-exercise-id=@exercise.id data-message-depleted=t('exercises.editor.depleted') data-message-timeout=t('exercises.editor.timeout', permitted_execution_time: @exercise.execution_environment.permitted_execution_time) data-submissions-url=submissions_path data-user-id=@current_user.id data-user-external-id=external_user_external_id data-working-times-url=working_times_exercise_path(@exercise) data-intervention-save-url=intervention_exercise_path(@exercise) data-rfc-interventions=show_rfc_interventions data-break-interventions=show_break_interventions data-course_token=@course_token data-search-save-url=search_exercise_path(@exercise)
|
||||
div id="sidebar" class=(@exercise.hide_file_tree ? 'sidebar-col-collapsed' : 'sidebar-col') = render('editor_file_tree', exercise: @exercise, files: @files)
|
||||
div.editor-col.col.p-0 id='frames'
|
||||
#editor-buttons.btn-group.enforce-bottom-margin
|
||||
|
Reference in New Issue
Block a user