Sha256: 28ad5a3c6e30ed69498e28fc5f16472ab9ded378019cab348dfdfe0066667a67

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

# encoding: utf-8
module Mutx
  module Routes
    module Results
      class Routes < App
        define do

          on get do

            on root do
              results = Mutx::API::Results.show()["results"]
              res.write view('Results', results: results)
            end

            # INVERTIR /log con  /:result_id
            on ":result_id/log" do |result_id|
              result = Mutx::Results::Result.get(result_id)
              res.write view('Result Console', result: result)
            end

            # INVERTIR /log con  /:result_id
            on ":result_id/report" do |result_id|
              result = Mutx::Results::Result.get(result_id)
              res.redirect "/404/There%20is%20no%20result%20for%20id=#{result_id}" if result.nil?
              result.mark_as_saw! if (result.finished? or result.stopped?)
              if result.finished? and !result.stopped? and result.html_report.size > 0
                res.write view('Result Report', result: result)
              #else
              #  res.redirect "results/#{result_id}/log"
              end
            end

            on ':result_id/reset' do |result_id|
              result = Mutx::Results::Result.get result_id
              task = Mutx::Tasks::Task.get_task_with result.task["name"]
              if task.blocked_stop.eql? "on"
                with_authentication do
                  value = Mutx::API::Execution.reset(result_id)
                  flash[:info] = value['message']
                  res.redirect path_for(:results_log, result_id: result_id)
                end
              else
                value = Mutx::API::Execution.reset(result_id)
                flash[:info] = value['message']
                res.redirect path_for(:task_results_index, query_string: { task_name: result.task['name']})
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mutx-0.2.9 lib/mutx/routes/results_routes.rb
mutx-0.2.8 lib/mutx/routes/results_routes.rb
mutx-0.2.7 lib/mutx/routes/results_routes.rb
mutx-0.2.6 lib/mutx/routes/results_routes.rb
mutx-0.2.5 lib/mutx/routes/results_routes.rb
mutx-0.2.4 lib/mutx/routes/results_routes.rb
mutx-0.2.3 lib/mutx/routes/results_routes.rb
mutx-0.2.2 lib/mutx/routes/results_routes.rb
mutx-0.2.1 lib/mutx/routes/results_routes.rb
mutx-0.2.0 lib/mutx/routes/results_routes.rb