Files
ismysiteup.online/resources/views/tcp-ports/edit.blade.php
T

152 lines
6.1 KiB
PHP
Raw Normal View History

2026-01-17 16:42:43 +02:00
@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