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,9 +1,15 @@
<x-server-layout :server="$server">
<x-slot name="pageTitle">{{ __("PHP") }}</x-slot>
<livewire:php.installed-versions :server="$server" />
@error("version")
<x-alert-danger>
<x-input-error :messages="$errors->get('version')" />
</x-alert-danger>
@enderror
@if($server->defaultService('php'))
<livewire:php.default-cli :server="$server"/>
@include("php.partials.installed-versions")
@if ($server->defaultService("php"))
@include("php.partials.default-cli")
@endif
</x-server-layout>

View File

@ -0,0 +1,50 @@
<div>
<x-card-header>
<x-slot name="title">{{ __("Default PHP Cli") }}</x-slot>
<x-slot name="description">
{{ __("You can see and manage your PHP installations") }}
</x-slot>
</x-card-header>
<a class="block">
<x-item-card>
<div class="flex items-start justify-center">
<span class="mr-2">PHP {{ $defaultPHP->version }}</span>
@include("services.partials.status", ["status" => $defaultPHP->status])
</div>
<div class="flex items-center">
<div class="inline">
<x-dropdown>
<x-slot name="trigger">
<x-secondary-button>
{{ __("Change") }}
<x-heroicon name="o-chevron-up-down" class="ml-1 h-5 w-5" />
</x-secondary-button>
</x-slot>
<x-slot name="content">
@foreach ($phps as $php)
@if ($php->version != $defaultPHP->version)
<x-dropdown-link
id="php-{{ $php->id }}-default-cli"
class="cursor-pointer"
hx-post="{{ route('servers.php.default-cli', ['server' => $server, 'version' => $php->version]) }}"
hx-swap="outerHTML"
hx-select="#php-{{ $php->id }}-default-cli"
>
PHP {{ $php->version }}
</x-dropdown-link>
@endif
@endforeach
@if (count($phps) == 1)
<x-dropdown-link>
{{ __("No other versions") }}
</x-dropdown-link>
@endif
</x-slot>
</x-dropdown>
</div>
</div>
</x-item-card>
</a>
</div>

View File

@ -0,0 +1,47 @@
<x-modal name="install-extension">
<form
id="install-extension-form"
hx-post="{{ route("servers.php.install-extension", ["server" => $server]) }}"
hx-swap="outerHTML"
hx-select="#install-extension-form"
class="p-6"
>
<input type="hidden" name="version" :value="version" />
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Install Extension") }}
</h2>
<div class="mt-6">
<x-input-label for="extension" value="Name" />
<x-select-input name="extension" class="mt-1 w-full">
<option value="" selected>{{ __("Select") }}</option>
@foreach (config("core.php_extensions") as $extension)
<option
value="{{ $extension }}"
x-bind:disabled="installedExtensions.includes('{{ $extension }}')"
>
{{ $extension }}
</option>
@endforeach
</x-select-input>
@error("extension")
<x-input-error class="mt-2" :messages="$message" />
@enderror
@error("version")
<x-input-error class="mt-2" :messages="$message" />
@enderror
</div>
<div class="mt-6 flex items-center justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}
</x-secondary-button>
<x-primary-button hx-disable class="ml-3">
{{ __("Install") }}
</x-primary-button>
</div>
</form>
</x-modal>

View File

@ -0,0 +1,22 @@
<x-dropdown>
<x-slot name="trigger">
<x-primary-button hx-disable>
{{ __("Install PHP") }}
<x-heroicon name="o-chevron-up-down" class="ml-1 h-5 w-5" />
</x-primary-button>
</x-slot>
<x-slot name="content">
@foreach (config("core.php_versions") as $php)
@if (! $phps->whereIn("version", $php)->first() && $php !== "none")
<x-dropdown-link
class="cursor-pointer"
hx-post="{{ route('servers.php.install', ['server' => $server, 'version' => $php]) }}"
hx-swap="none"
>
PHP {{ $php }}
</x-dropdown-link>
@endif
@endforeach
</x-slot>
</x-dropdown>

View File

@ -0,0 +1,90 @@
<div x-data="{ version: '', uninstallAction: '', installedExtensions: [] }">
<x-card-header>
<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">
<div class="flex items-center">
@include("php.partials.install-new-php")
</div>
</x-slot>
</x-card-header>
<x-live id="live-phps">
@if (count($phps) > 0)
<div class="space-y-3">
@foreach ($phps as $php)
<a class="block">
<x-item-card>
<div class="flex items-start justify-center">
<span class="mr-2">PHP {{ $php->version }}</span>
@include("services.partials.status", ["status" => $php->status])
</div>
<div class="flex items-center">
<div class="inline">
<x-dropdown>
<x-slot name="trigger">
<x-secondary-button>
{{ __("Actions") }}
<x-heroicon name="o-chevron-up-down" class="ml-1 h-5 w-5" />
</x-secondary-button>
</x-slot>
<x-slot name="content">
<x-dropdown-link
class="cursor-pointer"
x-on:click="version = '{{ $php->version }}'; installedExtensions = {{ json_encode($php->type_data['extensions'] ?? []) }}; $dispatch('open-modal', 'install-extension')"
>
{{ __("Install Extension") }}
</x-dropdown-link>
<x-dropdown-link
class="cursor-pointer"
x-on:click="$dispatch('open-modal', 'update-php-ini'); document.getElementById('ini').value = 'Loading...';"
hx-get="{{ route('servers.php.get-ini', ['server' => $server, 'version' => $php->version]) }}"
hx-swap="outerHTML"
hx-target="#update-php-ini-form"
hx-select="#update-php-ini-form"
>
{{ __("Edit php.ini") }}
</x-dropdown-link>
<x-dropdown-link
class="cursor-pointer"
href="{{ route('servers.services.restart', ['server' => $server, 'service' => $php]) }}"
>
{{ __("Restart FPM") }}
</x-dropdown-link>
<x-dropdown-link
class="cursor-pointer"
x-on:click="uninstallAction = '{{ route('servers.php.uninstall', ['server' => $server, 'version' => $php->version]) }}'; $dispatch('open-modal', 'uninstall-php')"
>
<span class="text-red-600">
{{ __("Uninstall") }}
</span>
</x-dropdown-link>
</x-slot>
</x-dropdown>
</div>
</div>
</x-item-card>
</a>
@endforeach
</div>
@else
<x-simple-card>
<div class="text-center">
{{ __("You don't have any PHP version installed!") }}
</div>
</x-simple-card>
@endif
</x-live>
<x-confirmation-modal
name="uninstall-php"
:title="__('Uninstall PHP')"
:description="__('Are you sure you want to uninstall this version?')"
method="delete"
x-bind:action="uninstallAction"
/>
@include("php.partials.update-php-ini")
@include("php.partials.install-extension")
</div>

View File

@ -0,0 +1,39 @@
<x-modal name="update-php-ini">
<form
id="update-php-ini-form"
hx-post="{{ route("servers.php.update-ini", ["server" => $server]) }}"
hx-swap="outerHTML"
hx-select="#update-php-ini-form"
class="p-6"
>
<input type="hidden" name="version" :value="version" />
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
{{ __("Update php.ini") }}
</h2>
<div class="mt-6">
<x-input-label for="ini" value="php.ini" />
<x-textarea id="ini" name="ini" class="mt-1 w-full" rows="15">
{{ old("ini", session()->get("ini")) }}
</x-textarea>
@error("ini")
<x-input-error class="mt-2" :messages="$message" />
@enderror
@error("version")
<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 hx-disable class="ml-3">
{{ __("Save") }}
</x-primary-button>
</div>
</form>
</x-modal>