Skip to content

Commit 238f08f

Browse files
committed
Add pack selection to view
1 parent 9eb1461 commit 238f08f

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function postNewServerServiceOptions(Request $request)
257257
* @param \Illuminate\Http\Request $request
258258
* @return \Illuminate\Contracts\View\View
259259
*/
260-
public function postNewServerServiceVariables(Request $request)
260+
public function postNewServerOptionDetails(Request $request)
261261
{
262262

263263
if(!$request->input('option')) {
@@ -274,6 +274,7 @@ public function postNewServerServiceVariables(Request $request)
274274
->first();
275275

276276
return response()->json([
277+
'packs' => Models\ServicePack::select('uuid', 'name', 'version')->where('option', $request->input('option'))->where('selectable', true)->get(),
277278
'variables' => Models\ServiceVariables::where('option_id', $request->input('option'))->get(),
278279
'exec' => $option->executable,
279280
'startup' => $option->startup

app/Http/Routes/AdminRoutes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public function map(Router $router) {
146146
'uses' => 'Admin\ServersController@postNewServerServiceOptions'
147147
]);
148148

149-
$router->post('/new/service-variables', [
150-
'uses' => 'Admin\ServersController@postNewServerServiceVariables'
149+
$router->post('/new/option-details', [
150+
'uses' => 'Admin\ServersController@postNewServerOptionDetails'
151151
]);
152152
// End Assorted Page Helpers
153153

resources/views/admin/servers/new.blade.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@
201201
<p class="text-muted"><small>Select the type of service that this server will be running.</small></p>
202202
</div>
203203
</div>
204+
<div class="form-group col-md-12 hidden">
205+
<label for="option" class="control-label">Service Pack</label>
206+
<div>
207+
<select name="pack" id="getPack" class="form-control">
208+
<option disabled selected> -- Select a Service Pack</option>
209+
</select>
210+
<p class="text-muted"><small>Select the service pack that should be used for this server. This option can be changed later.</small></p>
211+
</div>
212+
</div>
204213
</div>
205214
</div>
206215
</div>
@@ -392,6 +401,7 @@
392401
handleLoader('#load_services', true);
393402
$('#serviceOptions').slideUp();
394403
$('#getOption').html('<option disabled selected> -- Select a Service Option</option>');
404+
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
395405
396406
$.ajax({
397407
method: 'POST',
@@ -423,10 +433,11 @@
423433
handleLoader('#serviceOptions', true);
424434
$('#serverVariables').html('');
425435
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
436+
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
426437
427438
$.ajax({
428439
method: 'POST',
429-
url: '/admin/servers/new/service-variables',
440+
url: '/admin/servers/new/option-details',
430441
headers: {
431442
'X-CSRF-TOKEN': '{{ csrf_token() }}'
432443
},
@@ -436,6 +447,12 @@
436447
}).done(function (data) {
437448
$('#startupExec').html(data.exec);
438449
$('input[name="startup"]').val(data.startup);
450+
451+
$.each(data.packs, function (i, item) {
452+
$('#getPack').append('<option value="' + item.uuid + '">' + item.name + ' (' + item.version + ')</option>');
453+
});
454+
$('#getPack').append('<option value="none">No Service Pack</option>').parent().parent().removeClass('hidden');
455+
439456
$.each(data.variables, function (i, item) {
440457
var isRequired = (item.required === 1) ? '<span class="label label-primary">Required</span> ' : '';
441458
var dataAppend = ' \

0 commit comments

Comments
 (0)