feat: deploy key based deployments

This commit is contained in:
Andras Bacsai
2023-05-10 13:05:32 +02:00
parent fe6ecd465e
commit 946758e219
8 changed files with 253 additions and 28 deletions

View File

@@ -0,0 +1,84 @@
<div>
@if ($servers->count() > 0)
<h1>Choose a server</h1>
@endif
@forelse ($servers as $server)
@if ($chosenServer && $chosenServer['id'] === $server->id)
<x-inputs.button class="bg-blue-500" wire:click="chooseServer({{ $server }})">{{ $server->name }}
</x-inputs.button>
@else
<x-inputs.button wire:click="chooseServer({{ $server }})">{{ $server->name }}</x-inputs.button>
@endif
@empty
No servers found.
<p>Did you forget to add a destination on the server?</p>
@endforelse
@isset($chosenServer)
@if ($standalone_docker->count() > 0 || $swarm_docker->count() > 0)
<h1>Choose a destination</h1>
<div>
@foreach ($standalone_docker as $standalone)
@if ($chosenDestination?->uuid == $standalone->uuid)
<x-inputs.button class="bg-blue-500"
wire:click="setDestination('{{ $standalone->uuid }}','StandaloneDocker')">
{{ $standalone->network }}</x-inputs.button>
@else
<x-inputs.button wire:click="setDestination('{{ $standalone->uuid }}','StandaloneDocker')">
{{ $standalone->network }}</x-inputs.button>
@endif
@endforeach
@foreach ($swarm_docker as $standalone)
@if ($chosenDestination?->uuid == $standalone->uuid)
<x-inputs.button class="bg-blue-500"
wire:click="setDestination('{{ $standalone->uuid }}','SwarmDocker')">
{{ $standalone->network }}</x-inputs.button>
@else
<x-inputs.button wire:click="setDestination('{{ $standalone->uuid }}','SwarmDocker')">
{{ $standalone->uuid }}</x-inputs.button>
@endif
@endforeach
</div>
<div>
<a href="{{ route('destination.new', ['server_id' => $chosenServer['id']]) }}">Add
a new
destination</a>
</div>
@else
<h1>No destinations found on this server.</h1>
<a href="{{ route('destination.new', ['server_id' => $chosenServer['id']]) }}">Add
a
destination</a>
@endif
@endisset
@isset($chosenDestination)
<h1>Choose a repository</h1>
<form wire:submit.prevent='submit'>
<div class="flex items-end gap-2 pb-2">
<x-inputs.input class="w-96" id="repository_url" label="Repository URL" />
@if ($is_static)
<x-inputs.input id="publish_directory" label="Publish Directory" />
@else
<x-inputs.input type="number" id="port" label="Port" :readonly="$is_static" />
@endif
<x-inputs.input instantSave type="checkbox" id="is_static" label="Static Site?" />
</div>
<x-inputs.button type="submit">
Submit
</x-inputs.button>
</form>
<div>
<h1>Select a private key</h1>
@foreach ($private_keys as $key)
@if ($private_key_id == $key->id)
<x-inputs.button class="bg-blue-500" wire:click.defer="setPrivateKey('{{ $key->id }}')">
{{ $key->name }}</x-inputs.button>
@else
<x-inputs.button wire:click.defer="setPrivateKey('{{ $key->id }}')">{{ $key->name }}
</x-inputs.button>
@endif
@endforeach
</div>
@endisset
</div>

View File

@@ -56,7 +56,7 @@
@isset($chosenDestination)
<h1>Choose a repository</h1>
<form class="flex flex-col gap-2 w-96" wire:submit.prevent='submit'>
<x-inputs.input class="w-96" id="public_repository_url" label="Repository URL" />
<x-inputs.input class="w-96" id="repository_url" label="Repository URL" />
<x-inputs.input instantSave type="checkbox" id="is_static" label="Static Site?" />
@if ($is_static)
<x-inputs.input id="publish_directory" label="Publish Directory" />

View File

@@ -7,7 +7,10 @@
<div x-data="{ activeTab: 'choose' }">
<div class="flex flex-col w-64 gap-2 mb-10">
<x-inputs.button @click.prevent="activeTab = 'public-repo'">Public Repository</x-inputs.button>
<x-inputs.button @click.prevent="activeTab = 'github-private-repo'">Private Repository (GitHub App)
<x-inputs.button @click.prevent="activeTab = 'github-private-repo'">Private Repository (with GitHub App)
</x-inputs.button>
<x-inputs.button @click.prevent="activeTab = 'github-private-repo-deploy-key'">Private Repository (with
Deploy Key)
</x-inputs.button>
@if ($type === 'project')
<livewire:project.new.empty-project />
@@ -20,5 +23,8 @@
<div x-cloak x-show="activeTab === 'github-private-repo'">
<livewire:project.new.github-private-repository :type="$type" />
</div>
<div x-cloak x-show="activeTab === 'github-private-repo-deploy-key'">
<livewire:project.new.github-private-repository-deploy-key :type="$type" />
</div>
</div>
</x-layout>