-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more batch connect card refactor work (#3352)
More batch connect card refactor work. This moves a lot of the batch connect card rendering to partials. there are still things being rendered programatically, but this finishes a big chunk of moving from helper methods to partials.
- Loading branch information
Showing
7 changed files
with
75 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 5 additions & 28 deletions
33
apps/dashboard/app/views/batch_connect/sessions/_panel.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
<%= session_panel session do %> | ||
<%= session_view session do %> | ||
<% | ||
if session.running? | ||
if session.view | ||
views = { partial: "custom", locals: { view: session.view, connect: session.connect } } | ||
else | ||
if session.vnc? | ||
views = [] | ||
views << { title: "noVNC Connection", partial: "novnc", locals: { connect: session.connect, app_title: session.title } } | ||
views << { title: "Native Instructions", partial: "native_vnc", locals: { connect: session.connect } } if ENV["ENABLE_NATIVE_VNC"] | ||
else | ||
views = { partial: "missing_connection" } | ||
end | ||
end | ||
elsif session.starting? | ||
views = { partial: "starting" } | ||
elsif session.queued? | ||
views = { partial: "queued" } | ||
elsif session.completed? | ||
views = { partial: "completed", locals: { session: session } } | ||
else | ||
views = { partial: "bad" } | ||
end | ||
%> | ||
<%= connection_tabs(session.id, views) %> | ||
<% end %> | ||
<% end %> | ||
<div id="<%= "id_#{session.id}" %>" class="card session-panel mb-4" | ||
data-id="<%= session.id%>" data-hash="<%= session.to_hash %>" > | ||
<%= render_card_partial('card_header', session) %> | ||
<%= render_card_partial('card_body', session) %> | ||
</div> |
12 changes: 12 additions & 0 deletions
12
apps/dashboard/app/views/batch_connect/sessions/card/_card_body.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="card-body"> | ||
<div> | ||
<div class="float-right"><%= cancel_or_delete(session) %></div> | ||
<%= render_card_partial('host', session) %> | ||
<%= render_card_partial('created', session) %> | ||
<%= render_card_partial('session_time', session) %> | ||
<%= render_card_partial('id', session) %> | ||
<%= render_card_partial('support_ticket', session) if Configuration.support_ticket_enabled? %> | ||
<%= render_card_partial('display_choices', session) %> | ||
<%= render_connection(session) %> | ||
</div> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
apps/dashboard/app/views/batch_connect/sessions/card/_card_header.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<%- | ||
session_class = status_context(session) | ||
badge_class = "badge-#{session_class}" | ||
alert_class = "alert-#{session_class}" | ||
num_nodes = session.info.allocated_nodes.size | ||
num_cores = session.info.procs.to_i | ||
-%> | ||
|
||
<div class="card-heading"> | ||
<div class="h5 card-header overflow-auto <%= alert_class %>"> | ||
<a href="<%= new_batch_connect_session_context_path(token: session.token) %>"> | ||
<span class="card-text <%= alert_class %>"><%= session.title %></span> | ||
</a> | ||
<span class="card-text"> (<%= session.job_id %>)</span> | ||
<div class="float-right"> | ||
<%- if session.starting? || session.running? -%> | ||
<span class="badge <%= badge_class %> badge-pill"><%= pluralize(num_nodes, "node") %></span> | ||
<span class="card-text"> | </span> | ||
<span class="badge <%= badge_class %> badge-pill"><%= pluralize(num_nodes, "core") %></span> | ||
<span class="card-text"> | </span> | ||
<%- end -%> | ||
<%= status(session) %> | ||
<%- if session.completed? -%> | ||
<span class="card-text"> | </span> | ||
<%= relaunch(session) %> | ||
<%- end -%> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters