Files
old-saburly-confighub/web/app/views/servers/show.html.erb
2016-02-21 19:17:04 +01:00

66 lines
2.1 KiB
Plaintext

<div class="row">
<div class="col-md-11">
<h2><%= @record.name %></h2>
<div class="small"><%= @record.namehash %>
-
<%= @record.operating_system.name %></div>
<br/>
<br/>
</div>
</div>
<div class="row">
<% if @record.configuration_files.blank? %>
<div class="col-md-12 text-md-center">
<p>There are no configuration files from this server in CHUB. You can create file now and pull it to the server later:<br/><br/></p>
<p><%= button_to(new_configuration_file_path, method: :get, params: { server_id: @record.id}, class: "btn btn-success") do %>
Create New Configuration File
<% end %><br/><br/>
</p>
<p>Or you can initialize server with chub and upload the existing files from server by pasting this into your server's terminal:</p>
<% command = "sudo wget -O /usr/local/bin/chub http://chub.saburly.com/chub && sudo chub init #{@record.namehash}" %>
<p><%= text_field_tag 'command', command, readonly: true, class: 'form-control-sm', size: command.length %></p>
</div>
<% else %>
<p><%= button_to(new_configuration_file_path, method: :get, params: { server_id: @record.id}, class: "btn btn-success pull-center") do %>
Create New Configuration File
<% end %><br/><br/>
</p>
<table class="table">
<thead>
<tr>
<th>File Path</th>
<th>Version</th>
<th>Last Modified</th>
<th></th>
</tr>
</thead>
<tbody>
<% @record.configuration_files.each do |file| %>
<tr>
<td><%= file.file_path %></td>
<td>v<%= file.last_version.number %></td>
<td><%= distance_of_time_in_words(file.last_version.updated_at, Time.now) %></td>
<td><%= button_to(edit_configuration_file_path(file), method: :get, class: "btn btn-default inline") do %>
Edit
<% end %>
</td>
<td>
<%= button_to(configuration_file_path(file), method: :delete, class: "btn btn-danger inline") do %>
Delete
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>