Add pack selection to view
This commit is contained in:
parent
9eb14614c2
commit
238f08f222
3 changed files with 22 additions and 4 deletions
|
@ -257,7 +257,7 @@ class ServersController extends Controller
|
|||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function postNewServerServiceVariables(Request $request)
|
||||
public function postNewServerOptionDetails(Request $request)
|
||||
{
|
||||
|
||||
if(!$request->input('option')) {
|
||||
|
@ -274,6 +274,7 @@ class ServersController extends Controller
|
|||
->first();
|
||||
|
||||
return response()->json([
|
||||
'packs' => Models\ServicePack::select('uuid', 'name', 'version')->where('option', $request->input('option'))->where('selectable', true)->get(),
|
||||
'variables' => Models\ServiceVariables::where('option_id', $request->input('option'))->get(),
|
||||
'exec' => $option->executable,
|
||||
'startup' => $option->startup
|
||||
|
|
|
@ -146,8 +146,8 @@ class AdminRoutes {
|
|||
'uses' => 'Admin\ServersController@postNewServerServiceOptions'
|
||||
]);
|
||||
|
||||
$router->post('/new/service-variables', [
|
||||
'uses' => 'Admin\ServersController@postNewServerServiceVariables'
|
||||
$router->post('/new/option-details', [
|
||||
'uses' => 'Admin\ServersController@postNewServerOptionDetails'
|
||||
]);
|
||||
// End Assorted Page Helpers
|
||||
|
||||
|
|
|
@ -201,6 +201,15 @@
|
|||
<p class="text-muted"><small>Select the type of service that this server will be running.</small></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12 hidden">
|
||||
<label for="option" class="control-label">Service Pack</label>
|
||||
<div>
|
||||
<select name="pack" id="getPack" class="form-control">
|
||||
<option disabled selected> -- Select a Service Pack</option>
|
||||
</select>
|
||||
<p class="text-muted"><small>Select the service pack that should be used for this server. This option can be changed later.</small></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -392,6 +401,7 @@ $(document).ready(function () {
|
|||
handleLoader('#load_services', true);
|
||||
$('#serviceOptions').slideUp();
|
||||
$('#getOption').html('<option disabled selected> -- Select a Service Option</option>');
|
||||
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
|
@ -423,10 +433,11 @@ $(document).ready(function () {
|
|||
handleLoader('#serviceOptions', true);
|
||||
$('#serverVariables').html('');
|
||||
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
|
||||
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/admin/servers/new/service-variables',
|
||||
url: '/admin/servers/new/option-details',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
|
@ -436,6 +447,12 @@ $(document).ready(function () {
|
|||
}).done(function (data) {
|
||||
$('#startupExec').html(data.exec);
|
||||
$('input[name="startup"]').val(data.startup);
|
||||
|
||||
$.each(data.packs, function (i, item) {
|
||||
$('#getPack').append('<option value="' + item.uuid + '">' + item.name + ' (' + item.version + ')</option>');
|
||||
});
|
||||
$('#getPack').append('<option value="none">No Service Pack</option>').parent().parent().removeClass('hidden');
|
||||
|
||||
$.each(data.variables, function (i, item) {
|
||||
var isRequired = (item.required === 1) ? '<span class="label label-primary">Required</span> ' : '';
|
||||
var dataAppend = ' \
|
||||
|
|
Loading…
Reference in a new issue