Add Startup Params view
Translations might be the end of us.
This commit is contained in:
parent
ffa1e46cec
commit
f6600f447f
8 changed files with 186 additions and 15 deletions
|
@ -247,6 +247,54 @@ class ServerController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function getStartup(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::getByUUID($uuid);
|
||||
$this->authorize('view-startup', $server);
|
||||
$node = Models\Node::find($server->node);
|
||||
$allocation = Models\Allocation::findOrFail($server->allocation);
|
||||
|
||||
Javascript::put([
|
||||
'server' => collect($server->makeVisible('daemonSecret'))->only(['uuid', 'uuidShort', 'daemonSecret', 'username']),
|
||||
'node' => collect($node)->only('fqdn', 'scheme', 'daemonListen'),
|
||||
]);
|
||||
|
||||
$variables = Models\ServiceVariables::select(
|
||||
'service_variables.*',
|
||||
DB::raw('COALESCE(server_variables.variable_value, service_variables.default_value) as a_serverValue')
|
||||
)->leftJoin('server_variables', 'server_variables.variable_id', '=', 'service_variables.id')
|
||||
->where('service_variables.option_id', $server->option)
|
||||
->where('server_variables.server_id', $server->id)
|
||||
->get();
|
||||
|
||||
$service = Models\Service::select(
|
||||
DB::raw('IFNULL(service_options.executable, services.executable) as executable')
|
||||
)->leftJoin('service_options', 'service_options.parent_service', '=', 'services.id')
|
||||
->where('service_options.id', $server->option)
|
||||
->where('services.id', $server->service)
|
||||
->first();
|
||||
|
||||
$serverVariables = [
|
||||
'{{SERVER_MEMORY}}' => $server->memory,
|
||||
'{{SERVER_IP}}' => $allocation->ip,
|
||||
'{{SERVER_PORT}}' => $allocation->port,
|
||||
];
|
||||
|
||||
$processed = str_replace(array_keys($serverVariables), array_values($serverVariables), $server->startup);
|
||||
foreach ($variables as &$variable) {
|
||||
$replace = ($variable->user_viewable === 1) ? $variable->a_serverValue : '**';
|
||||
$processed = str_replace('{{' . $variable->env_variable . '}}', $replace, $processed);
|
||||
}
|
||||
|
||||
return view('server.settings.startup', [
|
||||
'server' => $server,
|
||||
'node' => Models\Node::find($server->node),
|
||||
'variables' => $variables->where('user_viewable', 1),
|
||||
'service' => $service,
|
||||
'processedStartup' => $processed,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getDatabases(Request $request, $uuid)
|
||||
{
|
||||
$server = Models\Server::getByUUID($uuid);
|
||||
|
|
|
@ -65,8 +65,12 @@ class ServerRoutes
|
|||
'uses' => 'Server\ServerController@postSettingsSFTP',
|
||||
]);
|
||||
|
||||
$router->post('/settings/startup', [
|
||||
$router->get('/settings/startup', [
|
||||
'as' => 'server.settings.startup',
|
||||
'uses' => 'Server\ServerController@getStartup',
|
||||
]);
|
||||
|
||||
$router->post('/settings/startup', [
|
||||
'uses' => 'Server\ServerController@postSettingsStartup',
|
||||
]);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'not_authorized' => 'You are not authorized to perform this action.',
|
||||
'auth_error' => 'There was an error while attempting to login.',
|
||||
'authentication_required' => 'Authentication is required in order to continue.',
|
||||
'remember_me' => 'Remember Me',
|
||||
|
|
|
@ -6,4 +6,21 @@ return [
|
|||
'header' => 'Server Console',
|
||||
'header_sub' => 'Control your server in real time.',
|
||||
],
|
||||
'config' => [
|
||||
'startup' => [
|
||||
'header' => 'Start Configuration',
|
||||
'header_sub' => 'Control server startup arguments.',
|
||||
'command' => 'Startup Command',
|
||||
'edit_params' => 'Edit Parameters',
|
||||
'update' => 'Update Startup Parameters',
|
||||
],
|
||||
'sftp' => [
|
||||
'header' => 'SFTP Configuration',
|
||||
'header_sub' => 'Account details for SFTP connections.',
|
||||
'change_pass' => 'Change SFTP Password',
|
||||
'details' => 'SFTP Details',
|
||||
'conn_addr' => 'Connection Address',
|
||||
'warning' => 'Ensure that your client is set to use SFTP and not FTP or FTPS for connections, there is a difference between the protocols.',
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
|
@ -36,4 +36,7 @@ return [
|
|||
'never' => 'never',
|
||||
'sign_out' => 'Sign out',
|
||||
'admin_control' => 'Admin Control',
|
||||
'required' => 'Required',
|
||||
'port' => 'Port',
|
||||
'username' => 'Username',
|
||||
];
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<li class="treeview
|
||||
@if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases']))
|
||||
@if(in_array(Route::currentRouteName(), ['server.settings.sftp', 'server.settings.databases', 'server.settings.startup', 'server.settings.allocations']))
|
||||
active
|
||||
@endif
|
||||
">
|
||||
|
@ -181,7 +181,7 @@
|
|||
<ul class="treeview-menu">
|
||||
<li><a href=""><i class="fa fa-angle-right"></i> {{ trans('navigation.server.port_allocations') }}</a></li>
|
||||
<li class="{{ Route::currentRouteName() !== 'server.settings.sftp' ?: 'active' }}"><a href="{{ route('server.settings.sftp', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> {{ trans('navigation.server.sftp_settings') }}</a></li>
|
||||
<li><a href=""><i class="fa fa-angle-right"></i> {{ trans('navigation.server.startup_parameters') }}</a></li>
|
||||
<li class="{{ Route::currentRouteName() !== 'server.settings.startup' ?: 'active' }}"><a href="{{ route('server.settings.startup', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> {{ trans('navigation.server.startup_parameters') }}</a></li>
|
||||
<li class="{{ Route::currentRouteName() !== 'server.settings.databases' ?: 'active' }}"><a href="{{ route('server.settings.databases', $server->uuidShort) }}"><i class="fa fa-angle-right"></i> {{ trans('navigation.server.databases') }}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
SFTP Settings
|
||||
@lang('server.config.sftp.header')
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>SFTP Configuration<small>Account details for SFTP connections.</small></h1>
|
||||
<h1>@lang('server.config.sftp.header')<small>@lang('server.config.sftp.header_sub')</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">{{ trans('strings.home') }}</a></li>
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li>{{ trans('strings.configuration') }}</li>
|
||||
<li class="active">{{ trans('strings.sftp') }}</li>
|
||||
<li>@lang('navigation.server.configuration')</li>
|
||||
<li class="active">@lang('navigation.server.sftp_settings')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
<div class="col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Change SFTP Password</h3>
|
||||
<h3 class="box-title">@lang('server.config.sftp.change_pass')</h3>
|
||||
</div>
|
||||
@can('reset-sftp', $server)
|
||||
<form action="{{ route('server.settings.sftp', $server->uuidShort) }}" method="post">
|
||||
|
@ -59,7 +59,7 @@
|
|||
@else
|
||||
<div class="box-body">
|
||||
<div class="callout callout-warning callout-nomargin">
|
||||
<p>You are not authorized to perform this action.</p>
|
||||
<p>@lang('auth.not_authorized')</p>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
|
@ -68,25 +68,25 @@
|
|||
<div class="col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">SFTP Details</h3>
|
||||
<h3 class="box-title">@lang('server.config.sftp.details')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-8">
|
||||
<label for="new_email" class="control-label">Connection Address</label>
|
||||
<label for="new_email" class="control-label">@lang('server.config.sftp.conn_addr')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" readonly value="{{ $node->fqdn }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="new_email" class="control-label">Port</label>
|
||||
<label for="new_email" class="control-label">@lang('strings.port')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" readonly value="{{ $node->daemonSFTP }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password" class="control-label">Username</label>
|
||||
<label for="password" class="control-label">@lang('strings.username')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" readonly value="{{ $server->username }}" />
|
||||
</div>
|
||||
|
@ -101,7 +101,7 @@
|
|||
@endcan
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<p class="small text-muted">Ensure that your client is set to use <strong>SFTP</strong> and not FTP or FTPS for connections, there is a difference between the protocols.</p>
|
||||
<p class="small text-muted">@lang('server.config.sftp.warning')</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
{{-- Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
|
||||
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
|
||||
{{-- of this software and associated documentation files (the "Software"), to deal --}}
|
||||
{{-- in the Software without restriction, including without limitation the rights --}}
|
||||
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
|
||||
{{-- copies of the Software, and to permit persons to whom the Software is --}}
|
||||
{{-- furnished to do so, subject to the following conditions: --}}
|
||||
|
||||
{{-- The above copyright notice and this permission notice shall be included in all --}}
|
||||
{{-- copies or substantial portions of the Software. --}}
|
||||
|
||||
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
|
||||
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
|
||||
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
|
||||
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
|
||||
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
|
||||
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
|
||||
{{-- SOFTWARE. --}}
|
||||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
@lang('server.config.startup.header')
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>@lang('server.config.startup.header')<small>@lang('server.config.startup.header_sub')</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li>@lang('navigation.server.configuration')</li>
|
||||
<li class="active">@lang('navigation.server.startup_parameters')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.config.startup.command')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">{{ $service->executable }}</span>
|
||||
<input type="text" class="form-control" readonly="readonly" value="{{ $processedStartup }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.config.startup.edit_params')</h3>
|
||||
</div>
|
||||
@can('edit-startup', $server)
|
||||
<form action="{{ route('server.settings.startup', $server->uuidShort) }}" method="POST">
|
||||
<div class="box-body">
|
||||
@foreach($variables as $item)
|
||||
<div class="form-group">
|
||||
<label class="control-label">
|
||||
@if($item->required === 1)<span class="label label-danger">@lang('strings.required')</span> @endif
|
||||
{{ $item->name }}
|
||||
</label>
|
||||
<div>
|
||||
<input type="text"
|
||||
@if($item->user_editable === 1)
|
||||
name="{{ $item->env_variable }}"
|
||||
@else
|
||||
readonly="readonly"
|
||||
@endif
|
||||
class="form-control" value="{{ old($item->env_variable, $item->a_serverValue) }}" data-action="matchRegex" data-regex="{{ $item->regex }}" />
|
||||
</div>
|
||||
<p class="text-muted"><small>{!! $item->description !!}</small></p>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
{!! csrf_field() !!}
|
||||
<input type="submit" class="btn btn-primary btn-sm" value="@lang('server.config.startup.update')" />
|
||||
</div>
|
||||
</form>
|
||||
@else
|
||||
<div class="box-body">
|
||||
<div class="callout callout-warning callout-nomargin">
|
||||
<p>@lang('auth.not_authorized')</p>
|
||||
</div>
|
||||
</div>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('footer-scripts')
|
||||
@parent
|
||||
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||
@endsection
|
Loading…
Reference in a new issue