<commit_before><% content_for :header do %>
  <%=h @server.hostname %>
<% end %>
<h2>General info</h2>
<p>
  <dt>Hostname:</dt>
  <dd><%=h @server.hostname %></dd>

  <dt>Ssh address:</dt>
  <dd><%=h (@server.connect_address) %></dd>

  <dt>Ssh port:</dt>
  <dd><%=h (@server.ssh_port) %></dd>

  <dt>Enabled:</dt>
  <dd><%=h @server.enabled %></dd>

  <dt>Backup server:</dt>
  <dd><%=h @server.backup_server %></dd>

  <dt>Disk usage:</dt>
  <dd><%=number_to_human_size @server.usage || 'NaN '%></dd>
</p>

<p>
<% if !@server.last_backup %>
  <b>Backup never performed!</b>
<% elsif @server.backup_running? %>
  <b>Backup running since:</b>
  <%=h @server.last_started %>
<% else %>
  <b>Backup last finished:</b>
  <%=h @server.last_backup %>
<% end %>
<% unless @server.backup_running? %>
	<% form_for(@server.backup_jobs.build(:backup_server => @server.backup_server, :status => 'queued')) do |f| %>
	    <%= f.hidden_field :backup_server_id %>
	    <%= f.hidden_field :server_id %>
	    <%= f.hidden_field :status %>
	  <%= f.submit "Queue now" %>
	<% end %>
<% end %>
</p>

<% @job = BackupJob.new(:server => @server, :backup_server => @server.backup_server ) %>

<h2>Known snapshots</h2>
<table class="index sortable">
<thead>
<tr>
  <th>Name</th>
  <th>When</th>
  <th>Path on backup server</th>
</tr>
</thead>
<tbody>
<% @server.current_snapshots.each do | snapshot | %>
<tr>
	<td><%= snapshot %></td>
	<td><%= Time.at snapshot.to_i %></td>
	<td>/<%= @job.fs %>/.zfs/snapshot/<%= snapshot %></td>
</t>
<% end %>
</tbody>
</table>

<h2>Applied profiles</h2>
<ul class="profile_list">
<% @server.profiles.each do | profile | %>
  <li><%= link_to h(profile.name), profile %></li>
<% end %>
</ul>

<% if @server.backup_server %>
  <% @job = BackupJob.new(:server => @server, :backup_server => @server.backup_server ) %>
  <p>This resolves to the following rsync command:<br/> <%= @job.main_rsync %></p>
<% end %>
<% add_action 'Edit this server', edit_server_path( @server) %>
<% add_action 'Add Server', new_server_path %>
<% add_action 'Servers overview', servers_path %>

<h2>Latest problems</h2>
<table class="index sortable">
<thead>
<tr>
  <th>Backup Server</th>
  <th>When</th>
  <th>Message</th>
</tr>
</thead>
<tbody>
<% @server.latest_problems.each do | problem | %>
  <tr>
    <td><%=h problem.backup_server %></td>
    <td><%= problem.created_at %></td>
    <td><%=h problem.message %></td>
  </tr>
<% end %>
</tbody>
</table>

<h2>Latest backup jobs</h2>
<table class="index sortable">
  <thead>
  <tr>
	<th>Job</th>
    <th>Backup server</th>
    <th>Status</th>
    <th>Job created</th>
    <th>Started</th>
    <th>Duration (from the moment of queueing)</th>
  </tr>
  </thead>
  <tbody>
<% @server.latest_jobs.each do | job | %>
  <tr>
	<td><%= link_to job.id, job %></td>
    <td><%= h job.backup_server %></td>
    <td><%=h job.display_status %></td>
    <td><%=h job.created_at %></td>
    <td><%=h (job.started || job.updated_at) %></td>
    <td><%= display_backup_duration (job) %></td>
  </tr>
<% end %>
  </tbody>
</table><commit_msg>Spice up the server show page<commit_after><% content_for :header do %>
  <%=h @server.hostname %>
<% end %>
<table class="index sortable">
<thead>
  <tr>
  <td>Hostname:</td>
  <td>Ssh address</td>
  <td>Ssh port</td>
  <td>Enabled</td>
  <td>Backup server</td>
  <td>Disk usage</td>
  </tr>
</thead>
<tbody>
<tr>
  <td><%=h @server.hostname %></td>
  <td><%=h (@server.connect_address) %></td>
  <td><%=h (@server.ssh_port || 22 ) %></td>
  <td><%=h @server.enabled %></td>
  <td><%=h @server.backup_server %></td>
  <td><%=number_to_human_size @server.usage || 'NaN '%></td>
</tr>
</tbody>
</table>

<table class="index sortable">
<thead>
  <tr>
  <td>Rsync start path</td>
  <td>Snapshots to keep</td>
  <td>Backup interval</td>
  <td>Start of queuing window</td>
  <td>End of queuing window</td>
  </tr>
</thead>
<tbody>
<tr>
  <td><%=h @server.path || '/' %></td>
  <td><%=h @server.keep_snapshots %></td>
  <td><%=h @server.interval_hours %></td>
  <td><%=h @server.window_start %></td>
  <td><%=h @server.window_stop %></td>
</tr>
</tbody>
</table>

<p>
<% if !@server.last_backup %>
  <b>Backup never performed!</b>
<% elsif @server.backup_running? %>
  <b>Backup running since:</b>
  <%=h @server.last_started %>
<% else %>
  <b>Backup last finished:</b>
  <%=h @server.last_backup %>
<% end %>
<% unless @server.backup_running? %>
	<% form_for(@server.backup_jobs.build(:backup_server => @server.backup_server, :status => 'queued')) do |f| %>
	    <%= f.hidden_field :backup_server_id %>
	    <%= f.hidden_field :server_id %>
	    <%= f.hidden_field :status %>
	  <%= f.submit "Queue now" %>
	<% end %>
<% end %>
</p>

<% @job = BackupJob.new(:server => @server, :backup_server => @server.backup_server ) %>

<% if @server.current_snapshots.size > 0 %>
  <hr/>
  
<h3>Known snapshots</h3>
<table class="index sortable">
<thead>
<tr>
  <th>Name</th>
  <th>When</th>
  <th>Path on backup server</th>
</tr>
</thead>
<tbody>
<% @server.current_snapshots.each do | snapshot | %>
<tr>
	<td><%= snapshot %></td>
	<td><%= Time.at snapshot.to_i %></td>
	<td>/<%= @job.fs %>/.zfs/snapshot/<%= snapshot %></td>
</t>
<% end %>
</tbody>
</table>
<% end %> 
<hr/>

<h3>Applied profiles</h3>
<ul class="profile_list">
<% @server.profiles.each do | profile | %>
  <li><%= link_to h(profile.name), profile %></li>
<% end %>
</ul>

<% if @server.backup_server %>
  <% @job = BackupJob.new(:server => @server, :backup_server => @server.backup_server ) %>
  <p>This resolves to the following rsync command:<br/> <%= @job.main_rsync %></p>
<% end %>
<% add_action 'Edit this server', edit_server_path( @server) %>
<% add_action 'Add Server', new_server_path %>
<% add_action 'Servers overview', servers_path %>

<% if @server.problems.size > 0 %>
  <hr/>

<h3>Latest problems</h3>
<table class="index sortable">
<thead>
<tr>
  <th>Backup Server</th>
  <th>When</th>
  <th>Message</th>
</tr>
</thead>
<tbody>
<% @server.latest_problems.each do | problem | %>
  <tr>
    <td><%=h problem.backup_server %></td>
    <td><%= problem.created_at %></td>
    <td><%=h problem.message %></td>
  </tr>
<% end %>
</tbody>
</table>
<% end %>

<% if @server.backup_jobs.size > 0 %>
  <hr/>
<h3>Latest backup jobs</h3>
<table class="index sortable">
  <thead>
  <tr>
	<th>Job</th>
    <th>Backup server</th>
    <th>Status</th>
    <th>Job created</th>
    <th>Started</th>
    <th>Duration (from the moment of queueing)</th>
  </tr>
  </thead>
  <tbody>
<% @server.latest_jobs.each do | job | %>
  <tr>
	<td><%= link_to job.id, job %></td>
    <td><%= h job.backup_server %></td>
    <td><%=h job.display_status %></td>
    <td><%=h job.created_at %></td>
    <td><%=h (job.started || job.updated_at) %></td>
    <td><%= display_backup_duration (job) %></td>
  </tr>
<% end %>
  </tbody>
</table>
<% end %>
{'fraction_non_alphanumeric': 0.24550898203592814, 'fraction_numerical': 0.0033591353877610633, 'mean_word_length': 3.947976878612717, 'pattern_counts': {'":': 0, '<': 418, '<?xml version=': 0, '>': 433, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1661664', 'n_tokens_mistral': 2981, 'n_tokens_neox': 2759, 'n_words': 576}