This commit is contained in:
Andras Bacsai 2023-06-16 12:00:36 +02:00
parent c4c2e81701
commit 8daad8f8b8
12 changed files with 78 additions and 30 deletions

View File

@ -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) {

View File

@ -4,6 +4,10 @@
class GitlabApp extends BaseModel
{
protected $hidden = [
'webhook_token',
'app_secret',
];
public function applications()
{
return $this->morphMany(Application::class, 'source');

View File

@ -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);

View File

@ -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()

View File

@ -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;

View File

@ -15,20 +15,21 @@
<div class="w-full">
@if ($type === 'password')
<div class="w-full join" x-data>
<input class="join-item" @readonly($readonly) @disabled($disabled || $errors->isNotEmpty()) type={{ $type }}
id={{ $id }} name={{ $name }} value={{ $value }}
placeholder={{ $placeholder }}>
@if ($cannotPeakPassword)
<span x-on:click="changePasswordFieldType('{{ $id }}')" x-cloak
@class([
<div class="w-full rounded join" x-data>
<input class="join-item" wire:model.defer={{ $id }} wire:dirty.class="input-warning"
@readonly($readonly) @disabled($disabled || $errors->isNotEmpty()) type={{ $type }} id={{ $id }}
name={{ $name }} @isset($value) value={{ $value }} @endisset
@isset($placeholder) placeholder={{ $placeholder }} @endisset>
@if (!$cannotPeakPassword)
<span x-on:click="changePasswordFieldType" x-cloak @class([
'border-l-0 border-none rounded-r no-animation h-7 btn join-item btn-xs',
'bg-coolgray-200/50 hover:bg-coolgray-200/50 text-opacity-25' =>
$disabled || $readonly,
'bg-coolgray-200 hover:bg-coolgray-200' => !$disabled || !$readonly,
])><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon"
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
])><svg
xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 icon" viewBox="0 0 24 24"
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path

View File

@ -27,13 +27,28 @@
</main>
<x-version class="fixed left-2 bottom-1" />
<script>
function changePasswordFieldType(id) {
console.log(id)
const input = document.getElementById(id);
if (input.type === 'password') {
input.type = 'text';
function changePasswordFieldType(event) {
const element = event.target.parentElement.parentElement.children[0];
if (element.nodeName === 'INPUT') {
if (element.type === 'password') {
element.type = 'text';
} else {
input.type = 'password';
element.type = 'password';
}
}
if (element.nodeName === 'DIV') {
if (element.children[0].type === 'password') {
element.children[0].type = 'text';
} else {
element.children[0].type = 'password';
}
}
if (element.nodeName === 'svg') {
if (element.parentElement.parentElement.children[0].type === 'password') {
element.parentElement.parentElement.children[0].type = 'text';
} else {
element.parentElement.parentElement.children[0].type = 'password';
}
}
}
</script>

View File

@ -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(() => {

View File

@ -8,7 +8,7 @@
:env="$env" />
@endforeach
<div class="pt-2 pb-8">
<livewire:project.application.environment-varia /ble.add />
<livewire:project.application.environment-variable.add />
</div>
<div>
<h3>Preview Deployments</h3>

View File

@ -1,7 +1,7 @@
<div x-data="{ deleteEnvironment: false }">
<form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
<x-forms.input id="env.key" label="Name" />
<x-forms.input id="env.value" label="Value" />
<x-forms.input type="password" id="env.value" label="Value" />
<x-forms.checkbox disabled id="env.is_build_time" label="Build Variable?" />
<div class="flex gap-2">
<x-forms.button type="submit">

View File

@ -7,7 +7,6 @@
<div wire:loading wire:target="checkProxySettingsInSync">
<x-loading />
</div>
@isset($proxy_settings)
@if ($selectedProxy->value === 'TRAEFIK_V2')
<form wire:submit.prevent='saveConfiguration({{ $server }})'>

View File

@ -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');
});