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

View File

@ -43,6 +43,15 @@ public function publishDirectory(): Attribute
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
{
return Attribute::make(

View File

@ -1,5 +1,12 @@
<nav class="flex gap-4 py-2">
<a href="{{ route('project.application.configuration', Route::current()->parameters()) }}">Configuration</a>
<a href="{{ route('project.application.deployments', Route::current()->parameters()) }}">Deployments</a>
<a target="_blank" href="{{ $gitLocation }}">
<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" />
</nav>

View File

@ -1,6 +1,6 @@
<x-layout>
<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 class="flex gap-4">
<a :class="activeTab === 'general' && 'text-purple-500'"

View File

@ -1,5 +1,5 @@
<x-layout>
<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" />
</x-layout>

View File

@ -1,6 +1,6 @@
<x-layout>
<h1>Deployments</h1>
<x-applications.navbar :applicationId="$application->id" />
<x-applications.navbar :applicationId="$application->id" :gitLocation="$application->gitLocation" />
<div class="pt-2">
@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')" />