mirror of
https://github.com/ubicloud/ubicloud.git
synced 2025-10-07 07:11:58 +08:00
Currently, herb/formatter has at least 4 bugs the prevent us from switching to it (https://github.com/marcoroth/herb/issues 476, 477, 478, and 479). This includes manual fixes for each issue. herb/formatter also introduces a rubocop violation for the Layout/AssignmentIndentation cop. This disables that cop.
89 lines
2.6 KiB
Text
89 lines
2.6 KiB
Text
<% @page_title = "#{@klass.name} #{@obj.ubid}" %>
|
|
|
|
<% if @klass.associations.include?(:sshable) && (sshable = @obj.sshable) %>
|
|
<p>
|
|
SSH Command:
|
|
<code>ssh -i <PRIVATE_KEY_PATH> <%= sshable.unix_user %>@<%= sshable.host %></code>
|
|
</p>
|
|
<% end %>
|
|
|
|
<div id="strand-info">
|
|
<% if @klass.associations.include?(:strand) && (strand = @obj.strand) %>
|
|
<a href="/model/Strand/<%= strand.ubid %>">Strand</a>:
|
|
<%= strand.prog %>#<%= strand.label %>
|
|
| schedule:
|
|
<%= strand.schedule.strftime("%F %T") %>
|
|
<% if strand.try > 0 %>
|
|
| try:
|
|
<%= strand.try %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if strand || @obj.is_a?(Strand) %>
|
|
<% strand ||= @obj %>
|
|
<%== form({action: "/model/Strand/#{strand.ubid}/schedule", method: :post}, button: "Schedule Strand to Run Now") %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if @klass.associations.include?(:semaphores) && !(semaphores = @obj.semaphores_dataset.select_order_map(:name)).empty? %>
|
|
<p>Semaphores Set: <%= semaphores.join(", ") %></p>
|
|
<% end %>
|
|
|
|
<% if actions = OBJECT_ACTIONS[@obj.class.name] %>
|
|
<p id="action-list">
|
|
Actions:
|
|
<% actions.each do |key, action| %>
|
|
<a href="/model/<%= @obj.class.name %>/<%= @obj.ubid %>/<%= key %>"><%= action.label %></a>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<table class="object-table">
|
|
<caption>Data</caption>
|
|
<thead>
|
|
<tr>
|
|
<th>Column</th>
|
|
<th>Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @obj.inspect_values_hash.each do |k, v| %>
|
|
<tr>
|
|
<td><%= k %></td>
|
|
<td>
|
|
<% if v.is_a?(String) && v.bytesize == 26 && (column_class = UBID.class_for_ubid(v)) && column_class.method_defined?(:ubid) && (obj = UBID.decode(v)) %>
|
|
<a href="/model/<%= column_class %>/<%= v %>"><%= obj.admin_label %></a>
|
|
<% else %>
|
|
<%= v %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h2 id="associations-header">Associations</h2>
|
|
|
|
<div class="associations">
|
|
<% @klass.associations.sort.each do |assoc| %>
|
|
<% reflection = @klass.association_reflection(assoc)
|
|
associated_class = reflection.associated_class
|
|
next unless associated_class.method_defined?(:ubid)
|
|
assoc_objs = if reflection.returns_array?
|
|
@obj.send(assoc) { it.limit(100) }
|
|
else
|
|
Array(@obj.send(assoc))
|
|
end
|
|
next if assoc_objs.empty? %>
|
|
<div class="association">
|
|
<h3><%= assoc %></h3>
|
|
<ul>
|
|
<% assoc_objs.each do %>
|
|
<li>
|
|
<a href="/model/<%= associated_class %>/<%= it.ubid %>"><%= it.admin_label %></a>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
</div>
|