|
@@ 280-299 (lines=20) @@
|
| 277 |
|
* @param int $id |
| 278 |
|
* @return \Illuminate\Http\RedirectResponse |
| 279 |
|
*/ |
| 280 |
|
public function setContainer(Request $request, $id) |
| 281 |
|
{ |
| 282 |
|
$repo = new ServerRepository; |
| 283 |
|
|
| 284 |
|
try { |
| 285 |
|
$repo->updateContainer($id, $request->intersect('docker_image')); |
| 286 |
|
|
| 287 |
|
Alert::success('Successfully updated this server\'s docker image.')->flash(); |
| 288 |
|
} catch (DisplayValidationException $ex) { |
| 289 |
|
return redirect()->route('admin.servers.view.details', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
| 290 |
|
} catch (TransferException $ex) { |
| 291 |
|
Log::warning($ex); |
| 292 |
|
Alert::danger('A TransferException occured while attempting to update the container image. Is the daemon online? This error has been logged.'); |
| 293 |
|
} catch (\Exception $ex) { |
| 294 |
|
Log::error($ex); |
| 295 |
|
Alert::danger('An unhandled exception occured while attemping to update this server\'s docker image. This error has been logged.')->flash(); |
| 296 |
|
} |
| 297 |
|
|
| 298 |
|
return redirect()->route('admin.servers.view.details', $id); |
| 299 |
|
} |
| 300 |
|
|
| 301 |
|
/** |
| 302 |
|
* Toggles the install status for a server. |
|
@@ 424-444 (lines=21) @@
|
| 421 |
|
* @param int $id |
| 422 |
|
* @return \Illuminate\Http\RedirectResponse |
| 423 |
|
*/ |
| 424 |
|
public function delete(Request $request, $id) |
| 425 |
|
{ |
| 426 |
|
$repo = new ServerRepository; |
| 427 |
|
|
| 428 |
|
try { |
| 429 |
|
$repo->delete($id, $request->has('force_delete')); |
| 430 |
|
Alert::success('Server was successfully deleted from the system.')->flash(); |
| 431 |
|
|
| 432 |
|
return redirect()->route('admin.servers'); |
| 433 |
|
} catch (DisplayException $ex) { |
| 434 |
|
Alert::danger($ex->getMessage())->flash(); |
| 435 |
|
} catch (TransferException $ex) { |
| 436 |
|
Log::warning($ex); |
| 437 |
|
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(); |
| 438 |
|
} catch (\Exception $ex) { |
| 439 |
|
Log::error($ex); |
| 440 |
|
Alert::danger('An unhandled exception occured while attemping to delete this server. This error has been logged.')->flash(); |
| 441 |
|
} |
| 442 |
|
|
| 443 |
|
return redirect()->route('admin.servers.view.delete', $id); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
/** |
| 447 |
|
* Update the startup command as well as variables. |