summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-09 20:00:21 -0700
committermo khan <mo@mokhan.ca>2015-02-09 20:00:21 -0700
commit64dd29d70ddda6f4927e9352e3e90c4f87b5041a (patch)
tree3a8a88be0418e6537454cddaba4f88e4261f0f36 /app
parent99eb8e0e8ba68bfdc6f97d58af2e7a1d7ba2e3ba (diff)
display created at for agents and sort by created_at descending.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/agents_controller.rb2
-rw-r--r--app/views/agents/index.html.erb7
2 files changed, 5 insertions, 4 deletions
diff --git a/app/controllers/agents_controller.rb b/app/controllers/agents_controller.rb
index 4acef9d..dc2717a 100644
--- a/app/controllers/agents_controller.rb
+++ b/app/controllers/agents_controller.rb
@@ -1,6 +1,6 @@
class AgentsController < ApplicationController
def index
- @agents = Agent.all
+ @agents = Agent.all.order(created_at: :desc)
end
def show
diff --git a/app/views/agents/index.html.erb b/app/views/agents/index.html.erb
index 3a6b738..75adfdb 100644
--- a/app/views/agents/index.html.erb
+++ b/app/views/agents/index.html.erb
@@ -9,15 +9,16 @@
<thead>
<tr>
<th>Hostname</th>
- <th colspan="4"></th>
+ <th>Created At</th>
+ <th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @agents.each do |agent| %>
<tr>
- <td><%= agent.hostname %></td>
+ <td><%= link_to agent.hostname, agent_path(agent) %></td>
+ <td><%= agent.created_at %></td>
<td><%= link_to 'Events', agent_events_path(agent) %></td>
- <td><%= link_to 'Show', agent %></td>
<td><%= link_to 'Edit', edit_agent_path(agent) %></td>
<td><%= link_to 'Destroy', agent, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>