- Added main application entry point (app.jsx) and bootstrap file for React setup. - Created Wiki index page (Index.jsx) for documentation and file management. - Implemented utility functions for formatting and status handling in utils.js. - Set up Blade template (app.blade.php) for Inertia.js integration. - Defined API routes for metrics and terminal access in api.php. - Established console commands for scheduled tasks in console.php. - Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php. - Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments. - Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js. - Set up Vite for asset bundling and development server in vite.config.js.
55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Container;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Container;
|
|
use App\Models\DockerEndpoint;
|
|
use App\Services\Container\DockerManager;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
|
|
class ContainerController extends Controller
|
|
{
|
|
public function __construct(private DockerManager $docker) {}
|
|
|
|
public function index()
|
|
{
|
|
return Inertia::render('Container/Index', [
|
|
'containers' => Container::with('endpoint')->orderBy('name')->paginate(50),
|
|
'endpoints' => DockerEndpoint::orderBy('name')->get(),
|
|
]);
|
|
}
|
|
|
|
public function show(Container $container)
|
|
{
|
|
return Inertia::render('Container/Show', ['container' => $container->load('endpoint')]);
|
|
}
|
|
|
|
public function action(Request $request, Container $container)
|
|
{
|
|
$action = $request->validate(['action' => 'required|string'])['action'];
|
|
$this->docker->action($container->endpoint, $container->container_id, $action);
|
|
return back()->with('success', "Container {$action} executed.");
|
|
}
|
|
|
|
public function logs(Container $container)
|
|
{
|
|
$logs = $this->docker->logs($container->endpoint, $container->container_id);
|
|
return Inertia::render('Container/Logs', ['container' => $container, 'logs' => $logs]);
|
|
}
|
|
|
|
public function stats(Container $container)
|
|
{
|
|
$stats = $this->docker->stats($container->endpoint, $container->container_id);
|
|
return response()->json($stats);
|
|
}
|
|
|
|
public function destroy(Container $container)
|
|
{
|
|
$this->docker->removeContainer($container->endpoint, $container->container_id, true);
|
|
$container->delete();
|
|
return redirect()->route('containers.index')->with('success', 'Container removed.');
|
|
}
|
|
}
|