fix: add navbar for source + keys

This commit is contained in:
Andras Bacsai 2023-09-04 09:44:44 +02:00
parent 517cb77637
commit 3e3024d47e
15 changed files with 72 additions and 30 deletions

View File

@ -27,7 +27,7 @@ public function delete()
if ($this->private_key->isEmpty()) { if ($this->private_key->isEmpty()) {
$this->private_key->delete(); $this->private_key->delete();
currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get(); currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get();
return redirect()->route('private-key.all'); return redirect()->route('security.private-key.index');
} }
$this->emit('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.'); $this->emit('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.');
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -593,7 +593,7 @@ async function redirect() {
targetUrl.pathname = `/source/new` targetUrl.pathname = `/source/new`
break; break;
case 7: case 7:
targetUrl.pathname = `/private-key/new` targetUrl.pathname = `/security/private-key/new`
break; break;
case 8: case 8:
targetUrl.pathname = `/destination/new` targetUrl.pathname = `/destination/new`
@ -612,7 +612,7 @@ async function redirect() {
targetUrl.pathname = `/servers` targetUrl.pathname = `/servers`
break; break;
case 13: case 13:
targetUrl.pathname = `/private-keys` targetUrl.pathname = `/security/private-key`
break; break;
case 14: case 14:
targetUrl.pathname = `/projects` targetUrl.pathname = `/projects`

View File

@ -50,6 +50,23 @@ class="{{ request()->is('command-center') ? 'text-warning icon' : 'icon' }}" vie
</svg> </svg>
</a> </a>
</li> </li>
<li title="Source">
<a class="hover:bg-transparent" href="{{ route('source.all') }}">
<svg class="icon" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
d="m6.793 1.207l.353.354l-.353-.354ZM1.207 6.793l-.353-.354l.353.354Zm0 1.414l.354-.353l-.354.353Zm5.586 5.586l-.354.353l.354-.353Zm1.414 0l-.353-.354l.353.354Zm5.586-5.586l.353.354l-.353-.354Zm0-1.414l-.354.353l.354-.353ZM8.207 1.207l.354-.353l-.354.353ZM6.44.854L.854 6.439l.707.707l5.585-5.585L6.44.854ZM.854 8.56l5.585 5.585l.707-.707l-5.585-5.585l-.707.707Zm7.707 5.585l5.585-5.585l-.707-.707l-5.585 5.585l.707.707Zm5.585-7.707L8.561.854l-.707.707l5.585 5.585l.707-.707Zm0 2.122a1.5 1.5 0 0 0 0-2.122l-.707.707a.5.5 0 0 1 0 .708l.707.707ZM6.44 14.146a1.5 1.5 0 0 0 2.122 0l-.707-.707a.5.5 0 0 1-.708 0l-.707.707ZM.854 6.44a1.5 1.5 0 0 0 0 2.122l.707-.707a.5.5 0 0 1 0-.708L.854 6.44Zm6.292-4.878a.5.5 0 0 1 .708 0L8.56.854a1.5 1.5 0 0 0-2.122 0l.707.707Zm-2 1.293l1 1l.708-.708l-1-1l-.708.708ZM7.5 5a.5.5 0 0 1-.5-.5H6A1.5 1.5 0 0 0 7.5 6V5Zm.5-.5a.5.5 0 0 1-.5.5v1A1.5 1.5 0 0 0 9 4.5H8ZM7.5 4a.5.5 0 0 1 .5.5h1A1.5 1.5 0 0 0 7.5 3v1Zm0-1A1.5 1.5 0 0 0 6 4.5h1a.5.5 0 0 1 .5-.5V3Zm.646 2.854l1.5 1.5l.707-.708l-1.5-1.5l-.707.708ZM10.5 8a.5.5 0 0 1-.5-.5H9A1.5 1.5 0 0 0 10.5 9V8Zm.5-.5a.5.5 0 0 1-.5.5v1A1.5 1.5 0 0 0 12 7.5h-1Zm-.5-.5a.5.5 0 0 1 .5.5h1A1.5 1.5 0 0 0 10.5 6v1Zm0-1A1.5 1.5 0 0 0 9 7.5h1a.5.5 0 0 1 .5-.5V6ZM7 5.5v4h1v-4H7Zm.5 5.5a.5.5 0 0 1-.5-.5H6A1.5 1.5 0 0 0 7.5 12v-1Zm.5-.5a.5.5 0 0 1-.5.5v1A1.5 1.5 0 0 0 9 10.5H8Zm-.5-.5a.5.5 0 0 1 .5.5h1A1.5 1.5 0 0 0 7.5 9v1Zm0-1A1.5 1.5 0 0 0 6 10.5h1a.5.5 0 0 1 .5-.5V9Z" />
</svg>
</a>
</li>
<li title="Security">
<a class="hover:bg-transparent" href="{{ route('security.private-key.index') }}">
<svg class="icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
stroke-width="2"
d="m16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1-4.069 0l-.301-.301l-6.558 6.558a2 2 0 0 1-1.239.578L5.172 21H4a1 1 0 0 1-.993-.883L3 20v-1.172a2 2 0 0 1 .467-1.284l.119-.13L4 17h2v-2h2v-2l2.144-2.144l-.301-.301a2.877 2.877 0 0 1 0-4.069l2.643-2.643a2.877 2.877 0 0 1 4.069 0zM15 9h.01" />
</svg>
</a>
</li>
<li title="Teams"> <li title="Teams">
<a class="hover:bg-transparent" href="{{ route('team.index') }}"> <a class="hover:bg-transparent" href="{{ route('team.index') }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5" <svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24" stroke-width="1.5"
@ -64,6 +81,7 @@ class="{{ request()->is('command-center') ? 'text-warning icon' : 'icon' }}" vie
</svg> </svg>
</a> </a>
</li> </li>
<div class="flex-1"></div> <div class="flex-1"></div>
@if (isInstanceAdmin() && !isCloud()) @if (isInstanceAdmin() && !isCloud())
<livewire:upgrade /> <livewire:upgrade />

View File

@ -0,0 +1,17 @@
<div class="pb-6">
<h1>Security</h1>
<nav class="flex pt-2 pb-10">
<ol class="inline-flex items-center">
<li>
<div class="flex items-center">
<span>Security related settings</span>
</div>
</li>
</ol>
</nav>
<nav class="navbar-main">
<a class="{{ request()->routeIs('security.private-key.index') ? 'text-white' : '' }}" href="{{ route('security.private-key.index') }}">
<button>Private Keys</button>
</a>
</nav>
</div>

View File

@ -6,7 +6,7 @@
</x-modal> </x-modal>
<form class="flex flex-col gap-2" wire:submit.prevent='changePrivateKey'> <form class="flex flex-col gap-2" wire:submit.prevent='changePrivateKey'>
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<h1>Private Key</h1> <h2>Private Key</h2>
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
</x-forms.button> </x-forms.button>
@ -16,7 +16,6 @@
</x-forms.button> </x-forms.button>
@endif @endif
</div> </div>
<div class="pb-8">Private Key used for SSH connection</div>
<x-forms.input id="private_key.name" label="Name" required /> <x-forms.input id="private_key.name" label="Name" required />
<x-forms.input id="private_key.description" label="Description" /> <x-forms.input id="private_key.description" label="Description" />
<div> <div>

View File

@ -1,7 +1,7 @@
<div> <div>
<div class="flex items-end gap-2 pb-6 "> <div class="flex items-end gap-2 pb-6 ">
<h2>Private Key</h2> <h2>Private Key</h2>
<a href="{{ route('private-key.new') }}"> <a href="{{ route('security.private-key.new') }}">
<x-forms.button>Add a new Private Key</x-forms.button> <x-forms.button>Add a new Private Key</x-forms.button>
</a> </a>
<x-forms.button wire:click.prevent='checkConnection'> <x-forms.button wire:click.prevent='checkConnection'>
@ -13,7 +13,7 @@
@if (data_get($server, 'privateKey.uuid')) @if (data_get($server, 'privateKey.uuid'))
<div> <div>
Currently attached Private Key: Currently attached Private Key:
<a href="{{ route('private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}"> <a href="{{ route('security.private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}">
<button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button> <button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button>
</a> </a>
</div> </div>

View File

@ -1,5 +0,0 @@
<x-layout>
<h1>Create a new Private Key</h1>
<div class="subtitle ">Private Keys are used for connection to servers.</div>
<livewire:private-key.create />
</x-layout>

View File

@ -0,0 +1,9 @@
<x-layout>
<x-security.navbar />
<a class="text-center hover:no-underline group"
href="{{ route('security.private-key.index')}}">
<div class="group-hover:text-white">
<div>Private Keys</div>
</div>
</a>
</x-layout>

View File

@ -1,10 +1,13 @@
<x-layout> <x-layout>
<h1>Private Keys</h1> <x-security.navbar />
<div class="subtitle ">All Private Keys</div> <div class="flex gap-2">
<h2 class="pb-4">Private Keys</h2>
<a href="{{ route('security.private-key.new') }}"><x-forms.button>+ Add</x-forms.button></a>
</div>
<div class="grid gap-2 lg:grid-cols-2"> <div class="grid gap-2 lg:grid-cols-2">
@forelse ($privateKeys as $key) @forelse ($privateKeys as $key)
<a class="text-center hover:no-underline box group" <a class="text-center hover:no-underline box group"
href="{{ route('private-key.show', ['private_key_uuid' => data_get($key, 'uuid')]) }}"> href="{{ route('security.private-key.show', ['private_key_uuid' => data_get($key, 'uuid')]) }}">
<div class="group-hover:text-white"> <div class="group-hover:text-white">
<div>{{ $key->name }}</div> <div>{{ $key->name }}</div>
</div> </div>
@ -12,7 +15,7 @@
@empty @empty
<div> <div>
<div>No private keys found.</div> <div>No private keys found.</div>
<x-use-magic-bar link="/private-key/new" /> <x-use-magic-bar link="/security/private-key/new" />
</div> </div>
@endforelse @endforelse
</div> </div>

View File

@ -0,0 +1,5 @@
<x-layout>
<h1>Create a new Private Key</h1>
<div class="subtitle ">Private Keys are used to connect to your servers without passwords.</div>
<livewire:private-key.create />
</x-layout>

View File

@ -1,3 +1,4 @@
<x-layout> <x-layout>
<x-security.navbar />
<livewire:private-key.change :private_key="$private_key" /> <livewire:private-key.change :private_key="$private_key" />
</x-layout> </x-layout>

View File

@ -1,7 +1,5 @@
<x-layout> <x-layout>
<x-team.navbar :team="auth() <x-team.navbar />
->user()
->currentTeam()" />
<livewire:team.form /> <livewire:team.form />
@if (isCloud()) @if (isCloud())
<div class="pb-8"> <div class="pb-8">

View File

@ -1,7 +1,5 @@
<x-layout> <x-layout>
<x-team.navbar :team="auth() <x-team.navbar />
->user()
->currentTeam()" />
<h2>Members</h2> <h2>Members</h2>
<div class="pt-4 overflow-hidden"> <div class="pt-4 overflow-hidden">
<table> <table>

View File

@ -1,7 +1,5 @@
<x-layout> <x-layout>
<x-team.navbar :team="auth() <x-team.navbar/>
->user()
->currentTeam()" />
<h2 class="pb-4">Notifications</h2> <h2 class="pb-4">Notifications</h2>
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full"> <div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'email' }" class="flex h-full">
<div class="flex flex-col gap-4 min-w-fit"> <div class="flex flex-col gap-4 min-w-fit">

View File

@ -121,13 +121,14 @@
}); });
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {
Route::get('/private-keys', fn () => view('private-key.all', [ Route::get('/security', fn () => view('security.index'))->name('security.index');
Route::get('/security/private-key', fn () => view('security.private-key.index', [
'privateKeys' => PrivateKey::ownedByCurrentTeam(['name', 'uuid', 'is_git_related'])->where('is_git_related', false)->get() 'privateKeys' => PrivateKey::ownedByCurrentTeam(['name', 'uuid', 'is_git_related'])->where('is_git_related', false)->get()
]))->name('private-key.all'); ]))->name('security.private-key.index');
Route::get('/private-key/new', fn () => view('private-key.new'))->name('private-key.new'); Route::get('/security/private-key/new', fn () => view('security.private-key.new'))->name('security.private-key.new');
Route::get('/private-key/{private_key_uuid}', fn () => view('private-key.show', [ Route::get('/security/private-key/{private_key_uuid}', fn () => view('security.private-key.show', [
'private_key' => PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail() 'private_key' => PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail()
]))->name('private-key.show'); ]))->name('security.private-key.show');
}); });