This commit is contained in:
Dennis
2022-03-23 09:06:28 +01:00
parent 7a0716959a
commit ea0c4ed66d
13 changed files with 239 additions and 225 deletions

2
.gitignore vendored
View File

@@ -14,3 +14,5 @@ yarn-error.log
.php_cs.cache .php_cs.cache
.php-cs-fixer.cache .php-cs-fixer.cache
/public/js/resources*.js /public/js/resources*.js
/storage/views/header.blade.php
/storage/views/footer.blade.php

View File

@@ -11,7 +11,9 @@ class UserController extends Controller
{ {
public function index() public function index()
{ {
$users = User::with('package:id,name') $users = User::query()
->withCount('sites', 'servers')
->with('package:id,name')
->when(request()->input('search'), function ($query, $value) { ->when(request()->input('search'), function ($query, $value) {
return $query->where('name', 'like', '%' . $value . '%')->orWhere('email', 'like', '%' . $value . '%'); return $query->where('name', 'like', '%' . $value . '%')->orWhere('email', 'like', '%' . $value . '%');
}) })

View File

@@ -2,6 +2,7 @@
namespace App\Jobs\Apps; namespace App\Jobs\Apps;
use App\Models\Database;
use App\Models\Site; use App\Models\Site;
use App\Traits\HasPloi; use App\Traits\HasPloi;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
@@ -9,6 +10,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Arr;
class InstallApp implements ShouldQueue class InstallApp implements ShouldQueue
{ {
@@ -18,13 +20,6 @@ class InstallApp implements ShouldQueue
public $type; public $type;
public $options; public $options;
/**
* Create a new job instance.
*
* @param Site $site
* @param string $type
* @param array $options
*/
public function __construct(Site $site, string $type = Site::PROJECT_WORDPRESS, array $options = []) public function __construct(Site $site, string $type = Site::PROJECT_WORDPRESS, array $options = [])
{ {
$this->site = $site; $this->site = $site;
@@ -32,17 +27,21 @@ class InstallApp implements ShouldQueue
$this->options = $options; $this->options = $options;
} }
/**
* Execute the job.
*
* @return void
*/
public function handle() public function handle()
{ {
$this->getPloi() $response = $this->getPloi()
->server($this->site->server->ploi_id) ->server($this->site->server->ploi_id)
->sites($this->site->ploi_id) ->sites($this->site->ploi_id)
->app() ->app()
->install($this->type, $this->options); ->install($this->type, $this->options);
if (Arr::get($this->options, 'create_database', false)) {
$database = $this->site->databases()->create([
'name' => $response->database_name,
]);
$database->status = Database::STATUS_ACTIVE;
$database->save();
}
} }
} }

View File

@@ -66,7 +66,7 @@ class App extends Resource
$this->setId($response->getJson()->data->id); $this->setId($response->getJson()->data->id);
// Return the data // Return the data
return $response->getJson()->data; return $response->getJson();
} }
public function uninstall($type): bool public function uninstall($type): bool

411
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,6 +15,7 @@ return [
'paths' => [ 'paths' => [
resource_path('views'), resource_path('views'),
storage_path('views'),
], ],
/* /*

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -42,6 +42,7 @@
<span class="text-primary">{{ user.name }}</span> <span class="text-primary">{{ user.name }}</span>
<p class="text-medium-emphasis">{{ user.email }}</p> <p class="text-medium-emphasis">{{ user.email }}</p>
<p class="text-medium-emphasis">{{ user.sites_count }} {{ __choice('site|sites', user.sites_count) }} &centerdot; {{ user.servers_count }} {{ __choice('server|servers', user.servers_count) }}</p>
</inertia-link> </inertia-link>
</TableData> </TableData>

View File

@@ -1,5 +1,5 @@
<template> <template>
<FormGroup class="relative max-w-lg"> <FormGroup class="relative">
<Label :errors="errors" :forId="id">{{ label }}</Label> <Label :errors="errors" :forId="id">{{ label }}</Label>
<button type="button" @click="copy" v-if="allowCopy" class="flex items-center right-0 absolute text-xs text-medium-emphasis"> <button type="button" @click="copy" v-if="allowCopy" class="flex items-center right-0 absolute text-xs text-medium-emphasis">

View File

@@ -22,7 +22,7 @@ import ErrorText from '@/components/ErrorText'
import HelperText from '@/components/HelperText' import HelperText from '@/components/HelperText'
const defaultClasses = const defaultClasses =
'w-full border-medium-emphasis text-body h-10 max-w-lg px-2 border rounded bg-surface-1 focus:outline-none focus:border-primary' 'w-full border-medium-emphasis text-body h-10 px-2 border rounded bg-surface-1 focus:outline-none focus:border-primary'
export default { export default {
props: { props: {

View File

@@ -21,7 +21,7 @@
import HelperText from '@/components/HelperText' import HelperText from '@/components/HelperText'
const defaultClasses = const defaultClasses =
'w-full border-medium-emphasis text-body max-w-lg px-2 border rounded bg-surface-1 focus:outline-none focus:border-primary' 'w-full border-medium-emphasis text-body px-2 border rounded bg-surface-1 focus:outline-none focus:border-primary'
export default { export default {
props: { props: {

View File

@@ -16,16 +16,24 @@
@endif @endif
@if(file_exists($theme = storage_path('app/public/theme.css'))) @if(file_exists($theme = storage_path('app/public/theme.css')))
<link href="{{ asset('storage/theme.css') }}?v={{ md5_file($theme) }}" rel="stylesheet"></link> <link href="{{ asset('storage/theme.css') }}?v={{ md5_file($theme) }}" rel="stylesheet"/>
@endif @endif
@if($logo = setting('logo')) @if($logo = setting('logo'))
<link rel="icon" type="image/x-icon" href="{{ $logo }}"> <link rel="icon" type="image/x-icon" href="{{ $logo }}">
@endif @endif
@if(view()->exists('header'))
{!! view('header')->render() !!}
@endif
@routes @routes
</head> </head>
<body> <body>
@inertia @inertia
@if(view()->exists('footer'))
{!! view('footer')->render() !!}
@endif
</body> </body>
</html> </html>

0
storage/views/.gitkeep Normal file
View File