You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/Http/Controllers/Admin/LocationsController.php
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,8 @@ public function getIndex(Request $request)
45
45
returnview('admin.locations.index', [
46
46
'locations' => Models\Location::select(
47
47
'locations.*',
48
-
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount'),
49
-
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
48
+
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location_id = locations.id) as a_nodeCount'),
49
+
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location_id = locations.id)) as a_serverCount')
50
50
)->paginate(20),
51
51
]);
52
52
}
@@ -55,8 +55,8 @@ public function deleteLocation(Request $request, $id)
55
55
{
56
56
$model = Models\Location::select(
57
57
'locations.id',
58
-
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location = locations.id) as a_nodeCount'),
59
-
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location = locations.id)) as a_serverCount')
58
+
DB::raw('(SELECT COUNT(*) FROM nodes WHERE nodes.location_id = locations.id) as a_nodeCount'),
59
+
DB::raw('(SELECT COUNT(*) FROM servers WHERE servers.node_id IN (SELECT nodes.id FROM nodes WHERE nodes.location_id = locations.id)) as a_serverCount')
60
60
)->where('id', $id)->first();
61
61
62
62
if (! $model) {
@@ -80,12 +80,12 @@ public function patchLocation(Request $request, $id)
'error' => 'There was a validation error while processing this request. Location descriptions must be between 1 and 255 characters, and the location code must be between 1 and 10 characters with no spaces or special characters.',
88
+
'error' => 'There was a validation error while processing this request. Location descriptions must be between 1 and 255 characters, and the location code must be between 1 and 20 characters with no spaces or special characters.',
89
89
], 422);
90
90
} catch (\Exception$ex) {
91
91
// This gets caught and processed into JSON anyways.
@@ -97,9 +97,7 @@ public function postLocation(Request $request)
@@ -78,15 +76,25 @@ public function getNew(Request $request)
78
76
publicfunctionpostNew(Request$request)
79
77
{
80
78
try {
81
-
$node = newNodeRepository;
82
-
$new = $node->create($request->except([
83
-
'_token',
79
+
$repo = newNodeRepository;
80
+
$node = $repo->create($request->only([
81
+
'name',
82
+
'location',
83
+
'public',
84
+
'fqdn',
85
+
'scheme',
86
+
'memory',
87
+
'memory_overallocate',
88
+
'disk',
89
+
'disk_overallocate',
90
+
'daemonBase',
91
+
'daemonSFTP',
92
+
'daemonListen',
84
93
]));
85
-
Alert::success('Successfully created new node. <strong>Before you can add any servers you need to first assign some IP addresses and ports.</strong>')->flash();
86
-
Alert::info('<strong>To simplify the node setup you can generate a token on the configuration tab.</strong>')->flash();
94
+
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();
87
95
88
96
returnredirect()->route('admin.nodes.view', [
89
-
'id' => $new,
97
+
'id' => $node->id,
90
98
'tab' => 'tab_allocation',
91
99
]);
92
100
} catch (DisplayValidationException$e) {
@@ -103,35 +111,40 @@ public function postNew(Request $request)
0 commit comments