some progress

This commit is contained in:
Doar Mihai
2026-01-17 16:42:43 +02:00
parent 030a105992
commit 3665a1d5a3
57 changed files with 5804 additions and 3 deletions
@@ -0,0 +1,148 @@
@extends('layouts.app')
@section('title', 'Add DNS Record - ' . $site->name)
@section('content')
<div class="mb-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('sites.index') }}">Sites</a></li>
<li class="breadcrumb-item"><a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a></li>
<li class="breadcrumb-item"><a href="{{ route('dns-records.index', $site) }}">DNS Records</a></li>
<li class="breadcrumb-item active">Add DNS Record</li>
</ol>
</nav>
</div>
<div class="row">
<div class="col-md-8">
<h1 class="mb-4"><i class="bi bi-plus-circle"></i> Add DNS Record</h1>
<div class="card">
<div class="card-body">
<form action="{{ route('dns-records.store', $site) }}" method="POST">
@csrf
<div class="mb-3">
<label for="domain" class="form-label">Domain Name</label>
<input type="text"
class="form-control @error('domain') is-invalid @enderror"
id="domain"
name="domain"
value="{{ old('domain') }}"
placeholder="example.com"
required>
@error('domain')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">Enter the domain name to monitor (e.g., example.com, subdomain.example.com)</div>
</div>
<div class="mb-3">
<label for="record_type" class="form-label">Record Type</label>
<select class="form-select @error('record_type') is-invalid @enderror"
id="record_type"
name="record_type"
required>
<option value="">Select record type...</option>
@foreach($recordTypes as $value => $label)
<option value="{{ $value }}" {{ old('record_type') == $value ? 'selected' : '' }}>
{{ $label }}
</option>
@endforeach
</select>
@error('record_type')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">Select the DNS record type to monitor</div>
</div>
<div class="mb-3">
<label for="expected_value" class="form-label">Expected Value (Optional)</label>
<textarea class="form-control @error('expected_value') is-invalid @enderror"
id="expected_value"
name="expected_value"
rows="3"
placeholder="e.g., 192.168.1.1 or mail.example.com">{{ old('expected_value') }}</textarea>
@error('expected_value')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">
Specify the expected value to validate against. Leave empty to only check if the record exists.
</div>
</div>
<div class="mb-3">
<div class="form-check">
<input type="checkbox"
class="form-check-input"
id="is_active"
name="is_active"
value="1"
{{ old('is_active', true) ? 'checked' : '' }}>
<label class="form-check-label" for="is_active">
Enable monitoring for this DNS record
</label>
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-check-circle"></i> Add DNS Record
</button>
<a href="{{ route('dns-records.index', $site) }}" class="btn btn-secondary">
Cancel
</a>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h5 class="mb-0"><i class="bi bi-info-circle"></i> DNS Record Types</h5>
</div>
<div class="card-body">
<dl class="small mb-0">
<dt>A</dt>
<dd>Maps domain to IPv4 address</dd>
<dt>AAAA</dt>
<dd>Maps domain to IPv6 address</dd>
<dt>CNAME</dt>
<dd>Alias to another domain</dd>
<dt>MX</dt>
<dd>Mail server records</dd>
<dt>TXT</dt>
<dd>Text records (SPF, DKIM, etc.)</dd>
<dt>NS</dt>
<dd>Name server records</dd>
<dt>SOA</dt>
<dd>Start of authority</dd>
</dl>
</div>
</div>
<div class="card mt-3">
<div class="card-header">
<h5 class="mb-0"><i class="bi bi-lightbulb"></i> Tips</h5>
</div>
<div class="card-body">
<ul class="small mb-0">
<li>DNS checks run hourly</li>
<li>Leave expected value empty to only verify record exists</li>
<li>For MX records, include priority (e.g., "10 mail.example.com")</li>
<li>Alerts are sent when records become invalid</li>
</ul>
</div>
</div>
</div>
</div>
@endsection
+142
View File
@@ -0,0 +1,142 @@
@extends('layouts.app')
@section('title', 'Edit DNS Record - ' . $site->name)
@section('content')
<div class="mb-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('sites.index') }}">Sites</a></li>
<li class="breadcrumb-item"><a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a></li>
<li class="breadcrumb-item"><a href="{{ route('dns-records.index', $site) }}">DNS Records</a></li>
<li class="breadcrumb-item active">Edit</li>
</ol>
</nav>
</div>
<div class="row">
<div class="col-md-8">
<h1 class="mb-4"><i class="bi bi-pencil"></i> Edit DNS Record</h1>
<div class="card">
<div class="card-body">
<form action="{{ route('dns-records.update', [$site, $dnsRecord]) }}" method="POST">
@csrf
@method('PUT')
<div class="mb-3">
<label for="domain" class="form-label">Domain Name</label>
<input type="text"
class="form-control @error('domain') is-invalid @enderror"
id="domain"
name="domain"
value="{{ old('domain', $dnsRecord->domain) }}"
required>
@error('domain')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">Enter the domain name to monitor</div>
</div>
<div class="mb-3">
<label for="record_type" class="form-label">Record Type</label>
<select class="form-select @error('record_type') is-invalid @enderror"
id="record_type"
name="record_type"
required>
@foreach($recordTypes as $value => $label)
<option value="{{ $value }}" {{ old('record_type', $dnsRecord->record_type) == $value ? 'selected' : '' }}>
{{ $label }}
</option>
@endforeach
</select>
@error('record_type')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">Select the DNS record type to monitor</div>
</div>
<div class="mb-3">
<label for="expected_value" class="form-label">Expected Value (Optional)</label>
<textarea class="form-control @error('expected_value') is-invalid @enderror"
id="expected_value"
name="expected_value"
rows="3"
placeholder="e.g., 192.168.1.1 or mail.example.com">{{ old('expected_value', $dnsRecord->expected_value) }}</textarea>
@error('expected_value')
<div class="invalid-feedback">{{ $message }}</div>
@enderror
<div class="form-text">
Specify the expected value to validate against. Leave empty to only check if the record exists.
</div>
</div>
<div class="mb-3">
<div class="form-check">
<input type="checkbox"
class="form-check-input"
id="is_active"
name="is_active"
value="1"
{{ old('is_active', $dnsRecord->is_active) ? 'checked' : '' }}>
<label class="form-check-label" for="is_active">
Enable monitoring for this DNS record
</label>
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-primary">
<i class="bi bi-check-circle"></i> Update DNS Record
</button>
<a href="{{ route('dns-records.show', [$site, $dnsRecord]) }}" class="btn btn-secondary">
Cancel
</a>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h5 class="mb-0"><i class="bi bi-activity"></i> Current Status</h5>
</div>
<div class="card-body">
<dl class="row mb-0">
<dt class="col-sm-5">Status:</dt>
<dd class="col-sm-7">
<span class="badge bg-{{ $dnsRecord->status_color }}">
{{ $dnsRecord->status_text }}
</span>
</dd>
<dt class="col-sm-5">Last Checked:</dt>
<dd class="col-sm-7">
@if($dnsRecord->last_checked_at)
{{ $dnsRecord->last_checked_at->diffForHumans() }}
@else
<span class="text-muted">Never</span>
@endif
</dd>
@if($dnsRecord->formatted_actual_value)
<dt class="col-sm-5">Current Value:</dt>
<dd class="col-sm-7">
<small>{{ Str::limit($dnsRecord->formatted_actual_value, 40) }}</small>
</dd>
@endif
@if($dnsRecord->error_message)
<dt class="col-sm-5">Error:</dt>
<dd class="col-sm-7">
<small class="text-danger">{{ Str::limit($dnsRecord->error_message, 40) }}</small>
</dd>
@endif
</dl>
</div>
</div>
</div>
</div>
@endsection
+109
View File
@@ -0,0 +1,109 @@
@extends('layouts.app')
@section('title', 'DNS Records - ' . $site->name)
@section('content')
<div class="mb-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('sites.index') }}">Sites</a></li>
<li class="breadcrumb-item"><a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a></li>
<li class="breadcrumb-item active">DNS Records</li>
</ol>
</nav>
</div>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1><i class="bi bi-hdd-network"></i> DNS Monitoring</h1>
<a href="{{ route('dns-records.create', $site) }}" class="btn btn-primary">
<i class="bi bi-plus-circle"></i> Add DNS Record
</a>
</div>
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
@if($dnsRecords->isEmpty())
<div class="alert alert-info">
<i class="bi bi-info-circle"></i> No DNS records are being monitored for this site yet. Click "Add DNS Record" to start monitoring.
</div>
@else
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Domain</th>
<th>Type</th>
<th>Status</th>
<th>Expected Value</th>
<th>Last Checked</th>
<th>Active</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($dnsRecords as $record)
<tr>
<td><strong>{{ $record->domain }}</strong></td>
<td>
<span class="badge bg-info">{{ $record->record_type }}</span>
</td>
<td>
<span class="badge bg-{{ $record->status_color }}">
{{ $record->status_text }}
</span>
</td>
<td>
@if($record->expected_value)
<small class="text-muted">{{ Str::limit($record->expected_value, 30) }}</small>
@else
<span class="text-muted">—</span>
@endif
</td>
<td>
@if($record->last_checked_at)
{{ $record->last_checked_at->diffForHumans() }}
@else
<span class="text-muted">Never</span>
@endif
</td>
<td>
@if($record->is_active)
<span class="badge bg-success">Active</span>
@else
<span class="badge bg-secondary">Inactive</span>
@endif
</td>
<td>
<div class="btn-group btn-group-sm">
<a href="{{ route('dns-records.show', [$site, $record]) }}"
class="btn btn-outline-primary" title="View">
<i class="bi bi-eye"></i>
</a>
<a href="{{ route('dns-records.edit', [$site, $record]) }}"
class="btn btn-outline-secondary" title="Edit">
<i class="bi bi-pencil"></i>
</a>
<form action="{{ route('dns-records.destroy', [$site, $record]) }}"
method="POST"
class="d-inline"
onsubmit="return confirm('Are you sure you want to delete this DNS record?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-outline-danger" title="Delete">
<i class="bi bi-trash"></i>
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
@endsection
+226
View File
@@ -0,0 +1,226 @@
@extends('layouts.app')
@section('title', 'DNS Record - ' . $dnsRecord->display_name . ' - ' . $site->name)
@section('content')
<div class="mb-3">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('sites.index') }}">Sites</a></li>
<li class="breadcrumb-item"><a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a></li>
<li class="breadcrumb-item"><a href="{{ route('dns-records.index', $site) }}">DNS Records</a></li>
<li class="breadcrumb-item active">{{ $dnsRecord->record_type }} - {{ $dnsRecord->domain }}</li>
</ol>
</nav>
</div>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1><i class="bi bi-hdd-network"></i> {{ $dnsRecord->record_type }} - {{ $dnsRecord->domain }}</h1>
<div class="btn-group">
<a href="{{ route('dns-records.edit', [$site, $dnsRecord]) }}" class="btn btn-outline-secondary">
<i class="bi bi-pencil"></i> Edit
</a>
<form action="{{ route('dns-records.destroy', [$site, $dnsRecord]) }}"
method="POST"
class="d-inline"
onsubmit="return confirm('Are you sure you want to delete this DNS record?');">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-outline-danger">
<i class="bi bi-trash"></i> Delete
</button>
</form>
</div>
</div>
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
@endif
<div class="row">
<div class="col-md-8">
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">DNS Record Details</h5>
</div>
<div class="card-body">
<dl class="row mb-0">
<dt class="col-sm-3">Site</dt>
<dd class="col-sm-9">
<a href="{{ route('dashboard.show', $site) }}">{{ $site->name }}</a>
<br>
<small class="text-muted">{{ $site->url }}</small>
</dd>
<dt class="col-sm-3">Domain</dt>
<dd class="col-sm-9"><strong>{{ $dnsRecord->domain }}</strong></dd>
<dt class="col-sm-3">Record Type</dt>
<dd class="col-sm-9">
<span class="badge bg-info">{{ $dnsRecord->record_type }}</span>
</dd>
<dt class="col-sm-3">Status</dt>
<dd class="col-sm-9">
<span class="badge bg-{{ $dnsRecord->status_color }}">
{{ $dnsRecord->status_text }}
</span>
</dd>
<dt class="col-sm-3">Monitoring</dt>
<dd class="col-sm-9">
@if($dnsRecord->is_active)
<span class="badge bg-success">Active</span>
@else
<span class="badge bg-secondary">Inactive</span>
@endif
</dd>
<dt class="col-sm-3">Last Checked</dt>
<dd class="col-sm-9">
@if($dnsRecord->last_checked_at)
{{ $dnsRecord->last_checked_at->format('Y-m-d H:i:s') }}
<br>
<small class="text-muted">{{ $dnsRecord->last_checked_at->diffForHumans() }}</small>
@else
<span class="text-muted">Never</span>
@endif
</dd>
<dt class="col-sm-3">Expected Value</dt>
<dd class="col-sm-9">
@if($dnsRecord->expected_value)
<code>{{ $dnsRecord->expected_value }}</code>
@else
<span class="text-muted">Not specified (only checking existence)</span>
@endif
</dd>
@if($dnsRecord->actual_value)
<dt class="col-sm-3">Actual Value(s)</dt>
<dd class="col-sm-9">
@if(is_array($dnsRecord->actual_value))
<ul class="mb-0">
@foreach($dnsRecord->actual_value as $value)
<li><code>{{ $value }}</code></li>
@endforeach
</ul>
@else
<code>{{ $dnsRecord->actual_value }}</code>
@endif
</dd>
@endif
@if($dnsRecord->error_message)
<dt class="col-sm-3">Error</dt>
<dd class="col-sm-9">
<div class="alert alert-danger mb-0">
<i class="bi bi-exclamation-triangle"></i> {{ $dnsRecord->error_message }}
</div>
</dd>
@endif
<dt class="col-sm-3">Created</dt>
<dd class="col-sm-9">
{{ $dnsRecord->created_at->format('Y-m-d H:i:s') }}
<br>
<small class="text-muted">{{ $dnsRecord->created_at->diffForHumans() }}</small>
</dd>
</dl>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">About {{ $dnsRecord->record_type }} Records</h5>
</div>
<div class="card-body">
@php
$descriptions = [
'A' => 'A records map a domain name to an IPv4 address. This is the most common type of DNS record.',
'AAAA' => 'AAAA records map a domain name to an IPv6 address, the newer version of IP addressing.',
'CNAME' => 'CNAME records create an alias from one domain name to another. They\'re often used for subdomains.',
'MX' => 'MX records specify the mail servers responsible for accepting email on behalf of your domain.',
'TXT' => 'TXT records store text information. They\'re commonly used for email authentication (SPF, DKIM, DMARC).',
'NS' => 'NS records identify the authoritative name servers for your domain.',
'SOA' => 'SOA records contain administrative information about the domain, including the primary name server.',
'PTR' => 'PTR records provide reverse DNS lookups, mapping IP addresses back to domain names.',
'SRV' => 'SRV records specify the location of services, including the hostname and port number.',
];
@endphp
<p class="mb-0">{{ $descriptions[$dnsRecord->record_type] ?? 'DNS record type for monitoring.' }}</p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card mb-3">
<div class="card-header">
<h5 class="mb-0">Current Status</h5>
</div>
<div class="card-body text-center">
<div class="mb-3">
<span class="badge bg-{{ $dnsRecord->status_color }} fs-5 px-4 py-2">
{{ $dnsRecord->status_text }}
</span>
</div>
@if($dnsRecord->is_valid === true)
<p class="text-success mb-0">
<i class="bi bi-check-circle-fill"></i> DNS record is valid
</p>
@elseif($dnsRecord->is_valid === false)
<p class="text-danger mb-0">
<i class="bi bi-x-circle-fill"></i> DNS record is invalid
</p>
@else
<p class="text-muted mb-0">
<i class="bi bi-question-circle"></i> Not yet checked
</p>
@endif
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<h5 class="mb-0">Monitoring Info</h5>
</div>
<div class="card-body">
<p class="mb-2">
<i class="bi bi-clock"></i> <strong>Check Frequency:</strong> Hourly
</p>
<p class="mb-2">
<i class="bi bi-bell"></i> <strong>Alerts:</strong> Sent when DNS becomes invalid
</p>
<p class="mb-0">
<i class="bi bi-arrow-repeat"></i> <strong>Validation:</strong>
@if($dnsRecord->expected_value)
Matches expected value
@else
Record exists
@endif
</p>
</div>
</div>
<div class="card">
<div class="card-header">
<h5 class="mb-0">Quick Actions</h5>
</div>
<div class="card-body">
<div class="d-grid gap-2">
<a href="{{ route('dns-records.index', $site) }}" class="btn btn-outline-primary">
<i class="bi bi-list-ul"></i> View All DNS Records
</a>
<a href="{{ route('dashboard.show', $site) }}" class="btn btn-outline-secondary">
<i class="bi bi-bar-chart"></i> Site Dashboard
</a>
</div>
</div>
</div>
</div>
</div>
@endsection