Implement Keystone environment deployments
This commit is contained in:
61
app/Http/Controllers/OnboardingController.php
Normal file
61
app/Http/Controllers/OnboardingController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Organisation;
|
||||
use Inertia\Response;
|
||||
|
||||
class OnboardingController extends Controller
|
||||
{
|
||||
public function show(Organisation $organisation): Response
|
||||
{
|
||||
$organisation->loadCount(['providers', 'sourceProviders', 'registries', 'servers', 'applications']);
|
||||
|
||||
$steps = [
|
||||
[
|
||||
'key' => 'organisation',
|
||||
'label' => 'Organisation',
|
||||
'complete' => true,
|
||||
'href' => route('organisations.show', ['organisation' => $organisation->id]),
|
||||
],
|
||||
[
|
||||
'key' => 'provider',
|
||||
'label' => 'Provider',
|
||||
'complete' => $organisation->providers_count > 0,
|
||||
'href' => route('organisations.show', ['organisation' => $organisation->id]),
|
||||
],
|
||||
[
|
||||
'key' => 'source',
|
||||
'label' => 'Source',
|
||||
'complete' => $organisation->source_providers_count > 0,
|
||||
'href' => route('source-providers.create', ['organisation' => $organisation->id]),
|
||||
],
|
||||
[
|
||||
'key' => 'registry',
|
||||
'label' => 'Registry',
|
||||
'complete' => $organisation->registries_count > 0,
|
||||
'href' => route('registries.create', ['organisation' => $organisation->id]),
|
||||
],
|
||||
[
|
||||
'key' => 'server',
|
||||
'label' => 'Server',
|
||||
'complete' => $organisation->servers_count > 0,
|
||||
'href' => route('servers.create', ['organisation' => $organisation->id]),
|
||||
],
|
||||
[
|
||||
'key' => 'application',
|
||||
'label' => 'Application',
|
||||
'complete' => $organisation->applications_count > 0,
|
||||
'href' => route('applications.create', ['organisation' => $organisation->id]),
|
||||
],
|
||||
];
|
||||
|
||||
$next = collect($steps)->firstWhere('complete', false) ?? $steps[array_key_last($steps)];
|
||||
|
||||
return inertia('onboarding/Show', [
|
||||
'organisation' => $organisation,
|
||||
'steps' => $steps,
|
||||
'nextStep' => $next,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user