Show never runned tasks
This commit is contained in:
parent
1c26921387
commit
971ef5e530
@ -3,3 +3,5 @@
|
||||
*= require rake_control_web/foundation.min
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
a.button { margin: 0; }
|
||||
|
@ -1,7 +1,10 @@
|
||||
module RakeControlWeb
|
||||
class ApplicationController < ActionController::Base
|
||||
def tasks
|
||||
Rake.application.tasks
|
||||
Rails.application.load_tasks
|
||||
Rake.application.tasks.keep_if do |task|
|
||||
task.name =~ /^[a-z0-9_:]+$/
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -2,6 +2,11 @@ module RakeControlWeb
|
||||
class TasksController < ApplicationController
|
||||
def index
|
||||
@tasks = RakeControl::Storage.run.summary
|
||||
(tasks.map(&:name) - @tasks.map(&:name)).each do |nr_task| # Never runned tasks
|
||||
@tasks << RakeControl::Storage.run.new(
|
||||
name: nr_task
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def run
|
||||
|
@ -1,4 +1,14 @@
|
||||
module RakeControlWeb
|
||||
module ApplicationHelper
|
||||
def task_label run
|
||||
case run.success
|
||||
when true
|
||||
'success'
|
||||
when false
|
||||
'alert'
|
||||
else
|
||||
'secondary'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -11,11 +11,18 @@
|
||||
<tbody>
|
||||
<% @tasks.each do |run| %>
|
||||
<tr>
|
||||
<td style="color: <%= run.success ? 'green' : 'red' %>"><%= run.name %></td>
|
||||
<td><span class="<%= task_label(run) %> radius label"><%= run.name %></span></td>
|
||||
<% if run.created_at %>
|
||||
<td><%= time_ago_in_words(run.created_at) %> ago</td>
|
||||
<td><%= run.execution_time.round(6) %>s</td>
|
||||
<td><%= link_to 'Run', run_task_path(run.name, back: tasks_path), class: 'radius button' %></td>
|
||||
<td><%= link_to 'History', task_runs_path(run.name), class: 'secondary radius button' %></td>
|
||||
<td><%= link_to 'Run', run_task_path(run.name, back: tasks_path), class: 'small radius button' %></td>
|
||||
<td><%= link_to 'History', task_runs_path(run.name), class: 'secondary small radius button' %></td>
|
||||
<% else %>
|
||||
<td>never</td>
|
||||
<td>—</td>
|
||||
<td><%= link_to 'Run', run_task_path(run.name, back: tasks_path), class: 'small radius button' %></td>
|
||||
<td><a class="disabled secondary small radius button">History</a></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user