feat: Netzwerk-Segmentverwaltung, Dashboard, globale Suche v0.6.0

This commit is contained in:
2026-07-01 18:46:49 +02:00
parent 402537805d
commit 9fa20af87a
17 changed files with 1006 additions and 60 deletions
@@ -0,0 +1,65 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center space-x-2">
<a href="{{ route('network.segments.index') }}" class="text-gray-500 hover:text-gray-700">Segmente</a>
<span class="text-gray-400">/</span>
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200">Neues Segment</h2>
</div>
</x-slot>
<div class="py-8">
<div class="max-w-xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-lg p-6">
<form method="POST" action="{{ route('network.segments.store') }}" class="space-y-5">
@csrf
<div>
<x-input-label for="name" value="Name *" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full"
value="{{ old('name') }}" placeholder="z.B. Büro, Server-VLAN, Produktion" required />
<x-input-error :messages="$errors->get('name')" class="mt-1" />
</div>
<div>
<x-input-label for="subnet" value="Subnetz *" />
<x-text-input id="subnet" name="subnet" type="text" class="mt-1 block w-full font-mono"
value="{{ old('subnet') }}" placeholder="z.B. 192.168.1.0/24 oder 10.0.0.0/8" required />
<x-input-error :messages="$errors->get('subnet')" class="mt-1" />
</div>
<div>
<x-input-label for="vlan_id" value="VLAN-ID (optional)" />
<x-text-input id="vlan_id" name="vlan_id" type="number" class="mt-1 block w-full"
value="{{ old('vlan_id') }}" placeholder="z.B. 10" min="1" max="4094" />
<x-input-error :messages="$errors->get('vlan_id')" class="mt-1" />
</div>
<div>
<x-input-label for="description" value="Beschreibung (optional)" />
<textarea id="description" name="description" rows="2"
class="mt-1 block w-full border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 rounded-md shadow-sm text-sm focus:ring-indigo-500 focus:border-indigo-500"
placeholder="Kurze Beschreibung dieses Segments...">{{ old('description') }}</textarea>
</div>
<div class="flex items-center gap-2">
<input type="checkbox" id="active" name="active" value="1"
{{ old('active', '1') ? 'checked' : '' }}
class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" />
<label for="active" class="text-sm text-gray-700 dark:text-gray-300">Aktiv (automatisch überwachen)</label>
</div>
<div class="flex justify-end gap-3">
<a href="{{ route('network.segments.index') }}"
class="px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 transition">
Abbrechen
</a>
<button type="submit" style="background-color: var(--color-primary)"
class="px-5 py-2 text-white text-sm font-medium rounded-md hover:opacity-90 transition">
Segment anlegen
</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,64 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center space-x-2">
<a href="{{ route('network.segments.index') }}" class="text-gray-500 hover:text-gray-700">Segmente</a>
<span class="text-gray-400">/</span>
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200">{{ $segment->name }} bearbeiten</h2>
</div>
</x-slot>
<div class="py-8">
<div class="max-w-xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-lg p-6">
<form method="POST" action="{{ route('network.segments.update', $segment) }}" class="space-y-5">
@csrf @method('PUT')
<div>
<x-input-label for="name" value="Name *" />
<x-text-input id="name" name="name" type="text" class="mt-1 block w-full"
value="{{ old('name', $segment->name) }}" required />
<x-input-error :messages="$errors->get('name')" class="mt-1" />
</div>
<div>
<x-input-label for="subnet" value="Subnetz *" />
<x-text-input id="subnet" name="subnet" type="text" class="mt-1 block w-full font-mono"
value="{{ old('subnet', $segment->subnet) }}" required />
<x-input-error :messages="$errors->get('subnet')" class="mt-1" />
</div>
<div>
<x-input-label for="vlan_id" value="VLAN-ID (optional)" />
<x-text-input id="vlan_id" name="vlan_id" type="number" class="mt-1 block w-full"
value="{{ old('vlan_id', $segment->vlan_id) }}" min="1" max="4094" />
<x-input-error :messages="$errors->get('vlan_id')" class="mt-1" />
</div>
<div>
<x-input-label for="description" value="Beschreibung (optional)" />
<textarea id="description" name="description" rows="2"
class="mt-1 block w-full border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 rounded-md shadow-sm text-sm focus:ring-indigo-500 focus:border-indigo-500">{{ old('description', $segment->description) }}</textarea>
</div>
<div class="flex items-center gap-2">
<input type="checkbox" id="active" name="active" value="1"
{{ old('active', $segment->active) ? 'checked' : '' }}
class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500" />
<label for="active" class="text-sm text-gray-700 dark:text-gray-300">Aktiv</label>
</div>
<div class="flex justify-end gap-3">
<a href="{{ route('network.segments.index') }}"
class="px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 transition">
Abbrechen
</a>
<button type="submit" style="background-color: var(--color-primary)"
class="px-5 py-2 text-white text-sm font-medium rounded-md hover:opacity-90 transition">
Speichern
</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,77 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<a href="{{ route('network.dashboard') }}" class="text-gray-500 hover:text-gray-700">Netzwerk</a>
<span class="text-gray-400">/</span>
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200">Segmente</h2>
</div>
<a href="{{ route('network.segments.create') }}" style="background-color: var(--color-primary)"
class="px-4 py-2 text-white text-sm font-medium rounded-md hover:opacity-90 transition">
+ Segment anlegen
</a>
</div>
</x-slot>
<div class="py-8">
<div class="max-w-5xl mx-auto sm:px-6 lg:px-8">
@if(session('success'))
<div class="mb-4 p-4 bg-green-100 text-green-800 rounded-md">{{ session('success') }}</div>
@endif
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-lg overflow-hidden">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 text-sm">
<thead class="bg-gray-50 dark:bg-gray-700">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Aktiv</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Name</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Subnetz</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">VLAN</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Scans</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Beschreibung</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-gray-700">
@forelse($segments as $segment)
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition">
<td class="px-4 py-3">
<span class="inline-block w-2.5 h-2.5 rounded-full {{ $segment->active ? 'bg-green-500' : 'bg-gray-300' }}"></span>
</td>
<td class="px-4 py-3 font-medium text-gray-900 dark:text-gray-100">
<a href="{{ route('network.segments.show', $segment) }}" class="hover:text-indigo-600">
{{ $segment->name }}
</a>
</td>
<td class="px-4 py-3 font-mono text-xs text-gray-600 dark:text-gray-400">{{ $segment->subnet }}</td>
<td class="px-4 py-3 text-xs text-gray-500 dark:text-gray-400">
{{ $segment->vlan_id ? 'VLAN ' . $segment->vlan_id : '—' }}
</td>
<td class="px-4 py-3 text-xs text-gray-500 dark:text-gray-400">{{ $segment->scans_count }}</td>
<td class="px-4 py-3 text-xs text-gray-500 dark:text-gray-400 max-w-xs truncate">
{{ $segment->description ?? '—' }}
</td>
<td class="px-4 py-3 text-right space-x-3">
<a href="{{ route('network.segments.edit', $segment) }}"
class="text-xs text-indigo-600 hover:underline">Bearbeiten</a>
<form method="POST" action="{{ route('network.segments.destroy', $segment) }}"
class="inline" onsubmit="return confirm('Segment löschen?')">
@csrf @method('DELETE')
<button type="submit" class="text-xs text-red-500 hover:underline">Löschen</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-10 text-center text-gray-500">
Noch keine Segmente. <a href="{{ route('network.segments.create') }}" class="text-indigo-600 hover:underline">Jetzt anlegen</a>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</x-app-layout>
@@ -0,0 +1,115 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<a href="{{ route('network.segments.index') }}" class="text-gray-500 hover:text-gray-700">Segmente</a>
<span class="text-gray-400">/</span>
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200">{{ $segment->name }}</h2>
</div>
<div class="flex gap-2">
<a href="{{ route('network.import') }}?segment={{ $segment->id }}"
style="background-color: var(--color-primary)"
class="px-4 py-2 text-white text-sm font-medium rounded-md hover:opacity-90 transition">
+ Scan importieren
</a>
<a href="{{ route('network.segments.edit', $segment) }}"
class="px-4 py-2 text-sm font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 hover:bg-gray-50 transition">
Bearbeiten
</a>
</div>
</div>
</x-slot>
<div class="py-8">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
{{-- Segment-Info --}}
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Subnetz</p>
<p class="mt-1 font-mono font-bold text-gray-900 dark:text-gray-100">{{ $segment->subnet }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">VLAN</p>
<p class="mt-1 font-bold text-gray-900 dark:text-gray-100">{{ $segment->vlan_id ? 'VLAN ' . $segment->vlan_id : '—' }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Status</p>
<p class="mt-1 font-bold {{ $segment->active ? 'text-green-600' : 'text-gray-400' }}">
{{ $segment->active ? 'Aktiv' : 'Inaktiv' }}
</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Scans gesamt</p>
<p class="mt-1 font-bold text-gray-900 dark:text-gray-100">{{ $scans->total() }}</p>
</div>
</div>
@if($latestScan)
<div class="grid grid-cols-2 md:grid-cols-3 gap-4">
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Letzter Scan</p>
<p class="mt-1 font-bold text-gray-900 dark:text-gray-100">{{ $latestScan->created_at->format('d.m.Y H:i') }}</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Online / Gesamt</p>
<p class="mt-1 font-bold">
<span class="text-green-600">{{ $latestScan->online_hosts }}</span>
<span class="text-gray-400"> / {{ $latestScan->total_hosts }}</span>
</p>
</div>
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-sm p-4">
<p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wider">Neue Geräte</p>
<p class="mt-1 font-bold text-gray-900 dark:text-gray-100">{{ $latestScan->new_devices }}</p>
</div>
</div>
@endif
{{-- Scan-Historie --}}
<div class="bg-white dark:bg-gray-800 shadow-sm rounded-lg overflow-hidden">
<div class="px-5 py-4 border-b border-gray-200 dark:border-gray-700">
<h3 class="font-semibold text-gray-900 dark:text-gray-100">Scan-Historie</h3>
</div>
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700 text-sm">
<thead class="bg-gray-50 dark:bg-gray-700">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Datum</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Scanner</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Gesamt</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Online</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Neu</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase">Geändert</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-gray-700">
@forelse($scans as $scan)
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700 transition">
<td class="px-4 py-3 text-gray-700 dark:text-gray-300">{{ $scan->created_at->format('d.m.Y H:i') }}</td>
<td class="px-4 py-3 text-xs text-gray-500 dark:text-gray-400">{{ $scan->scanner ?? '—' }}</td>
<td class="px-4 py-3 text-right text-gray-700 dark:text-gray-300">{{ $scan->total_hosts }}</td>
<td class="px-4 py-3 text-right text-green-600 font-medium">{{ $scan->online_hosts }}</td>
<td class="px-4 py-3 text-right text-blue-600">{{ $scan->new_devices }}</td>
<td class="px-4 py-3 text-right text-yellow-600">{{ $scan->changed_devices }}</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('network.scan', $scan) }}"
class="text-xs text-indigo-600 hover:underline">Details </a>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-10 text-center text-gray-500">Noch keine Scans für dieses Segment.</td>
</tr>
@endforelse
</tbody>
</table>
@if($scans->hasPages())
<div class="px-4 py-3 border-t border-gray-200 dark:border-gray-700">
{{ $scans->links() }}
</div>
@endif
</div>
</div>
</div>
</x-app-layout>