refactoring

This commit is contained in:
Saeed Vaziry
2023-08-06 17:36:39 +02:00
parent 643318fcfc
commit a8295e15c3
28 changed files with 239 additions and 66 deletions

View File

@ -0,0 +1 @@
cat __path__;

View File

@ -30,11 +30,11 @@
<body class="font-sans antialiased bg-gray-100 dark:bg-gray-900 dark:text-gray-300 min-h-screen min-w-max" x-data="" x-cloak>
<div class="flex min-h-screen">
<div class="left-0 top-0 min-h-screen w-64 flex-none bg-gray-800 dark:bg-gray-800/50 p-3 dark:border-r-2 dark:border-gray-800">
<a href="/" class="h-16 block">
<div class="h-16 block">
<div class="flex items-center justify-start text-3xl font-extrabold text-white">
Vito
</div>
</a>
</div>
<div class="mb-5 space-y-2">
@include('layouts.partials.server-select', ['server' => isset($server) ? $server : null ])

View File

@ -68,7 +68,7 @@ function siteCombobox() {
selectSite(site) {
if (this.selected.id !== site.id) {
this.selected = site;
window.location.href = '{{ url('/servers') }}/' + '{{ $server->id }}/sites' + site.id
window.location.href = '{{ url('/servers') }}/' + '{{ $server->id }}/sites/' + site.id
}
},
filterSitesAndOpen() {

View File

@ -7,18 +7,44 @@
<h2 class="text-lg font-semibold">
<a href="{{ $site->activeSsl ? 'https://' : 'http://' . $site->domain }}" target="_blank">{{ $site->domain }}</a>
</h2>
<div class="flex flex-col items-end">
<livewire:sites.site-status :site="$site" />
<x-input-label class="cursor-pointer mt-1" x-data="{ copied: false }" x-clipboard.raw="{{ $site->web_directory_path }}">
<div class="text-sm flex items-center" x-on:click="copied = true; setTimeout(() => {copied = false}, 2000)">
<div x-show="copied" class="flex items-center mr-1">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-primary-600 dark:text-white font-bold">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75" />
</svg>
</div>
{{ $site->web_directory_path }}
<div class="flex items-end">
<div class="flex flex-col justify-center items-end h-20">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-gray-500 mr-1">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418" />
</svg>
<livewire:sites.site-status :site="$site" />
</div>
</x-input-label>
<x-input-label class="cursor-pointer mt-1" x-data="{ copied: false }" x-clipboard.raw="{{ $site->web_directory_path }}">
<div class="text-sm flex items-center" x-on:click="copied = true; setTimeout(() => {copied = false}, 2000)">
<div x-show="copied" class="flex items-center mr-1">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-primary-600 dark:text-white font-bold">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75" />
</svg>
</div>
{{ $site->domain }}
</div>
</x-input-label>
</div>
<div class="h-20 mx-5 border-r border-gray-200 dark:border-gray-800"></div>
<div class="flex flex-col justify-center items-end h-20">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 text-gray-500 mr-1">
<path stroke-linecap="round" stroke-linejoin="round" d="M21.75 17.25v-.228a4.5 4.5 0 00-.12-1.03l-2.268-9.64a3.375 3.375 0 00-3.285-2.602H7.923a3.375 3.375 0 00-3.285 2.602l-2.268 9.64a4.5 4.5 0 00-.12 1.03v.228m19.5 0a3 3 0 01-3 3H5.25a3 3 0 01-3-3m19.5 0a3 3 0 00-3-3H5.25a3 3 0 00-3 3m16.5 0h.008v.008h-.008v-.008zm-3 0h.008v.008h-.008v-.008z" />
</svg>
<livewire:servers.server-status :server="$site->server" />
</div>
<x-input-label class="cursor-pointer mt-1" x-data="{ copied: false }" x-clipboard.raw="{{ $site->server->ip }}">
<div class="text-sm flex items-center" x-on:click="copied = true; setTimeout(() => {copied = false}, 2000)">
<div x-show="copied" class="flex items-center mr-1">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-primary-600 dark:text-white font-bold">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.35 3.836c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m8.9-4.414c.376.023.75.05 1.124.08 1.131.094 1.976 1.057 1.976 2.192V16.5A2.25 2.25 0 0118 18.75h-2.25m-7.5-10.5H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V18.75m-7.5-10.5h6.375c.621 0 1.125.504 1.125 1.125v9.375m-8.25-3l1.5 1.5 3-3.75" />
</svg>
</div>
{{ $site->server->ip }}
</div>
</x-input-label>
</div>
</div>
</x-slot>
@ -32,12 +58,14 @@
<x-secondary-sidebar-link :href="route('servers.sites.show', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.show')">
{{ __('Application') }}
</x-secondary-sidebar-link>
<x-secondary-sidebar-link :href="route('servers.sites.ssl', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.ssl')">
{{ __('SSL') }}
</x-secondary-sidebar-link>
<x-secondary-sidebar-link :href="route('servers.sites.queues', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.queues')">
{{ __('Queues') }}
</x-secondary-sidebar-link>
@if($site->status == \App\Enums\SiteStatus::READY)
<x-secondary-sidebar-link :href="route('servers.sites.ssl', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.ssl')">
{{ __('SSL') }}
</x-secondary-sidebar-link>
<x-secondary-sidebar-link :href="route('servers.sites.queues', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.queues')">
{{ __('Queues') }}
</x-secondary-sidebar-link>
@endif
<x-secondary-sidebar-link :href="route('servers.sites.settings', ['server' => $site->server, 'site' => $site])" :active="request()->routeIs('servers.sites.settings')">
{{ __('Settings') }}
</x-secondary-sidebar-link>

View File

@ -25,6 +25,7 @@
<x-td>
@if($deployment->status != \App\Enums\DeploymentStatus::DEPLOYING)
<x-icon-button wire:click="showLog({{ $deployment->id }})" wire:loading.attr="disabled">
Logs
</x-icon-button>
@endif
</x-td>

View File

@ -0,0 +1,36 @@
<div x-data="">
<x-secondary-button x-on:click="$dispatch('open-modal', 'update-env')">{{ __(".env") }}</x-secondary-button>
<x-modal name="update-env">
<form wire:submit.prevent="save" class="p-6">
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __('Update .env File') }}
</h2>
<div class="mt-6">
<x-input-label for="env" :value="__('.env')" />
<x-textarea wire:model.defer="env" rows="10" id="env" name="env" class="mt-1 w-full" />
@error('env')
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6 flex items-center justify-end">
@if (session('status') === 'updating-env')
<p class="mr-2">{{ __('Updating env...') }}</p>
@endif
@if (session('status') === 'env-updated')
<p class="mr-2">{{ __('Saved') }}</p>
@endif
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __('Cancel') }}
</x-secondary-button>
<x-primary-button class="ml-3">
{{ __('Save') }}
</x-primary-button>
</div>
</form>
</x-modal>
</div>

View File

@ -10,6 +10,9 @@
<div class="mr-2">
<livewire:application.deployment-script :site="$site" />
</div>
<div class="mr-2">
<livewire:application.env :site="$site" />
</div>
<div>
<livewire:application.deploy :site="$site" />
</div>

View File

@ -16,6 +16,7 @@
<x-slot name="trigger">
<x-secondary-button>
{{ __("Change") }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="ml-1 h-5 w-5"><path fill-rule="evenodd" d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z" clip-rule="evenodd"></path></svg>
</x-secondary-button>
</x-slot>
<x-slot name="content">

View File

@ -3,7 +3,9 @@
<x-slot name="title">{{ __("Installed PHPs") }}</x-slot>
<x-slot name="description">{{ __("You can see and manage your PHP installations") }}</x-slot>
<x-slot name="aside">
@include('livewire.php.partials.install-new-php')
<div class="flex items-center">
@include('livewire.php.partials.install-new-php')
</div>
</x-slot>
</x-card-header>
@ -22,6 +24,7 @@
<x-slot name="trigger">
<x-secondary-button>
{{ __("Actions") }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="ml-1 h-5 w-5"><path fill-rule="evenodd" d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z" clip-rule="evenodd"></path></svg>
</x-secondary-button>
</x-slot>
<x-slot name="content">

View File

@ -1,7 +1,8 @@
<x-dropdown>
<x-slot name="trigger">
<x-primary-button>
{{ __("Install") }}
{{ __("Install PHP") }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="ml-1 h-5 w-5"><path fill-rule="evenodd" d="M10 3a.75.75 0 01.55.24l3.25 3.5a.75.75 0 11-1.1 1.02L10 4.852 7.3 7.76a.75.75 0 01-1.1-1.02l3.25-3.5A.75.75 0 0110 3zm-3.76 9.2a.75.75 0 011.06.04l2.7 2.908 2.7-2.908a.75.75 0 111.1 1.02l-3.25 3.5a.75.75 0 01-1.1 0l-3.25-3.5a.75.75 0 01.04-1.06z" clip-rule="evenodd"></path></svg>
</x-primary-button>
</x-slot>

View File

@ -1,7 +1,7 @@
<div>
<x-card-header>
<x-slot name="title">{{ __("Queues") }}</x-slot>
<x-slot name="description">{{ __("You can manage and create queues for your site") }}</x-slot>
<x-slot name="description">{{ __("You can manage and create queues for your site via supervisor") }}</x-slot>
<x-slot name="aside">
<livewire:queues.create-queue :site="$site" />
</x-slot>

View File

@ -1,11 +1,25 @@
<div>
@if($site->status === \App\Enums\SiteStatus::INSTALLING)
@include('livewire.sites.partials.installing', ['site' => $site])
<livewire:server-logs.logs-list :server="$site->server" :site="$site" :count="10" />
@endif
@if($site->status === \App\Enums\SiteStatus::INSTALLATION_FAILED)
@include('livewire.sites.partials.installation-failed', ['site' => $site])
<livewire:server-logs.logs-list :server="$site->server" :site="$site" :count="10" />
@endif
@if($site->status === \App\Enums\SiteStatus::READY)
@include('livewire.sites.partials.site-overview', ['site' => $site])
@if($site->type == \App\Enums\SiteType::LARAVEL)
<livewire:application.laravel-app :site="$site" />
@endif
@if($site->type == \App\Enums\SiteType::PHP)
<livewire:application.php-app :site="$site" />
@endif
@if($site->type == \App\Enums\SiteType::WORDPRESS)
<livewire:application.wordpress-app :site="$site" />
@endif
@endif
</div>

View File

@ -2,6 +2,4 @@
<x-slot name="pageTitle">{{ $site->domain }}</x-slot>
<livewire:sites.show-site :site="$site" />
<livewire:server-logs.logs-list :server="$site->server" :site="$site" :count="10" />
</x-site-layout>