some progress
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Add TCP Port - ' . $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('tcp-ports.index', $site) }}">TCP Ports</a></li>
|
||||
<li class="breadcrumb-item active">Add Port</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h1 class="mb-4"><i class="bi bi-plus-circle"></i> Add TCP Port</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('tcp-ports.store', $site) }}" method="POST">
|
||||
@csrf
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="port" class="form-label">Port Number</label>
|
||||
<input type="number"
|
||||
class="form-control @error('port') is-invalid @enderror"
|
||||
id="port"
|
||||
name="port"
|
||||
min="1"
|
||||
max="65535"
|
||||
value="{{ old('port') }}"
|
||||
required>
|
||||
@error('port')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
<div class="form-text">Enter a port number between 1 and 65535.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Port Name (Optional)</label>
|
||||
<input type="text"
|
||||
class="form-control @error('name') is-invalid @enderror"
|
||||
id="name"
|
||||
name="name"
|
||||
value="{{ old('name') }}"
|
||||
maxlength="255"
|
||||
placeholder="e.g., Web Server, Database">
|
||||
@error('name')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
<div class="form-text">Optional custom name for this port.</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 port
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-check-circle"></i> Add Port
|
||||
</button>
|
||||
<a href="{{ route('tcp-ports.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">Common Ports</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<small class="text-muted">Click to use:</small>
|
||||
<div class="list-group list-group-flush mt-2">
|
||||
@foreach($commonPorts as $portNumber => $portName)
|
||||
<a href="#" class="list-group-item list-group-item-action py-2 px-3 common-port"
|
||||
data-port="{{ $portNumber }}"
|
||||
data-name="{{ $portName }}">
|
||||
<strong>{{ $portNumber }}</strong> - {{ $portName }}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.common-port').forEach(function(element) {
|
||||
element.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
document.getElementById('port').value = this.dataset.port;
|
||||
document.getElementById('name').value = this.dataset.name;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -0,0 +1,151 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Edit TCP Port - ' . $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('tcp-ports.index', $site) }}">TCP Ports</a></li>
|
||||
<li class="breadcrumb-item active">Edit Port {{ $tcpPort->port }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h1 class="mb-4"><i class="bi bi-pencil"></i> Edit TCP Port</h1>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<form action="{{ route('tcp-ports.update', [$site, $tcpPort]) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="port" class="form-label">Port Number</label>
|
||||
<input type="number"
|
||||
class="form-control @error('port') is-invalid @enderror"
|
||||
id="port"
|
||||
name="port"
|
||||
min="1"
|
||||
max="65535"
|
||||
value="{{ old('port', $tcpPort->port) }}"
|
||||
required>
|
||||
@error('port')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
<div class="form-text">Enter a port number between 1 and 65535.</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Port Name (Optional)</label>
|
||||
<input type="text"
|
||||
class="form-control @error('name') is-invalid @enderror"
|
||||
id="name"
|
||||
name="name"
|
||||
value="{{ old('name', $tcpPort->name) }}"
|
||||
maxlength="255"
|
||||
placeholder="e.g., Web Server, Database">
|
||||
@error('name')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
<div class="form-text">Optional custom name for this port.</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', $tcpPort->is_active) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_active">
|
||||
Enable monitoring for this port
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="bi bi-check-circle"></i> Update Port
|
||||
</button>
|
||||
<a href="{{ route('tcp-ports.index', $site) }}" class="btn btn-secondary">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Port Status</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="mb-0">
|
||||
<dt>Current Status</dt>
|
||||
<dd>
|
||||
<span class="badge bg-{{ $tcpPort->status_color }}">
|
||||
{{ $tcpPort->status_text }}
|
||||
</span>
|
||||
</dd>
|
||||
|
||||
<dt>Last Checked</dt>
|
||||
<dd>
|
||||
@if($tcpPort->last_checked_at)
|
||||
{{ $tcpPort->last_checked_at->format('Y-m-d H:i:s') }}
|
||||
<br>
|
||||
<small class="text-muted">{{ $tcpPort->last_checked_at->diffForHumans() }}</small>
|
||||
@else
|
||||
<span class="text-muted">Never</span>
|
||||
@endif
|
||||
</dd>
|
||||
|
||||
@if($tcpPort->response_time_ms)
|
||||
<dt>Response Time</dt>
|
||||
<dd>{{ $tcpPort->response_time_ms }}ms</dd>
|
||||
@endif
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Common Ports</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<small class="text-muted">Click to use:</small>
|
||||
<div class="list-group list-group-flush mt-2" style="max-height: 300px; overflow-y: auto;">
|
||||
@foreach($commonPorts as $portNumber => $portName)
|
||||
<a href="#" class="list-group-item list-group-item-action py-2 px-3 common-port"
|
||||
data-port="{{ $portNumber }}"
|
||||
data-name="{{ $portName }}">
|
||||
<strong>{{ $portNumber }}</strong> - {{ $portName }}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.querySelectorAll('.common-port').forEach(function(element) {
|
||||
element.addEventListener('click', function(e) {
|
||||
e.preventDefault();
|
||||
document.getElementById('port').value = this.dataset.port;
|
||||
document.getElementById('name').value = this.dataset.name;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
@@ -0,0 +1,109 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'TCP Ports - ' . $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">TCP Ports</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1><i class="bi bi-ethernet"></i> TCP Port Monitoring</h1>
|
||||
<a href="{{ route('tcp-ports.create', $site) }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> Add Port
|
||||
</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($tcpPorts->isEmpty())
|
||||
<div class="alert alert-info">
|
||||
<i class="bi bi-info-circle"></i> No TCP ports are being monitored for this site yet. Click "Add Port" to start monitoring.
|
||||
</div>
|
||||
@else
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Port</th>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Response Time</th>
|
||||
<th>Last Checked</th>
|
||||
<th>Active</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($tcpPorts as $port)
|
||||
<tr>
|
||||
<td><strong>{{ $port->port }}</strong></td>
|
||||
<td>{{ $port->display_name }}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ $port->status_color }}">
|
||||
{{ $port->status_text }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
@if($port->response_time_ms)
|
||||
{{ $port->response_time_ms }}ms
|
||||
@else
|
||||
<span class="text-muted">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($port->last_checked_at)
|
||||
{{ $port->last_checked_at->diffForHumans() }}
|
||||
@else
|
||||
<span class="text-muted">Never</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($port->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('tcp-ports.show', [$site, $port]) }}"
|
||||
class="btn btn-outline-primary" title="View">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
<a href="{{ route('tcp-ports.edit', [$site, $port]) }}"
|
||||
class="btn btn-outline-secondary" title="Edit">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</a>
|
||||
<form action="{{ route('tcp-ports.destroy', [$site, $port]) }}"
|
||||
method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('Are you sure you want to delete this port monitor?');">
|
||||
@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>
|
||||
|
||||
{{ $tcpPorts->links() }}
|
||||
@endif
|
||||
@endsection
|
||||
@@ -0,0 +1,168 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'TCP Port ' . $tcpPort->port . ' - ' . $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('tcp-ports.index', $site) }}">TCP Ports</a></li>
|
||||
<li class="breadcrumb-item active">Port {{ $tcpPort->port }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1><i class="bi bi-ethernet"></i> Port {{ $tcpPort->port }} - {{ $tcpPort->display_name }}</h1>
|
||||
<div class="btn-group">
|
||||
<a href="{{ route('tcp-ports.edit', [$site, $tcpPort]) }}" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-pencil"></i> Edit
|
||||
</a>
|
||||
<form action="{{ route('tcp-ports.destroy', [$site, $tcpPort]) }}"
|
||||
method="POST"
|
||||
class="d-inline"
|
||||
onsubmit="return confirm('Are you sure you want to delete this port monitor?');">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit" class="btn btn-outline-danger">
|
||||
<i class="bi bi-trash"></i> Delete
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">Port 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">Port Number</dt>
|
||||
<dd class="col-sm-9"><strong>{{ $tcpPort->port }}</strong></dd>
|
||||
|
||||
<dt class="col-sm-3">Port Name</dt>
|
||||
<dd class="col-sm-9">{{ $tcpPort->display_name }}</dd>
|
||||
|
||||
<dt class="col-sm-3">Status</dt>
|
||||
<dd class="col-sm-9">
|
||||
<span class="badge bg-{{ $tcpPort->status_color }}">
|
||||
{{ $tcpPort->status_text }}
|
||||
</span>
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-3">Monitoring</dt>
|
||||
<dd class="col-sm-9">
|
||||
@if($tcpPort->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($tcpPort->last_checked_at)
|
||||
{{ $tcpPort->last_checked_at->format('Y-m-d H:i:s') }}
|
||||
<br>
|
||||
<small class="text-muted">{{ $tcpPort->last_checked_at->diffForHumans() }}</small>
|
||||
@else
|
||||
<span class="text-muted">Never</span>
|
||||
@endif
|
||||
</dd>
|
||||
|
||||
@if($tcpPort->response_time_ms)
|
||||
<dt class="col-sm-3">Response Time</dt>
|
||||
<dd class="col-sm-9">{{ $tcpPort->response_time_ms }}ms</dd>
|
||||
@endif
|
||||
|
||||
<dt class="col-sm-3">Created</dt>
|
||||
<dd class="col-sm-9">
|
||||
{{ $tcpPort->created_at->format('Y-m-d H:i:s') }}
|
||||
<br>
|
||||
<small class="text-muted">{{ $tcpPort->created_at->diffForHumans() }}</small>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h5 class="mb-0">About Port {{ $tcpPort->port }}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@php
|
||||
$commonPorts = \App\Models\TcpPort::getCommonPorts();
|
||||
$portInfo = $commonPorts[$tcpPort->port] ?? null;
|
||||
@endphp
|
||||
|
||||
@if($portInfo)
|
||||
<p class="mb-2">
|
||||
<strong>Common Service:</strong> {{ $portInfo }}
|
||||
</p>
|
||||
@endif
|
||||
|
||||
<p class="text-muted mb-0">
|
||||
This monitor checks if port {{ $tcpPort->port }} is accessible on {{ $site->url }}.
|
||||
Checks run every 10 minutes when monitoring is active.
|
||||
</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-{{ $tcpPort->status_color }} fs-5 px-4 py-2">
|
||||
{{ $tcpPort->status_text }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@if($tcpPort->is_open)
|
||||
<p class="text-success mb-0">
|
||||
<i class="bi bi-check-circle-fill"></i> Port is accessible
|
||||
</p>
|
||||
@elseif($tcpPort->is_open === false)
|
||||
<p class="text-danger mb-0">
|
||||
<i class="bi bi-x-circle-fill"></i> Port is not accessible
|
||||
</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">
|
||||
<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('tcp-ports.index', $site) }}" class="btn btn-outline-primary">
|
||||
<i class="bi bi-list-ul"></i> View All Ports
|
||||
</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
|
||||
Reference in New Issue
Block a user