open on git

This commit is contained in:
Andras Bacsai 2023-05-08 12:22:45 +02:00
parent a37f748639
commit dfecf2cc60
5 changed files with 21 additions and 5 deletions
app/Models
resources/views

@ -43,6 +43,15 @@ class Application extends BaseModel
set: fn ($value) => $value ? '/' . ltrim($value, '/') : null, set: fn ($value) => $value ? '/' . ltrim($value, '/') : null,
); );
} }
public function gitLocation(): Attribute
{
return Attribute::make(
get: fn () => is_null($this->git_commit_sha)
? "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_branch}"
: "{$this->source->html_url}/{$this->git_repository}/tree/{$this->git_commit_sha}"
);
}
public function baseDirectory(): Attribute public function baseDirectory(): Attribute
{ {
return Attribute::make( return Attribute::make(

@ -1,5 +1,12 @@
<nav class="flex gap-4 py-2"> <nav class="flex gap-4 py-2">
<a href="{{ route('project.application.configuration', Route::current()->parameters()) }}">Configuration</a> <a target="_blank" href="{{ $gitLocation }}">
<a href="{{ route('project.application.deployments', Route::current()->parameters()) }}">Deployments</a> <x-inputs.button>Open on Git ↗️</x-inputs.button>
</a>
<a href="{{ route('project.application.configuration', Route::current()->parameters()) }}">
<x-inputs.button>Configuration</x-inputs.button>
</a>
<a href="{{ route('project.application.deployments', Route::current()->parameters()) }}">
<x-inputs.button>Deployments</x-inputs.button>
</a>
<livewire:project.application.deploy :applicationId="$applicationId" /> <livewire:project.application.deploy :applicationId="$applicationId" />
</nav> </nav>

@ -1,6 +1,6 @@
<x-layout> <x-layout>
<h1>Configuration</h1> <h1>Configuration</h1>
<x-applications.navbar :applicationId="$application->id" /> <x-applications.navbar :applicationId="$application->id" :gitLocation="$application->gitLocation" />
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }"> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }">
<div class="flex gap-4"> <div class="flex gap-4">
<a :class="activeTab === 'general' && 'text-purple-500'" <a :class="activeTab === 'general' && 'text-purple-500'"

@ -1,5 +1,5 @@
<x-layout> <x-layout>
<h1>Deployment</h1> <h1>Deployment</h1>
<x-applications.navbar :applicationId="$application->id" /> <x-applications.navbar :applicationId="$application->id" :gitLocation="$application->gitLocation" />
<livewire:project.application.poll-deployment :activity="$activity" :deployment_uuid="$deployment_uuid" /> <livewire:project.application.poll-deployment :activity="$activity" :deployment_uuid="$deployment_uuid" />
</x-layout> </x-layout>

@ -1,6 +1,6 @@
<x-layout> <x-layout>
<h1>Deployments</h1> <h1>Deployments</h1>
<x-applications.navbar :applicationId="$application->id" /> <x-applications.navbar :applicationId="$application->id" :gitLocation="$application->gitLocation" />
<div class="pt-2"> <div class="pt-2">
@forelse ($deployments as $deployment) @forelse ($deployments as $deployment)
<livewire:project.application.get-deployments :deployment_uuid="data_get($deployment->properties, 'type_uuid')" :created_at="data_get($deployment, 'created_at')" :status="data_get($deployment->properties, 'status')" /> <livewire:project.application.get-deployments :deployment_uuid="data_get($deployment->properties, 'type_uuid')" :created_at="data_get($deployment, 'created_at')" :status="data_get($deployment->properties, 'status')" />