mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 20:19:26 +01:00
Add session key to use last used node, instead of latest created node (#1869)
Co-authored-by: Lance Pioch <git@lance.sh>
This commit is contained in:
parent
b06df23823
commit
a30c45fbbe
@ -116,6 +116,14 @@ class CreateServer extends CreateRecord
|
|||||||
->prefixIcon('tabler-server-2')
|
->prefixIcon('tabler-server-2')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->default(function () {
|
->default(function () {
|
||||||
|
$lastUsedNode = session()->get('last_utilized_node');
|
||||||
|
|
||||||
|
if ($lastUsedNode && user()?->accessibleNodes()->where('id', $lastUsedNode)->exists()) {
|
||||||
|
$this->node = Node::find($lastUsedNode);
|
||||||
|
|
||||||
|
return $this->node?->id;
|
||||||
|
}
|
||||||
|
|
||||||
/** @var ?Node $latestNode */
|
/** @var ?Node $latestNode */
|
||||||
$latestNode = user()?->accessibleNodes()->latest()->first();
|
$latestNode = user()?->accessibleNodes()->latest()->first();
|
||||||
$this->node = $latestNode;
|
$this->node = $latestNode;
|
||||||
@ -829,6 +837,8 @@ class CreateServer extends CreateRecord
|
|||||||
$data['allocation_additional'] = collect($allocation_additional)->filter()->all();
|
$data['allocation_additional'] = collect($allocation_additional)->filter()->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session()->put('last_utilized_node', $data['node_id']);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->serverCreationService->handle($data);
|
return $this->serverCreationService->handle($data);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user