From 8daad8f8b8ee8945f61e864dd7b4ae10a88ad228 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 16 Jun 2023 12:00:36 +0200 Subject: [PATCH] fixes --- app/Models/GithubApp.php | 4 +++ app/Models/GitlabApp.php | 4 +++ app/Models/PrivateKey.php | 3 ++ app/Models/Server.php | 5 ++-- resources/css/app.css | 5 +++- .../views/components/forms/input.blade.php | 29 ++++++++++--------- .../views/components/layout-simple.blade.php | 29 ++++++++++++++----- resources/views/components/layout.blade.php | 18 ++++++++++++ .../environment-variable/all.blade.php | 2 +- .../environment-variable/show.blade.php | 2 +- .../views/livewire/server/proxy.blade.php | 1 - routes/web.php | 6 ++-- 12 files changed, 78 insertions(+), 30 deletions(-) diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.php index ff7d30fac..54e68aa63 100644 --- a/app/Models/GithubApp.php +++ b/app/Models/GithubApp.php @@ -12,6 +12,10 @@ class GithubApp extends BaseModel 'is_public' => 'boolean', 'type' => 'string' ]; + protected $hidden = [ + 'client_secret', + 'webhook_secret', + ]; protected static function booted(): void { static::deleting(function (GithubApp $github_app) { diff --git a/app/Models/GitlabApp.php b/app/Models/GitlabApp.php index 5e52dc00c..dbac3414b 100644 --- a/app/Models/GitlabApp.php +++ b/app/Models/GitlabApp.php @@ -4,6 +4,10 @@ class GitlabApp extends BaseModel { + protected $hidden = [ + 'webhook_token', + 'app_secret', + ]; public function applications() { return $this->morphMany(Application::class, 'source'); diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php index c2954201e..732157ccc 100644 --- a/app/Models/PrivateKey.php +++ b/app/Models/PrivateKey.php @@ -11,6 +11,9 @@ class PrivateKey extends BaseModel 'private_key', 'team_id', ]; + protected $hidden = [ + 'private_key', + ]; static public function ownedByCurrentTeam() { return PrivateKey::whereTeamId(session('currentTeam')->id); diff --git a/app/Models/Server.php b/app/Models/Server.php index d6d4b8e76..84596ea71 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -74,9 +74,10 @@ public function settings() { return $this->hasOne(ServerSetting::class); } - static public function ownedByCurrentTeam() + static public function ownedByCurrentTeam(array $select = ['*']) { - return Server::whereTeamId(session('currentTeam')->id); + $selectArray = collect($select)->concat(['id']); + return Server::whereTeamId(session('currentTeam')->id)->with('settings')->select($selectArray->all()); } static public function validated() diff --git a/resources/css/app.css b/resources/css/app.css index 91012c573..bc75a7fa5 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -15,7 +15,10 @@ .main { @apply pl-24 pr-10 mx-auto max-w-screen-xl pt-4; } input { - @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded bg-coolgray-200 w-full read-only:bg-coolgray-200/50 read-only:text-opacity-25 border-none; + @apply input input-sm h-7 outline-none placeholder:text-neutral-700 text-white rounded bg-coolgray-200 w-full read-only:bg-coolgray-200/50 read-only:text-opacity-25; +} +input && :not(input[type="checkbox"]) { + @apply border-none; } input[type="checkbox"] { @apply toggle toggle-warning toggle-xs rounded; diff --git a/resources/views/components/forms/input.blade.php b/resources/views/components/forms/input.blade.php index c3c85d828..78d07a602 100644 --- a/resources/views/components/forms/input.blade.php +++ b/resources/views/components/forms/input.blade.php @@ -15,20 +15,21 @@
@if ($type === 'password') -
- isNotEmpty()) type={{ $type }} - id={{ $id }} name={{ $name }} value={{ $value }} - placeholder={{ $placeholder }}> - @if ($cannotPeakPassword) - - $disabled || $readonly, - 'bg-coolgray-200 hover:bg-coolgray-200' => !$disabled || !$readonly, - ])> +
+ isNotEmpty()) type={{ $type }} id={{ $id }} + name={{ $name }} @isset($value) value={{ $value }} @endisset + @isset($placeholder) placeholder={{ $placeholder }} @endisset> + @if (!$cannotPeakPassword) + + $disabled || $readonly, + 'bg-coolgray-200 hover:bg-coolgray-200' => !$disabled || !$readonly, + ])> diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.php index fade33a76..ed4ff0131 100644 --- a/resources/views/components/layout.blade.php +++ b/resources/views/components/layout.blade.php @@ -40,6 +40,24 @@ let checkHealthInterval = null; let checkIfIamDeadInterval = null; + function changePasswordFieldType(event) { + const element = event.target.parentElement.parentElement.children[0]; + if (element.nodeName === 'INPUT') { + if (element.type === 'password') { + element.type = 'text'; + } else { + element.type = 'password'; + } + } + if (element.nodeName === 'DIV') { + if (element.children[0].type === 'password') { + element.children[0].type = 'text'; + } else { + element.children[0].type = 'password'; + } + } + } + function revive() { console.log('Checking server\'s health...') checkHealthInterval = setInterval(() => { diff --git a/resources/views/livewire/project/application/environment-variable/all.blade.php b/resources/views/livewire/project/application/environment-variable/all.blade.php index b6d89ad1c..e55013ca0 100644 --- a/resources/views/livewire/project/application/environment-variable/all.blade.php +++ b/resources/views/livewire/project/application/environment-variable/all.blade.php @@ -8,7 +8,7 @@ :env="$env" /> @endforeach
- +

Preview Deployments

diff --git a/resources/views/livewire/project/application/environment-variable/show.blade.php b/resources/views/livewire/project/application/environment-variable/show.blade.php index eda3afdeb..30a172a88 100644 --- a/resources/views/livewire/project/application/environment-variable/show.blade.php +++ b/resources/views/livewire/project/application/environment-variable/show.blade.php @@ -1,7 +1,7 @@
- +
diff --git a/resources/views/livewire/server/proxy.blade.php b/resources/views/livewire/server/proxy.blade.php index d6e1b2aad..565761852 100644 --- a/resources/views/livewire/server/proxy.blade.php +++ b/resources/views/livewire/server/proxy.blade.php @@ -7,7 +7,6 @@
- @isset($proxy_settings) @if ($selectedProxy->value === 'TRAEFIK_V2') diff --git a/routes/web.php b/routes/web.php index 0c8a9c9ee..ffa705224 100644 --- a/routes/web.php +++ b/routes/web.php @@ -70,17 +70,17 @@ 'private_keys' => PrivateKey::ownedByCurrentTeam()->get(), ]))->name('server.create'); Route::get('/server/{server_uuid}', fn () => view('server.show', [ - 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(), + 'server' => Server::ownedByCurrentTeam(['name', 'description', 'ip', 'port', 'user'])->whereUuid(request()->server_uuid)->firstOrFail(), ]))->name('server.show'); Route::get('/server/{server_uuid}/proxy', fn () => view('server.proxy', [ - 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(), + 'server' => Server::ownedByCurrentTeam(['name', 'extra_attributes'])->whereUuid(request()->server_uuid)->firstOrFail(), ]))->name('server.proxy'); Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key', [ 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(), 'privateKeys' => PrivateKey::ownedByCurrentTeam()->get(), ]))->name('server.private-key'); Route::get('/server/{server_uuid}/destinations', fn () => view('server.destinations', [ - 'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail() + 'server' => Server::ownedByCurrentTeam(['name'])->whereUuid(request()->server_uuid)->firstOrFail() ]))->name('server.destinations'); });