Skip to content
Snippets Groups Projects
Commit 1cccd986 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Add client list WDS server page

parent 4dcba43a
Branches master
No related tags found
No related merge requests found
function wds_images_load(element){
function wds_load(element){
var url = $(element).attr('data-url');
tfm.tools.showSpinner();
$.ajax({
......@@ -8,11 +8,12 @@ function wds_images_load(element){
reloadOnAjaxComplete(element);
},
success: function(request) {
$('#images').html(request);
element.html(request);
}
});
}
$(function() {
wds_images_load($('#images'));
wds_load($('#images'));
wds_load($('#clients'));
})();
......@@ -60,10 +60,16 @@ class WdsServersController < ::ApplicationController
render partial: 'form', locals: { wds_server: @wds_server }
end
def wds_clients
@clients = @wds_server.clients
render partial: 'wds_servers/clients/list'
end
def wds_images
@images = @wds_server.boot_images + @wds_server.install_images
render partial: 'wds_images/list'
render partial: 'wds_servers/images/list'
end
private
......
<% title _('WDS Clients') %>
<table id="wds_clients" class="<%= table_css_classes %>" data-table='inline'>
<thead>
<tr>
<th><%= s_("Client|Name") %></th>
<th><%= s_("Client|Group") %></th>
<th><%= s_("Client|ID") %></th>
<th><%= s_("Client|Architecture") %></th>
<th><%= s_("Client|Boot Image") %></th>
<th><%= s_("Client|Unattend") %></th>
</tr>
</thead>
<tbody>
<%- @clients.each do |client| -%>
<%-
host = begin
if client[:device_id] =~ /([0-9A-F]{2}-){5}[0-9A-F]{2}/
nic = Nic::Managed.find_by(mac: client[:device_id].downcase.tr('-', ':'))
nic && nic.host
else
Host::Managed.find_by(name: client[:device_name])
end
end
-%>
<tr>
<td><%= host ? link_to_if_authorized(client[:device_name], hash_for_host_path(:id => host)) : client[:device_name] %></td>
<td><%= client[:group] %></td>
<td><%= client[:device_id] %></td>
<td><%= client[:architecture] %></td>
<td><%= client[:boot_image_path] %></td>
<td><%= client[:wds_client_unattend] %></td>
</tr>
<%- end -%>
</tbody>
</table>
......@@ -13,7 +13,7 @@
</tr>
</thead>
<tbody>
<% @images.each do |image| %>
<%- @images.each do |image| -%>
<tr>
<td><%= image.name %></td>
<td><%= image.image_group if image.respond_to? :image_group %></td>
......@@ -31,6 +31,6 @@
</td>
<td><%= image.type_name %></td>
</tr>
<% end %>
<%- end -%>
</tbody>
</table>
......@@ -7,6 +7,7 @@
<ul class="nav nav-tabs" data-tabs="tabs">
<li class="active"><a href="#primary" data-toggle="tab"><%= _("WDS Server") %></a></li>
<li><a href="#images" data-toggle="tab"><%= _("Images") %></a></li>
<li><a href="#clients" data-toggle="tab"><%= _("Clients") %></a></li>
</ul>
<div class="tab-content">
......@@ -39,4 +40,7 @@
<div id="images" class="tab-pane" data-url="<%= wds_images_wds_server_path(@wds_server) %>#wds_images">
<%= spinner(_('Loading image information ...')) %>
</div>
<div id="clients" class="tab-pane" data-url="<%= wds_clients_wds_server_path(@wds_server) %>#wds_clients">
<%= spinner(_('Loading image information ...')) %>
</div>
</div>
......@@ -8,6 +8,7 @@ Rails.application.routes.draw do
end
member do
post 'refresh_cache'
get 'wds_clients'
get 'wds_images'
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment