This commit is contained in:
Saeed Vaziry
2024-03-24 09:56:34 +01:00
committed by GitHub
parent 884f18db63
commit 4d051330d6
1055 changed files with 14493 additions and 20278 deletions

View File

@ -1,5 +1,5 @@
<x-server-layout :server="$server">
<x-slot name="pageTitle">{{ __("SSH Keys") }}</x-slot>
<livewire:server-ssh-keys.server-keys-list :server="$server"/>
@include("server-ssh-keys.partials.server-keys-list")
</x-server-layout>

View File

@ -0,0 +1,46 @@
<div>
<x-secondary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'add-existing-key')">
{{ __("Add existing Key") }}
</x-secondary-button>
<x-modal name="add-existing-key">
<form
id="add-existing-key-form"
hx-post="{{ route("servers.ssh-keys.deploy", ["server" => $server]) }}"
hx-swap="outerHTML"
hx-select="#add-existing-key-form"
class="p-6"
>
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Add existing Key") }}
</h2>
<div class="mt-6">
<x-input-label for="key_id" :value="__('SSH Key')" />
<x-select-input id="key_id" name="key_id" class="mt-1 w-full">
<option value="" selected disabled>
{{ __("Select") }}
</option>
@foreach (auth()->user()->sshKeys as $key)
<option value="{{ $key->id }}" @if($key->id === old('key_id')) selected @endif>
{{ $key->name }}
</option>
@endforeach
</x-select-input>
@error("key_id")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6 flex justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-primary-button class="ml-3" hx-disable>
{{ __("Add") }}
</x-primary-button>
</div>
</form>
</x-modal>
</div>

View File

@ -0,0 +1,53 @@
<div>
<x-primary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'add-key')">
{{ __("Add new Key") }}
</x-primary-button>
<x-modal name="add-key">
<form
id="add-key-form"
hx-post="{{ route("servers.ssh-keys.store", ["server" => $server]) }}"
hx-swap="outerHTML"
hx-select="#add-key-form"
class="p-6"
>
@csrf
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Add new Key") }}
</h2>
<div class="mt-6">
<x-input-label for="name" :value="__('Name')" />
<x-text-input value="{{ old('name') }}" id="name" name="name" type="text" class="mt-1 w-full" />
@error("name")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="public_key" :value="__('Public Key')" />
<x-textarea
value="{{ old('public_key') }}"
id="public_key"
name="public_key"
class="mt-1 w-full"
rows="5"
/>
@error("public_key")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6 flex justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-primary-button class="ml-3" hx-disable>
{{ __("Add") }}
</x-primary-button>
</div>
</form>
</x-modal>
</div>

View File

@ -0,0 +1,58 @@
<div x-data="{ deleteAction: '' }">
<x-card-header>
<x-slot name="title">{{ __("SSH Keys") }}</x-slot>
<x-slot name="description">
{{ __("Add or modify your ssh keys") }}
</x-slot>
<x-slot name="aside">
<div class="flex flex-col items-end lg:flex-row lg:items-center">
<div class="mb-2 lg:mb-0 lg:mr-2">
@include("server-ssh-keys.partials.add-new-key")
</div>
<div>
@include("server-ssh-keys.partials.add-existing-key")
</div>
</div>
</x-slot>
</x-card-header>
<x-live id="live-server-ssh-keys">
<div x-data="" class="space-y-3">
@if (count($keys) > 0)
@foreach ($keys as $key)
<x-item-card>
<div class="flex flex-grow flex-col items-start justify-center">
<span class="mb-1">{{ $key->name }}</span>
<span class="text-sm text-gray-400">
<x-datetime :value="$key->created_at" />
</span>
</div>
<div class="flex items-center">
@include("server-ssh-keys.partials.status", ["status" => $key->pivot->status])
<div class="inline">
<x-icon-button
x-on:click="deleteAction = '{{ route('servers.ssh-keys.destroy', ['server' => $server, 'sshKey' => $key]) }}'; $dispatch('open-modal', 'delete-key')"
>
<x-heroicon name="o-trash" class="h-5 w-5" />
</x-icon-button>
</div>
</div>
</x-item-card>
@endforeach
@else
<x-simple-card>
<div class="text-center">
{{ __("You haven't connected to any keys yet!") }}
</div>
</x-simple-card>
@endif
</div>
</x-live>
<x-confirmation-modal
name="delete-key"
:title="__('Confirm')"
:description="__('Are you sure that you want to delete this key?')"
method="delete"
x-bind:action="deleteAction"
/>
</div>

View File

@ -0,0 +1,11 @@
@if ($status == \App\Enums\SshKeyStatus::ADDED)
<x-status status="success">{{ $status }}</x-status>
@endif
@if ($status == \App\Enums\SshKeyStatus::ADDING)
<x-status status="warning">{{ $status }}</x-status>
@endif
@if ($status == \App\Enums\SshKeyStatus::DELETING)
<x-status status="danger">{{ $status }}</x-status>
@endif