feat: add server tag retrieval and available colors endpoints

This commit is contained in:
2025-12-18 21:13:29 -05:00
parent 5a8d24be33
commit 5fb364ff7e
2 changed files with 35 additions and 10 deletions

View File

@@ -8,6 +8,26 @@ use Paymenter\Extensions\Servers\Proxmox\Models\Server;
class ServerTagController
{
/**
* Get tags for a server
*/
public function show($serverId)
{
$server = Server::where('id', $serverId)
->where('user_id', Auth::id())
->firstOrFail();
return response()->json([
'success' => true,
'tag1' => $server->tag1,
'tag1color' => $server->tag1color,
'tag2' => $server->tag2,
'tag2color' => $server->tag2color,
'tag3' => $server->tag3,
'tag3color' => $server->tag3color,
]);
}
/**
* Update tags for a server
*/
@@ -34,4 +54,19 @@ class ServerTagController
], 500);
}
}
/**
* Get available tag colors
*/
public function colors()
{
return response()->json([
'success' => true,
'colors' => [
'#e74c3c', '#e67e22', '#f1c40f', '#2ecc71', '#1abc9c', '#3498db',
'#9b59b6', '#e91e63', '#00bcd4', '#8bc34a', '#ff5722', '#607d8b',
'#795548', '#9e9e9e', '#673ab7', '#4caf50'
],
]);
}
}

View File

@@ -7,7 +7,6 @@ use Paymenter\Extensions\Servers\Proxmox\Livewire\CloudInit;
use Paymenter\Extensions\Servers\Proxmox\Livewire\Display;
use Paymenter\Extensions\Servers\Proxmox\Livewire\Index;
use Paymenter\Extensions\Servers\Proxmox\Http\Controllers\LiveTrafficController;
use Paymenter\Extensions\Servers\Proxmox\Http\Controllers\ServerTagController;
use Paymenter\Extensions\Servers\Proxmox\Livewire\Firewall;
use Paymenter\Extensions\Servers\Proxmox\Livewire\Network;
use Paymenter\Extensions\Servers\Proxmox\Livewire\Overview;
@@ -41,12 +40,3 @@ Route::group([
Route::get('{server}/xterm', XTerm::class)->name('server.xterm');
Route::get('{server}/help', Help::class)->name('server.help');
});
// Server Tag Routes
Route::group([
'prefix' => 'proxmox/server',
'as' => 'proxmox.server.',
'middleware' => ['web', 'auth'],
], function () {
Route::post('{server}/tags', [ServerTagController::class, 'update'])->name('tags.update');
});