|
@@ 91-108 (lines=18) @@
|
| 88 |
|
* @param Request $request |
| 89 |
|
* @return \Illuminate\Response\RedirectResponse |
| 90 |
|
*/ |
| 91 |
|
public function create(Request $request) |
| 92 |
|
{ |
| 93 |
|
try { |
| 94 |
|
$repo = new ServerRepository; |
| 95 |
|
$server = $repo->create($request->except('_token')); |
| 96 |
|
|
| 97 |
|
return redirect()->route('admin.servers.view', $server->id); |
| 98 |
|
} catch (DisplayValidationException $ex) { |
| 99 |
|
return redirect()->route('admin.servers.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
| 100 |
|
} catch (DisplayException $ex) { |
| 101 |
|
Alert::danger($ex->getMessage())->flash(); |
| 102 |
|
} catch (\Exception $ex) { |
| 103 |
|
Log::error($ex); |
| 104 |
|
Alert::danger('An unhandled exception occured while attemping to add this server. Please try again.')->flash(); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
return redirect()->route('admin.servers.new')->withInput(); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
/** |
| 111 |
|
* Returns a tree of all avaliable nodes in a given location. |
|
@@ 279-297 (lines=19) @@
|
| 276 |
|
* @param int $id |
| 277 |
|
* @return \Illuminate\Response\RedirectResponse |
| 278 |
|
*/ |
| 279 |
|
public function setContainer(Request $request, $id) |
| 280 |
|
{ |
| 281 |
|
$repo = new ServerRepository; |
| 282 |
|
|
| 283 |
|
try { |
| 284 |
|
$repo->updateContainer($id, $request->intersect('docker_image')); |
| 285 |
|
|
| 286 |
|
Alert::success('Successfully updated this server\'s docker image.')->flash(); |
| 287 |
|
} catch (DisplayValidationException $ex) { |
| 288 |
|
return redirect()->route('admin.servers.view.details', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
| 289 |
|
} catch (DisplayException $ex) { |
| 290 |
|
Alert::danger($ex->getMessage())->flash(); |
| 291 |
|
} catch (\Exception $ex) { |
| 292 |
|
Log::error($ex); |
| 293 |
|
Alert::danger('An unhandled exception occured while attemping to update this server\'s docker image. This error has been logged.')->flash(); |
| 294 |
|
} |
| 295 |
|
|
| 296 |
|
return redirect()->route('admin.servers.view.details', $id); |
| 297 |
|
} |
| 298 |
|
|
| 299 |
|
/** |
| 300 |
|
* Toggles the install status for a server. |