Files
old-saburly-confighub/web/app/views/servers/show.html.erb
2016-02-22 03:34:10 +01:00

85 lines
2.3 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>
</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>
<%
pull_commands = @record.configuration_files.map do |file|
pull_command(file)
end.join("\n")
push_commands = @record.configuration_files.map do |file|
push_command(file)
end.join("\n")
%>
<h3>Sync Server: </h3>
<div class="row">
<div class="col-md-6">
CHUB -> Your Server<br />
<%= text_area_tag 'command_pull', pull_commands, readonly: true, class: 'form-control-sm click-to-select-all', size: "80x10" %>
</div>
<div class="col-md-6">
Your Server -> CHUB<br />
<%= text_area_tag 'command_push', push_commands, readonly: true, class: 'form-control-sm click-to-select-all', size: "80x10" %>
</div>
</div>
<% end %>
</div>