Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 3bf4b42c03
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (64 sloc) 2.664 kB
<h1>Tasks</h1>
<h3>Queue task</h3>
<%= form_tag(tasks_path, :class => "form-horizontal") do %>
<div class="control-group">
<%= label_tag(:worker_name, nil, :class => 'control-label') %>
<%= text_field_tag(:worker_name, "HelloWorker", :class => 'controls') %>
</div>
<div class="control-group">
<%= label_tag(:task_params, nil, :class => 'control-label') %>
<%= text_field_tag(:task_params, '{"text":"sample"}', :class => 'controls') %>
</div>
<div class="control-group">
<%= label_tag(:delay, nil, :class => 'control-label') %>
<%= select_tag :delay, options_for_select([5, 10, 15], 1), :class => 'controls' %>
</div>
<div class="control-group">
<%= label_tag(:task_timeout, nil, :class => 'control-label') %>
<%= select_tag :task_timeout, options_for_select([5, 10, 15], 1), :class => 'controls' %>
</div>
<div class="control-group">
<%= label_tag(:queue_the_task, nil, :class => 'control-label') %>
<%= submit_tag("Queue", :class => 'controls btn btn-primary') %>
</div>
<% end %>
<h3>List of tasks:</h3>
<% if !@tasks.empty? %>
<table id="task_list_table" class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th>Code Name</th>
<th>Created at</th>
<th>Status</th>
<th>Duration</th>
<th>Log</th>
<th>Actions</th>
</tr>
</thead>
<% @tasks.each do |t| %>
<tr data-task-id='<%= t.id %>' data-status="<%= t.status %>">
<td><%= t.code_name %></td>
<td><span class="created_at"><%= t.created_at %></span></td>
<td><span class="status"><%= t.status %></span></td>
<td><span class="duration"><%= t.duration %></span></td>
<td>
<div class="spinner" style="display:<%= (t.status=='runnint'||t.status=='queued') ? "block" : "none" %>;">
<%= image_tag 'ajax-loader.gif', class: 'task-spinner' %>
</div>
<div class="results_link" style="display:<%= (t.status=='complete'||t.status=='error'||t.status=='timeout') ? "block" : "none" %>;">
<%= link_to "Log", log_task_path(t.id) %>
</div>
</td>
<td>
<%= button_to "Retry", retry_task_task_path(t.id) %>
<%= button_to "Cancel", cancel_task_path(t.id) %>
<%= button_to "Cancel all", cancel_all_task_path(t.code_id) %>
</td>
</tr>
<% end %>
</table>
<% else %>
<h5>There are now any tasks, feel free to queue new one</h5>
<% end %>
<p>
<%= link_to "Back", root_path %>
Jump to Line
Something went wrong with that request. Please try again.