diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index 5ec7d9a2b..be598f241 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -123,9 +123,7 @@ class ServersController extends Controller { $server = Models\Server::withTrashed()->select( 'servers.*', - 'nodes.name as a_nodeName', 'users.email as a_ownerEmail', - 'locations.long as a_locationName', 'services.name as a_serviceName', DB::raw('IFNULL(service_options.executable, services.executable) as a_serviceExecutable'), 'service_options.docker_image', @@ -135,7 +133,6 @@ class ServersController extends Controller 'allocations.ip_alias' )->join('nodes', 'servers.node', '=', 'nodes.id') ->join('users', 'servers.owner', '=', 'users.id') - ->join('locations', 'nodes.location', '=', 'locations.id') ->join('services', 'servers.service', '=', 'services.id') ->join('service_options', 'servers.option', '=', 'service_options.id') ->join('allocations', 'servers.allocation', '=', 'allocations.id') @@ -148,6 +145,12 @@ class ServersController extends Controller return view('admin.servers.view', [ 'server' => $server, + 'node' => Models\Node::select( + 'nodes.*', + 'locations.long as a_locationName' + )->join('locations', 'nodes.location', '=', 'locations.id') + ->where('nodes.id', $server->node) + ->first(), 'assigned' => Models\Allocation::where('assigned_to', $id)->orderBy('ip', 'asc')->orderBy('port', 'asc')->get(), 'unassigned' => Models\Allocation::where('node', $server->node)->whereNull('assigned_to')->orderBy('ip', 'asc')->orderBy('port', 'asc')->get(), 'startup' => Models\ServiceVariables::select('service_variables.*', 'server_variables.variable_value as a_serverValue') diff --git a/resources/views/admin/servers/view.blade.php b/resources/views/admin/servers/view.blade.php index a3ec84e1f..a3cc399e1 100644 --- a/resources/views/admin/servers/view.blade.php +++ b/resources/views/admin/servers/view.blade.php @@ -79,17 +79,25 @@ UUID {{ $server->uuid }} + + Docker Container ID + + + + Docker User ID + + Owner {{ $server->a_ownerEmail }} Location - {{ $server->a_locationName }} + {{ $node->a_locationName }} Node - {{ $server->a_nodeName }} + {{ $node->name }} Service @@ -553,6 +561,27 @@ $(document).ready(function () { $('[data-toggle="tooltip"]').tooltip(); $('#sidebar_links').find("a[href='/admin/servers']").addClass('active'); + (function checkServerInfo() { + $.ajax({ + type: 'GET', + headers: { + 'X-Access-Token': '{{ $server->daemonSecret }}', + 'X-Access-Server': '{{ $server->uuid }}' + }, + url: '{{ $node->scheme }}://{{ $node->fqdn }}:{{ $node->daemonListen }}/server', + dataType: 'json', + timeout: 5000, + }).done(function (data) { + $('td[data-attr="container-id"]').html('' + data.container.id + ''); + $('td[data-attr="container-user"]').html('' + data.user + ''); + }).fail(function (jqXHR) { + $('td[data-attr="container-id"]').html('error'); + $('td[data-attr="container-user"]').html('error'); + console.error(jqXHR); + }).always(function () { + setTimeout(checkServerInfo, 60000); + }) + })(); $('input[name="default"]').on('change', function (event) { $('select[name="remove_additional[]"]').find('option:disabled').prop('disabled', false); $('select[name="remove_additional[]"]').find('option[value="' + $(this).val() + '"]').prop('disabled', true).prop('selected', false);