|
@@ 297-316 (lines=20) @@
|
| 294 |
|
* @param int $id |
| 295 |
|
* @return \Illuminate\Http\RedirectResponse |
| 296 |
|
*/ |
| 297 |
|
public function setContainer(Request $request, $id) |
| 298 |
|
{ |
| 299 |
|
$repo = new ServerRepository; |
| 300 |
|
|
| 301 |
|
try { |
| 302 |
|
$repo->updateContainer($id, $request->intersect('docker_image')); |
| 303 |
|
|
| 304 |
|
Alert::success('Successfully updated this server\'s docker image.')->flash(); |
| 305 |
|
} catch (DisplayValidationException $ex) { |
| 306 |
|
return redirect()->route('admin.servers.view.details', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
| 307 |
|
} catch (TransferException $ex) { |
| 308 |
|
Log::warning($ex); |
| 309 |
|
Alert::danger('A TransferException occured while attempting to update the container image. Is the daemon online? This error has been logged.'); |
| 310 |
|
} catch (\Exception $ex) { |
| 311 |
|
Log::error($ex); |
| 312 |
|
Alert::danger('An unhandled exception occured while attemping to update this server\'s docker image. This error has been logged.')->flash(); |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
return redirect()->route('admin.servers.view.details', $id); |
| 316 |
|
} |
| 317 |
|
|
| 318 |
|
/** |
| 319 |
|
* Toggles the install status for a server. |
|
@@ 465-485 (lines=21) @@
|
| 462 |
|
* @param int $id |
| 463 |
|
* @return \Illuminate\Http\RedirectResponse |
| 464 |
|
*/ |
| 465 |
|
public function delete(Request $request, $id) |
| 466 |
|
{ |
| 467 |
|
$repo = new ServerRepository; |
| 468 |
|
|
| 469 |
|
try { |
| 470 |
|
$repo->delete($id, $request->has('force_delete')); |
| 471 |
|
Alert::success('Server was successfully deleted from the system.')->flash(); |
| 472 |
|
|
| 473 |
|
return redirect()->route('admin.servers'); |
| 474 |
|
} catch (DisplayException $ex) { |
| 475 |
|
Alert::danger($ex->getMessage())->flash(); |
| 476 |
|
} catch (TransferException $ex) { |
| 477 |
|
Log::warning($ex); |
| 478 |
|
Alert::danger('A TransferException occurred while attempting to delete this server from the daemon, please ensure it is running. This error has been logged.')->flash(); |
| 479 |
|
} catch (\Exception $ex) { |
| 480 |
|
Log::error($ex); |
| 481 |
|
Alert::danger('An unhandled exception occured while attemping to delete this server. This error has been logged.')->flash(); |
| 482 |
|
} |
| 483 |
|
|
| 484 |
|
return redirect()->route('admin.servers.view.delete', $id); |
| 485 |
|
} |
| 486 |
|
|
| 487 |
|
/** |
| 488 |
|
* Update the startup command as well as variables. |