Show never runned tasks
This commit is contained in:
parent
1c26921387
commit
971ef5e530
@ -3,3 +3,5 @@
|
|||||||
*= require rake_control_web/foundation.min
|
*= require rake_control_web/foundation.min
|
||||||
*= require_self
|
*= require_self
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
a.button { margin: 0; }
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
module RakeControlWeb
|
module RakeControlWeb
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
def tasks
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,6 +2,11 @@ module RakeControlWeb
|
|||||||
class TasksController < ApplicationController
|
class TasksController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@tasks = RakeControl::Storage.run.summary
|
@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
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
module RakeControlWeb
|
module RakeControlWeb
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
def task_label run
|
||||||
|
case run.success
|
||||||
|
when true
|
||||||
|
'success'
|
||||||
|
when false
|
||||||
|
'alert'
|
||||||
|
else
|
||||||
|
'secondary'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,11 +11,18 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% @tasks.each do |run| %>
|
<% @tasks.each do |run| %>
|
||||||
<tr>
|
<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><%= time_ago_in_words(run.created_at) %> ago</td>
|
||||||
<td><%= run.execution_time.round(6) %>s</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 '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 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>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user