Runs history

This commit is contained in:
Gregory Eremin
2013-06-07 00:04:41 +04:00
parent 441acca610
commit b97f0c1a12
7 changed files with 40 additions and 3 deletions
@@ -0,0 +1,7 @@
module BurdenWeb
class RunsController < ApplicationController
def index
@runs = Burden::Storage.run.where(name: params[:task_id]).order('created_at desc').limit(100)
end
end
end
@@ -16,7 +16,11 @@ module BurdenWeb
def run
Rails.application.load_tasks
Rake::Task[params[:id]].invoke
task = Rake::Task[params[:id]]
task.prerequisite_tasks.each{ |t| t.execute(nil) }
task.execute(nil)
rescue => e # Gotta catch 'em all!
ensure
redirect_to params[:back]
end
@@ -0,0 +1,21 @@
<%= link_to '&larr; Back'.html_safe, tasks_path, class: 'small radius secondary button' %>
<%= link_to 'Run', run_task_path(params[:task_id], back: task_runs_path(params[:task_id])), class: 'small radius button' %>
<br><br>
<table>
<thead>
<tr>
<th>Task</th>
<th>Timestamp</th>
<th>Took</th>
</tr>
</thead>
<tbody>
<% @runs.each do |run| %>
<tr>
<td><span class="<%= task_label(run) %> radius label"><%= run.name %></span></td>
<td><%= l run.created_at, format: :short %> (<%= time_ago_in_words(run.created_at) %> ago)</td>
<td><%= run.execution_time.round(6) %>s</td>
</tr>
<% end %>
</tbody>
</table>