|
@@ 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. |