initial commit
This commit is contained in:
31
resources/views/ip-pools/create.blade.php
Normal file
31
resources/views/ip-pools/create.blade.php
Normal file
@@ -0,0 +1,31 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'IP-Pool')
|
||||
@section('heading', 'Neuer IP-Pool')
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('ip-pools.store') }}" class="max-w-lg space-y-4 rounded-xl border border-slate-800 bg-slate-900/60 p-6">
|
||||
@csrf
|
||||
<label class="block"><span class="text-sm text-slate-400">Name</span>
|
||||
<input name="name" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">Typ</span>
|
||||
<select name="type" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2">
|
||||
@foreach($types as $type)<option value="{{ $type->value }}">{{ $type->label() }}</option>@endforeach
|
||||
</select></label>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<label class="block"><span class="text-sm text-slate-400">Start-IP</span>
|
||||
<input name="start_ip" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">End-IP</span>
|
||||
<input name="end_ip" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
</div>
|
||||
<label class="block"><span class="text-sm text-slate-400">Gateway</span>
|
||||
<input name="gateway" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">CIDR</span>
|
||||
<input type="number" name="cidr" value="24" min="8" max="32" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">Beschreibung</span>
|
||||
<textarea name="description" rows="2" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2"></textarea></label>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="is_active" value="1" checked class="rounded text-cyan-500"> Aktiv
|
||||
</label>
|
||||
<button class="rounded-lg bg-cyan-600 px-6 py-2 font-medium hover:bg-cyan-500">Erstellen</button>
|
||||
</form>
|
||||
@endsection
|
||||
35
resources/views/ip-pools/edit.blade.php
Normal file
35
resources/views/ip-pools/edit.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'IP-Pool')
|
||||
@section('heading', 'Pool bearbeiten')
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ route('ip-pools.update', $pool) }}" class="max-w-lg space-y-4 rounded-xl border border-slate-800 bg-slate-900/60 p-6">
|
||||
@csrf @method('PUT')
|
||||
<label class="block"><span class="text-sm text-slate-400">Name</span>
|
||||
<input name="name" value="{{ old('name', $pool->name) }}" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">Typ</span>
|
||||
<select name="type" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2">
|
||||
@foreach($types as $type)
|
||||
<option value="{{ $type->value }}" @selected(old('type', $pool->type->value) === $type->value)>{{ $type->label() }}</option>
|
||||
@endforeach
|
||||
</select></label>
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<label class="block"><span class="text-sm text-slate-400">Start-IP</span>
|
||||
<input name="start_ip" value="{{ old('start_ip', $pool->start_ip) }}" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">End-IP</span>
|
||||
<input name="end_ip" value="{{ old('end_ip', $pool->end_ip) }}" required class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
</div>
|
||||
<label class="block"><span class="text-sm text-slate-400">Gateway</span>
|
||||
<input name="gateway" value="{{ old('gateway', $pool->gateway) }}" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 font-mono"></label>
|
||||
<label class="block"><span class="text-sm text-slate-400">CIDR</span>
|
||||
<input type="number" name="cidr" value="{{ old('cidr', $pool->cidr) }}" class="mt-1 w-full rounded-lg border border-slate-700 bg-slate-800 px-3 py-2"></label>
|
||||
<label class="flex items-center gap-2 text-sm">
|
||||
<input type="checkbox" name="is_active" value="1" @checked(old('is_active', $pool->is_active)) class="rounded text-cyan-500"> Aktiv
|
||||
</label>
|
||||
<button class="rounded-lg bg-cyan-600 px-6 py-2 font-medium hover:bg-cyan-500">Speichern</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ route('ip-pools.destroy', $pool) }}" class="mt-4" onsubmit="return confirm('Pool löschen?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="rounded-lg border border-red-800 px-4 py-2 text-sm text-red-400">Pool löschen</button>
|
||||
</form>
|
||||
@endsection
|
||||
64
resources/views/ip-pools/index.blade.php
Normal file
64
resources/views/ip-pools/index.blade.php
Normal file
@@ -0,0 +1,64 @@
|
||||
@extends('layouts.app')
|
||||
@section('title', 'IP-Pools')
|
||||
@section('heading', 'IP-Pools & Zuweisungen')
|
||||
|
||||
@section('content')
|
||||
@if(auth()->user()->isAdmin())
|
||||
<a href="{{ route('ip-pools.create') }}" class="mb-6 inline-block rounded-lg bg-cyan-600 px-4 py-2 text-sm font-medium hover:bg-cyan-500">+ Pool anlegen</a>
|
||||
@endif
|
||||
|
||||
<div class="mb-8 grid gap-4 md:grid-cols-2">
|
||||
@foreach($pools as $pool)
|
||||
<div class="rounded-xl border border-slate-800 bg-slate-900/60 p-5">
|
||||
<div class="flex items-start justify-between">
|
||||
<div>
|
||||
<h3 class="font-semibold">{{ $pool->name }}</h3>
|
||||
<span class="text-xs {{ $pool->type->value === 'public' ? 'text-violet-400' : 'text-cyan-400' }}">{{ $pool->type->label() }}</span>
|
||||
</div>
|
||||
@if(auth()->user()->isAdmin())
|
||||
<a href="{{ route('ip-pools.edit', $pool) }}" class="text-xs text-slate-400 hover:text-white">Bearbeiten</a>
|
||||
@endif
|
||||
</div>
|
||||
<p class="mt-2 font-mono text-sm text-slate-400">{{ $pool->start_ip }} – {{ $pool->end_ip }}</p>
|
||||
<p class="mt-1 text-xs text-slate-500">Gateway: {{ $pool->gateway ?? '—' }} /{{ $pool->cidr }}</p>
|
||||
<div class="mt-3">
|
||||
<div class="flex justify-between text-xs text-slate-400 mb-1">
|
||||
<span>{{ $pool->usedIpsCount() }} belegt</span>
|
||||
<span>{{ $pool->freeIpsCount() }} frei</span>
|
||||
</div>
|
||||
<div class="h-2 rounded-full bg-slate-800">
|
||||
<div class="h-full rounded-full {{ $pool->type->value === 'public' ? 'bg-violet-500' : 'bg-cyan-500' }}" style="width: {{ $pool->usage_percent }}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
<h2 class="mb-4 text-lg font-semibold">IP-Zuweisungen (aktive VMs)</h2>
|
||||
<div class="overflow-hidden rounded-xl border border-slate-800">
|
||||
<table class="w-full text-left text-sm">
|
||||
<thead class="bg-slate-900 text-slate-400">
|
||||
<tr>
|
||||
<th class="px-4 py-3">VM</th>
|
||||
@if(auth()->user()->isAdmin())<th class="px-4 py-3">Kunde</th>@endif
|
||||
<th class="px-4 py-3">Private IP</th>
|
||||
<th class="px-4 py-3">Public IP</th>
|
||||
<th class="px-4 py-3">Pool</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-800">
|
||||
@forelse($assignments as $vm)
|
||||
<tr>
|
||||
<td class="px-4 py-3"><a href="{{ route('vms.show', $vm) }}" class="text-cyan-400 hover:underline">{{ $vm->name }}</a></td>
|
||||
@if(auth()->user()->isAdmin())<td class="px-4 py-3 text-slate-400">{{ $vm->owner?->name }}</td>@endif
|
||||
<td class="px-4 py-3 font-mono">{{ $vm->ip_address ?? '—' }}</td>
|
||||
<td class="px-4 py-3 font-mono text-violet-400">{{ $vm->public_ip ?? '—' }}</td>
|
||||
<td class="px-4 py-3">{{ $vm->ipPool?->name ?? '—' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="5" class="px-4 py-8 text-center text-slate-500">Keine Zuweisungen.</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user