@@ -318,3 +318,12 @@ $service-colors: ( |
||
| 318 | 318 |
color: yellow; |
| 319 | 319 |
text-decoration: underline; |
| 320 | 320 |
} |
| 321 |
+ |
|
| 322 |
+.glyphicon-flipped {
|
|
| 323 |
+ -ms-transform: translateZ(0); |
|
| 324 |
+ -webkit-transform: translateZ(0); |
|
| 325 |
+ transform: translateZ(0); |
|
| 326 |
+ -ms-transform: scaleX(-1); |
|
| 327 |
+ -webkit-transform: scaleX(-1); |
|
| 328 |
+ transform: scaleX(-1); |
|
| 329 |
+} |
@@ -6,7 +6,7 @@ class AgentsController < ApplicationController |
||
| 6 | 6 |
def index |
| 7 | 7 |
set_table_sort sorts: %w[name created_at last_check_at last_event_at last_receive_at], default: { created_at: :desc }
|
| 8 | 8 |
|
| 9 |
- @agents = current_user.agents.preload(:scenarios, :controllers).reorder(table_sort).page(params[:page]) |
|
| 9 |
+ @agents = current_user.agents.preload(:scenarios, :controllers, :links_as_receiver, :links_as_source, :control_links_as_controller).reorder(table_sort).page(params[:page]) |
|
| 10 | 10 |
|
| 11 | 11 |
if show_only_enabled_agents? |
| 12 | 12 |
@agents = @agents.where(disabled: false) |
@@ -26,7 +26,7 @@ class ScenariosController < ApplicationController |
||
| 26 | 26 |
@scenario = current_user.scenarios.find(params[:id]) |
| 27 | 27 |
|
| 28 | 28 |
set_table_sort sorts: %w[name last_check_at last_event_at last_receive_at], default: { name: :asc }
|
| 29 |
- @agents = @scenario.agents.preload(:scenarios, :controllers).reorder(table_sort).page(params[:page]) |
|
| 29 |
+ @agents = @scenario.agents.preload(:scenarios, :controllers, :links_as_receiver, :links_as_source, :control_links_as_controller).reorder(table_sort).page(params[:page]) |
|
| 30 | 30 |
|
| 31 | 31 |
respond_to do |format| |
| 32 | 32 |
format.html |
@@ -57,4 +57,28 @@ module AgentHelper |
||
| 57 | 57 |
'maybe'.freeze |
| 58 | 58 |
end |
| 59 | 59 |
end |
| 60 |
+ |
|
| 61 |
+ def agent_type_icon(agent) |
|
| 62 |
+ receiver_count = agent.links_as_receiver.length |
|
| 63 |
+ control_count = agent.control_links_as_controller.length |
|
| 64 |
+ source_count = agent.links_as_source.length |
|
| 65 |
+ |
|
| 66 |
+ if control_count > 0 && receiver_count > 0 |
|
| 67 |
+ content_tag('span') do
|
|
| 68 |
+ concat icon_tag('glyphicon-arrow-right')
|
|
| 69 |
+ concat tag('br')
|
|
| 70 |
+ concat icon_tag('glyphicon-new-window', class: 'glyphicon-flipped')
|
|
| 71 |
+ end |
|
| 72 |
+ elsif control_count > 0 && receiver_count == 0 |
|
| 73 |
+ icon_tag('glyphicon-new-window', class: 'glyphicon-flipped')
|
|
| 74 |
+ elsif receiver_count > 0 && source_count == 0 |
|
| 75 |
+ icon_tag('glyphicon-arrow-right')
|
|
| 76 |
+ elsif receiver_count == 0 && source_count > 0 |
|
| 77 |
+ icon_tag('glyphicon-arrow-left')
|
|
| 78 |
+ elsif receiver_count > 0 && source_count > 0 |
|
| 79 |
+ icon_tag('glyphicon-transfer')
|
|
| 80 |
+ else |
|
| 81 |
+ icon_tag('glyphicon-unchecked')
|
|
| 82 |
+ end |
|
| 83 |
+ end |
|
| 60 | 84 |
end |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 |
<div class='table-responsive'> |
| 2 | 2 |
<table class='table table-striped'> |
| 3 | 3 |
<tr> |
| 4 |
+ <th></th> |
|
| 4 | 5 |
<th><%= sortable_column 'name', 'asc' %></th> |
| 5 | 6 |
<th><%= sortable_column 'created_at', 'desc', name: 'Age' %></th> |
| 6 | 7 |
<th>Schedule</th> |
@@ -15,6 +16,9 @@ |
||
| 15 | 16 |
<% @agents.each do |agent| %> |
| 16 | 17 |
<tr> |
| 17 | 18 |
<td class='<%= "agent-unavailable" if agent.unavailable? %>'> |
| 19 |
+ <%= agent_type_icon(agent) %> |
|
| 20 |
+ </td> |
|
| 21 |
+ <td class='<%= "agent-unavailable" if agent.unavailable? %>'> |
|
| 18 | 22 |
<%= link_to agent.name, agent_path(agent, return: (defined?(return_to) && return_to) || request.path) %> |
| 19 | 23 |
<br/> |
| 20 | 24 |
<span class='text-muted'><%= agent.short_type.titleize %></span> |