Migrate to HTMX (#114)

Dropped Livewire
Added HTMX
Added Blade code lint
Drop Mysql and Redis
Migrate to SQLite
This commit is contained in:
Saeed Vaziry
2024-03-06 17:02:59 +01:00
committed by GitHub
parent 5b2c419e91
commit b2083fc6b2
486 changed files with 8609 additions and 8707 deletions

View File

@ -0,0 +1,5 @@
<x-profile-layout>
<x-slot name="pageTitle">{{ __("Storage Providers") }}</x-slot>
@include("settings.storage-providers.partials.providers-list")
</x-profile-layout>

View File

@ -0,0 +1,156 @@
<div>
<x-primary-button x-data="" x-on:click.prevent="$dispatch('open-modal', 'connect-provider')">
{{ __("Connect") }}
</x-primary-button>
<x-modal name="connect-provider">
@php
$oldProvider = old("provider", request()->input("provider") ?? "");
@endphp
<form
id="connect-storage-provider-form"
hx-post="{{ route("storage-providers.connect") }}"
hx-swap="outerHTML"
hx-select="#connect-storage-provider-form"
hx-ext="disable-element"
hx-disable-element="#btn-connect-storage-provider"
class="p-6"
x-data="{ provider: '{{ $oldProvider }}' }"
>
@csrf
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Connect to a Storage Provider") }}
</h2>
<div class="mt-6">
<x-input-label for="provider" value="Provider" />
<x-select-input x-model="provider" id="provider" name="provider" class="mt-1 w-full">
<option value="" selected disabled>
{{ __("Select") }}
</option>
@foreach (config("core.storage_providers") as $p)
@if ($p !== "custom")
<option value="{{ $p }}" @if($oldProvider === $p) selected @endif>
{{ $p }}
</option>
@endif
@endforeach
</x-select-input>
@error("provider")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<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 x-show="provider === 'dropbox'" class="mt-6">
<x-input-label for="token" value="API Key" />
<x-text-input value="{{ old('token') }}" id="token" name="token" type="text" class="mt-1 w-full" />
@error("token")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div x-show="provider === 'ftp'" class="mt-6">
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="host" value="Host" />
<x-text-input value="{{ old('host') }}" id="host" name="host" type="text" class="mt-1 w-full" />
@error("host")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="port" value="Port" />
<x-text-input value="{{ old('port') }}" id="port" name="port" type="text" class="mt-1 w-full" />
@error("port")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="mt-6">
<x-input-label for="path" value="Path" />
<x-text-input value="{{ old('path') }}" id="path" name="path" type="text" class="mt-1 w-full" />
@error("path")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="username" value="Username" />
<x-text-input
value="{{ old('username') }}"
id="username"
name="username"
type="text"
class="mt-1 w-full"
/>
@error("username")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="password" value="Password" />
<x-text-input
value="{{ old('password') }}"
id="password"
name="password"
type="text"
class="mt-1 w-full"
/>
@error("password")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
<div class="grid grid-cols-2 gap-2">
<div class="mt-6">
<x-input-label for="ssl" :value="__('SSL')" />
<x-select-input id="ssl" name="ssl" class="mt-1 w-full">
<option value="1" @if(old('ssl')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('ssl')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("ssl")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6">
<x-input-label for="passive" :value="__('Passive')" />
<x-select-input id="passive" name="passive" class="mt-1 w-full">
<option value="1" @if(old('passive')) selected @endif>
{{ __("Yes") }}
</option>
<option value="0" @if(!old('passive')) selected @endif>
{{ __("No") }}
</option>
</x-select-input>
@error("passive")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
</div>
</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 id="btn-connect-storage-provider" class="ml-3">
{{ __("Connect") }}
</x-primary-button>
</div>
</form>
</x-modal>
</div>

View File

@ -0,0 +1,18 @@
<x-modal name="delete-provider" :show="$errors->isNotEmpty()">
<form id="delete-provider-form" method="post" x-bind:action="deleteAction" class="p-6">
@csrf
@method("delete")
<h2 class="text-lg font-medium">Are you sure that you want to delete this provider?</h2>
<div class="mt-6 flex justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-danger-button class="ml-3">
{{ __("Delete") }}
</x-danger-button>
</div>
</form>
</x-modal>

View File

@ -0,0 +1,64 @@
<div>
<x-card-header>
<x-slot name="title">Storage Providers</x-slot>
<x-slot name="description">You can connect to your storage providers</x-slot>
<x-slot name="aside">
@include("settings.storage-providers.partials.connect-provider")
</x-slot>
</x-card-header>
<div x-data="{ deleteAction: '' }" class="space-y-3">
@if (count($providers) > 0)
@foreach ($providers as $provider)
<x-item-card>
<div class="flex-none">
@if ($provider->provider == \App\Enums\StorageProvider::FTP)
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="h-10 w-10 text-gray-600 dark:text-gray-200"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
/>
</svg>
@else
<img
src="{{ asset("static/images/" . $provider->provider . ".svg") }}"
class="h-10 w-10"
alt=""
/>
@endif
</div>
<div class="ml-3 flex flex-grow flex-col items-start justify-center">
<span class="mb-1">{{ $provider->profile }}</span>
<span class="text-sm text-gray-400">
<x-datetime :value="$provider->created_at" />
</span>
</div>
<div class="flex items-center">
<div class="inline">
<x-icon-button
x-on:click="deleteAction = '{{ route('storage-providers.delete', $provider->id) }}'; $dispatch('open-modal', 'delete-provider')"
>
<x-heroicon-o-trash class="h-5 w-5" />
</x-icon-button>
</div>
</div>
</x-item-card>
@endforeach
@include("settings.storage-providers.partials.delete-storage-provider")
@else
<x-simple-card>
<div class="text-center">
{{ __("You haven't connected to any storage providers yet!") }}
</div>
</x-simple-card>
@endif
</div>
</div>