Increasing visible detail of mac log
This commit is contained in:
parent
3a028ca7fc
commit
1d6699ae9f
|
@ -4,6 +4,10 @@ before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@mac_logs = MacLog.desc.limit(1000)
|
@mac_logs = MacLog.desc.limit(1000)
|
||||||
|
@macs = {}
|
||||||
|
@mac_logs.each do |log|
|
||||||
|
@macs.merge!({log.mac => Mac.find_by_mac(log.mac)})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,37 @@
|
||||||
|
<style>
|
||||||
|
td { border-bottom: 1px solid #ccc; }
|
||||||
|
</style>
|
||||||
<table>
|
<table>
|
||||||
<% @mac_logs.each do |mac_log| %>
|
<% @mac_logs.each do |mac_log| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= mac_log.mac %></td>
|
<td>
|
||||||
|
<% if @macs[mac_log.mac].user_id.blank? %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to @macs[mac_log.mac].user.name, @macs[mac_log.mac].user %><br/>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if @macs[mac_log.mac].blank? %>
|
||||||
|
<%= mac_log.mac %>
|
||||||
|
<% else %>
|
||||||
|
<% if @macs[mac_log.mac].note.blank? %>
|
||||||
|
<%= link_to mac_log.mac, @macs[mac_log.mac] %><br/>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to @macs[mac_log.mac].note, @macs[mac_log.mac] %><br/>
|
||||||
|
<small><%= mac_log.mac %></small>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
<td><%= mac_log.ip %></td>
|
<td><%= mac_log.ip %></td>
|
||||||
<td><%= mac_log.action %></td>
|
<td>
|
||||||
|
<% if mac_log.action == "activate" %>
|
||||||
|
<span style="background-color: green">
|
||||||
|
<% else %>
|
||||||
|
<span style="background-color: red">
|
||||||
|
<% end %>
|
||||||
|
<%= mac_log.action %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td><%= mac_log.created_at %></td>
|
<td><%= mac_log.created_at %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -33,10 +33,11 @@
|
||||||
@active_macs.each do |mac|
|
@active_macs.each do |mac|
|
||||||
Rails.logger.info mac.inspect %>
|
Rails.logger.info mac.inspect %>
|
||||||
<li>
|
<li>
|
||||||
|
<%= link_to mac do %>
|
||||||
<span title="<%= mac.mac if user_signed_in? %><%= " - "+mac.ip.to_s if can? :read_details, mac %><%= " - "+((Time.now - mac.since) / 1.hour).round(1).to_s+" hours" if can? :manage, mac %>">
|
<span title="<%= mac.mac if user_signed_in? %><%= " - "+mac.ip.to_s if can? :read_details, mac %><%= " - "+((Time.now - mac.since) / 1.hour).round(1).to_s+" hours" if can? :manage, mac %>">
|
||||||
<%= mac.user.name unless mac.user.blank? %>
|
<%= mac.user.name unless mac.user.blank? %>
|
||||||
<%= mac.mac if mac.user.blank? %>
|
<%= mac.mac if mac.user.blank? %>
|
||||||
<%= "("+mac.note+")" unless mac.note.blank? %></span>
|
<%= "("+mac.note+")" unless mac.note.blank? %></span><% end %>
|
||||||
<%= link_to ' Edit', edit_mac_path(mac) if can? :update, mac %> <br/>
|
<%= link_to ' Edit', edit_mac_path(mac) if can? :update, mac %> <br/>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user