| @@ 81-103 (lines=23) @@ | ||
| 78 | * @param Request $request |
|
| 79 | * @return \Illuminate\Response\RedirectResponse |
|
| 80 | */ |
|
| 81 | public function create(Request $request) |
|
| 82 | { |
|
| 83 | try { |
|
| 84 | $repo = new NodeRepository; |
|
| 85 | $node = $repo->create($request->intersect([ |
|
| 86 | 'name', 'location_id', 'public', 'fqdn', 'scheme', 'memory', |
|
| 87 | 'memory_overallocate', 'disk', 'disk_overallocate', |
|
| 88 | 'daemonBase', 'daemonSFTP', 'daemonListen', |
|
| 89 | ])); |
|
| 90 | Alert::success('Successfully created new node that can be configured automatically on your remote machine by visiting the configuration tab. <strong>Before you can add any servers you need to first assign some IP addresses and ports.</strong>')->flash(); |
|
| 91 | ||
| 92 | return redirect()->route('admin.nodes.view', $node->id); |
|
| 93 | } catch (DisplayValidationException $e) { |
|
| 94 | return redirect()->route('admin.nodes.new')->withErrors(json_decode($e->getMessage()))->withInput(); |
|
| 95 | } catch (DisplayException $e) { |
|
| 96 | Alert::danger($e->getMessage())->flash(); |
|
| 97 | } catch (\Exception $e) { |
|
| 98 | Log::error($e); |
|
| 99 | Alert::danger('An unhandled exception occured while attempting to add this node. Please try again.')->flash(); |
|
| 100 | } |
|
| 101 | ||
| 102 | return redirect()->route('admin.nodes.new')->withInput(); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * Shows the index overview page for a specific node. |
|
| @@ 211-233 (lines=23) @@ | ||
| 208 | * @param int $node |
|
| 209 | * @return \Illuminate\Http\RedirectResponse |
|
| 210 | */ |
|
| 211 | public function updateSettings(Request $request, $id) |
|
| 212 | { |
|
| 213 | $repo = new NodeRepository; |
|
| 214 | ||
| 215 | try { |
|
| 216 | $repo->update($id, $request->intersect([ |
|
| 217 | 'name', 'location_id', 'public', 'fqdn', 'scheme', 'memory', |
|
| 218 | 'memory_overallocate', 'disk', 'disk_overallocate', 'upload_size', |
|
| 219 | 'daemonSFTP', 'daemonListen', 'reset_secret', |
|
| 220 | ])); |
|
| 221 | ||
| 222 | Alert::success('Successfully updated this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash(); |
|
| 223 | } catch (DisplayValidationException $ex) { |
|
| 224 | return redirect()->route('admin.nodes.view.settings', $id)->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 225 | } catch (DisplayException $ex) { |
|
| 226 | Alert::danger($ex->getMessage())->flash(); |
|
| 227 | } catch (\Exception $ex) { |
|
| 228 | Log::error($ex); |
|
| 229 | Alert::danger('An unhandled exception occured while attempting to edit this node. Please try again.')->flash(); |
|
| 230 | } |
|
| 231 | ||
| 232 | return redirect()->route('admin.nodes.view.settings', $id)->withInput(); |
|
| 233 | } |
|
| 234 | ||
| 235 | /** |
|
| 236 | * Removes a single allocation from a node. |
|
| @@ 61-84 (lines=24) @@ | ||
| 58 | * @param Request $request |
|
| 59 | * @return \Illuminate\Response\RedirectResponse |
|
| 60 | */ |
|
| 61 | public function create(Request $request) |
|
| 62 | { |
|
| 63 | $repo = new OptionRepository; |
|
| 64 | ||
| 65 | try { |
|
| 66 | $option = $repo->create($request->intersect([ |
|
| 67 | 'service_id', 'name', 'description', 'tag', |
|
| 68 | 'docker_image', 'startup', 'config_from', 'config_startup', |
|
| 69 | 'config_logs', 'config_files', 'config_stop', |
|
| 70 | ])); |
|
| 71 | Alert::success('Successfully created new service option.')->flash(); |
|
| 72 | ||
| 73 | return redirect()->route('admin.services.option.view', $option->id); |
|
| 74 | } catch (DisplayValidationException $ex) { |
|
| 75 | return redirect()->route('admin.services.option.new')->withErrors(json_decode($ex->getMessage()))->withInput(); |
|
| 76 | } catch (DisplayException $ex) { |
|
| 77 | Alert::danger($ex->getMessage())->flash(); |
|
| 78 | } catch (\Exception $ex) { |
|
| 79 | Log::error($ex); |
|
| 80 | Alert::danger('An unhandled exception occurred while attempting to create this service. This error has been logged.')->flash(); |
|
| 81 | } |
|
| 82 | ||
| 83 | return redirect()->route('admin.services.option.new')->withInput(); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Handles POST request to create a new option variable. |
|