wowowowowo
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\ServiceStatus;
|
||||
use App\Models\Operation;
|
||||
use App\Models\Organisation;
|
||||
use App\Models\Provider;
|
||||
use App\Models\Service;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
@@ -15,7 +18,23 @@ class OrganisationController extends Controller
|
||||
'providers' => Inertia::lazy(fn () => Provider::whereOrganisationId($request->route('organisation'))->get()),
|
||||
'registries' => Inertia::lazy(fn () => Organisation::findOrFail($request->route('organisation'))->registries()->get()),
|
||||
'sourceProviders' => Inertia::lazy(fn () => Organisation::findOrFail($request->route('organisation'))->sourceProviders()->get()),
|
||||
'organisation' => Organisation::withCount('servers', 'applications', 'members')->findOrFail($request->route('organisation')),
|
||||
'organisation' => Organisation::with('members')
|
||||
->withCount('servers', 'applications', 'members', 'providers', 'sourceProviders', 'registries')
|
||||
->findOrFail($request->route('organisation')),
|
||||
'health' => [
|
||||
'unhealthy_services' => Service::query()
|
||||
->where('organisation_id', $request->route('organisation'))
|
||||
->whereNot('status', ServiceStatus::RUNNING)
|
||||
->count(),
|
||||
'failed_operations' => Operation::query()
|
||||
->whereHasMorph('target', [Service::class], fn ($query) => $query->where('organisation_id', $request->route('organisation')))
|
||||
->where('status', 'failed')
|
||||
->count(),
|
||||
'locked_variables' => Organisation::findOrFail($request->route('organisation'))
|
||||
->applications()
|
||||
->whereHas('environments.variables', fn ($query) => $query->where('overridable', false))
|
||||
->count(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user