improve navigation
This commit is contained in:
@@ -8,7 +8,6 @@ use App\Models\Project;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Dashboard extends Component
|
class Dashboard extends Component
|
||||||
@@ -52,16 +51,7 @@ class Dashboard extends Component
|
|||||||
|
|
||||||
public function navigateToProject($projectUuid)
|
public function navigateToProject($projectUuid)
|
||||||
{
|
{
|
||||||
$project = Project::where('uuid', $projectUuid)->first();
|
return $this->redirect(collect($this->projects)->firstWhere('uuid', $projectUuid)->navigateTo(), true);
|
||||||
|
|
||||||
if ($project && $project->environments->count() === 1) {
|
|
||||||
return Redirect::route('project.resource.index', [
|
|
||||||
'project_uuid' => $projectUuid,
|
|
||||||
'environment_uuid' => $project->environments->first()->uuid,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Redirect::route('project.show', ['project_uuid' => $projectUuid]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace App\Livewire\Project;
|
|||||||
use App\Models\PrivateKey;
|
use App\Models\PrivateKey;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Support\Facades\Redirect;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Index extends Component
|
class Index extends Component
|
||||||
@@ -34,15 +33,8 @@ class Index extends Component
|
|||||||
|
|
||||||
public function navigateToProject($projectUuid)
|
public function navigateToProject($projectUuid)
|
||||||
{
|
{
|
||||||
$project = Project::where('uuid', $projectUuid)->first();
|
$project = collect($this->projects)->firstWhere('uuid', $projectUuid);
|
||||||
|
|
||||||
if ($project && $project->environments->count() === 1) {
|
return $this->redirect($project->navigateTo(), true);
|
||||||
return Redirect::route('project.resource.index', [
|
|
||||||
'project_uuid' => $projectUuid,
|
|
||||||
'environment_uuid' => $project->environments->first()->uuid,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Redirect::route('project.show', ['project_uuid' => $projectUuid]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,4 +140,16 @@ class Project extends BaseModel
|
|||||||
{
|
{
|
||||||
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
|
return $this->postgresqls()->get()->merge($this->redis()->get())->merge($this->mongodbs()->get())->merge($this->mysqls()->get())->merge($this->mariadbs()->get())->merge($this->keydbs()->get())->merge($this->dragonflies()->get())->merge($this->clickhouses()->get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function navigateTo()
|
||||||
|
{
|
||||||
|
if ($this->environments->count() === 1) {
|
||||||
|
return route('project.resource.index', [
|
||||||
|
'project_uuid' => $this->uuid,
|
||||||
|
'environment_uuid' => $this->environments->first()->uuid,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return route('project.show', ['project_uuid' => $this->uuid]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@
|
|||||||
<x-modal-input buttonTitle="Add" title="New Project">
|
<x-modal-input buttonTitle="Add" title="New Project">
|
||||||
<livewire:project.add-empty />
|
<livewire:project.add-empty />
|
||||||
</x-modal-input> your first project or
|
</x-modal-input> your first project or
|
||||||
go to the <a class="underline dark:text-white" wire:navigate href="{{ route('onboarding') }}">onboarding</a> page.
|
go to the <a class="underline dark:text-white" wire:navigate
|
||||||
|
href="{{ route('onboarding') }}">onboarding</a> page.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -70,8 +71,7 @@
|
|||||||
@if ($servers->count() > 0)
|
@if ($servers->count() > 0)
|
||||||
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
|
<div class="grid grid-cols-1 gap-2 xl:grid-cols-2">
|
||||||
@foreach ($servers as $server)
|
@foreach ($servers as $server)
|
||||||
<a wire:navigate
|
<a wire:navigate href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
|
||||||
href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"
|
|
||||||
@class([
|
@class([
|
||||||
'gap-2 border cursor-pointer box group',
|
'gap-2 border cursor-pointer box group',
|
||||||
'border-transparent' => $server->settings->is_reachable,
|
'border-transparent' => $server->settings->is_reachable,
|
||||||
@@ -108,7 +108,8 @@
|
|||||||
<livewire:security.private-key.create from="server" />
|
<livewire:security.private-key.create from="server" />
|
||||||
</x-modal-input> a private key
|
</x-modal-input> a private key
|
||||||
or
|
or
|
||||||
go to the <a class="underline dark:text-white" wire:navigate href="{{ route('onboarding') }}">onboarding</a>
|
go to the <a class="underline dark:text-white" wire:navigate
|
||||||
|
href="{{ route('onboarding') }}">onboarding</a>
|
||||||
page.
|
page.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,7 +121,8 @@
|
|||||||
<livewire:server.create />
|
<livewire:server.create />
|
||||||
</x-modal-input> your first server
|
</x-modal-input> your first server
|
||||||
or
|
or
|
||||||
go to the <a class="underline dark:text-white" wire:navigate href="{{ route('onboarding') }}">onboarding</a>
|
go to the <a class="underline dark:text-white" wire:navigate
|
||||||
|
href="{{ route('onboarding') }}">onboarding</a>
|
||||||
page.
|
page.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -145,7 +147,8 @@
|
|||||||
<h4 class="pb-2">{{ $serverName }}</h4>
|
<h4 class="pb-2">{{ $serverName }}</h4>
|
||||||
<div class="grid grid-cols-1 gap-2 lg:grid-cols-3">
|
<div class="grid grid-cols-1 gap-2 lg:grid-cols-3">
|
||||||
@foreach ($deployments as $deployment)
|
@foreach ($deployments as $deployment)
|
||||||
<a wire:navigate href="{{ data_get($deployment, 'deployment_url') }}" @class([
|
<a wire:navigate href="{{ data_get($deployment, 'deployment_url') }}"
|
||||||
|
@class([
|
||||||
'gap-2 cursor-pointer box group border-l-2 border-dotted',
|
'gap-2 cursor-pointer box group border-l-2 border-dotted',
|
||||||
'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued',
|
'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued',
|
||||||
'border-yellow-500' => data_get($deployment, 'status') === 'in_progress',
|
'border-yellow-500' => data_get($deployment, 'status') === 'in_progress',
|
||||||
|
|||||||
@@ -12,21 +12,19 @@
|
|||||||
<div class="grid gap-2 lg:grid-cols-2">
|
<div class="grid gap-2 lg:grid-cols-2">
|
||||||
@forelse ($sources as $source)
|
@forelse ($sources as $source)
|
||||||
@if ($source->getMorphClass() === 'App\Models\GithubApp')
|
@if ($source->getMorphClass() === 'App\Models\GithubApp')
|
||||||
<a class="flex gap-4 text-center hover:no-underline box group"
|
<a class="flex gap-4 text-center hover:no-underline box group" wire:navigate
|
||||||
wire:navigate
|
|
||||||
href="{{ route('source.github.show', ['github_app_uuid' => data_get($source, 'uuid')]) }}">
|
href="{{ route('source.github.show', ['github_app_uuid' => data_get($source, 'uuid')]) }}">
|
||||||
<x-git-icon class="dark:text-white w-9 h-9" git="{{ $source->getMorphClass() }}" />
|
<x-git-icon class="dark:text-white w-9 h-9" git="{{ $source->getMorphClass() }}" />
|
||||||
<div class="text-left group-hover:dark:text-white">
|
<div class="text-left group-hover:dark:text-white">
|
||||||
<div>{{ $source->name }}</div>
|
<div class="box-title">{{ $source->name }}</div>
|
||||||
@if (is_null($source->app_id))
|
@if (is_null($source->app_id))
|
||||||
<span class="text-error">Configuration is not finished</span>
|
<span class="box-description !text-error ">Configuration is not finished.</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
@if ($source->getMorphClass() === 'App\Models\GitlabApp')
|
@if ($source->getMorphClass() === 'App\Models\GitlabApp')
|
||||||
<a class="flex gap-4 text-center hover:no-underline box group"
|
<a class="flex gap-4 text-center hover:no-underline box group" wire:navigate
|
||||||
wire:navigate
|
|
||||||
href="{{ route('source.gitlab.show', ['gitlab_app_uuid' => data_get($source, 'uuid')]) }}">
|
href="{{ route('source.gitlab.show', ['gitlab_app_uuid' => data_get($source, 'uuid')]) }}">
|
||||||
<x-git-icon class="dark:text-white w-9 h-9" git="{{ $source->getMorphClass() }}" />
|
<x-git-icon class="dark:text-white w-9 h-9" git="{{ $source->getMorphClass() }}" />
|
||||||
<div class="text-left group-hover:dark:text-white">
|
<div class="text-left group-hover:dark:text-white">
|
||||||
|
|||||||
Reference in New Issue
Block a user