150 lines
7.0 KiB
PHP
150 lines
7.0 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Edit Health Check - ' . $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('health-checks.index', $site) }}">Health Checks</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 Health Check</h1>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<form action="{{ route('health-checks.update', [$site, $healthCheck]) }}" method="POST">
|
|
@csrf
|
|
@method('PUT')
|
|
|
|
<div class="mb-3">
|
|
<label for="endpoint" class="form-label">Health Endpoint Path</label>
|
|
<div class="input-group">
|
|
<span class="input-group-text">{{ rtrim($site->url, '/') }}/</span>
|
|
<input type="text"
|
|
class="form-control @error('endpoint') is-invalid @enderror"
|
|
id="endpoint"
|
|
name="endpoint"
|
|
value="{{ old('endpoint', $healthCheck->endpoint) }}"
|
|
required>
|
|
@error('endpoint')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="form-text">Enter the path to your health check endpoint.</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="expected_json_keys" class="form-label">Expected JSON Keys (Optional)</label>
|
|
<input type="text"
|
|
class="form-control @error('expected_json_keys') is-invalid @enderror"
|
|
id="expected_json_keys"
|
|
name="expected_json_keys"
|
|
value="{{ old('expected_json_keys', $healthCheck->expected_json_keys ? implode(', ', $healthCheck->expected_json_keys) : '') }}"
|
|
placeholder="status, database, cache">
|
|
@error('expected_json_keys')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
<div class="form-text">
|
|
Comma-separated list of JSON keys that must be present in the response. Supports dot notation for nested keys.
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
<label for="performance_threshold" class="form-label">Performance Threshold (Optional)</label>
|
|
<div class="input-group">
|
|
<input type="number"
|
|
class="form-control @error('performance_threshold') is-invalid @enderror"
|
|
id="performance_threshold"
|
|
name="performance_threshold"
|
|
value="{{ old('performance_threshold', $healthCheck->performance_threshold) }}"
|
|
min="1"
|
|
max="60000"
|
|
placeholder="1000">
|
|
<span class="input-group-text">ms</span>
|
|
@error('performance_threshold')
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
@enderror
|
|
</div>
|
|
<div class="form-text">
|
|
Alert when response time exceeds this threshold in milliseconds. Leave empty to disable performance alerts.
|
|
</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', $healthCheck->is_active) ? 'checked' : '' }}>
|
|
<label class="form-check-label" for="is_active">
|
|
Enable monitoring for this health check
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="d-flex gap-2">
|
|
<button type="submit" class="btn btn-primary">
|
|
<i class="bi bi-check-circle"></i> Update Health Check
|
|
</button>
|
|
<a href="{{ route('health-checks.show', [$site, $healthCheck]) }}" 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-{{ $healthCheck->status_color }}">
|
|
{{ $healthCheck->status_text }}
|
|
</span>
|
|
</dd>
|
|
|
|
<dt class="col-sm-5">Last Checked:</dt>
|
|
<dd class="col-sm-7">
|
|
@if($healthCheck->last_checked_at)
|
|
{{ $healthCheck->last_checked_at->diffForHumans() }}
|
|
@else
|
|
<span class="text-muted">Never</span>
|
|
@endif
|
|
</dd>
|
|
|
|
@if($healthCheck->status_code)
|
|
<dt class="col-sm-5">Status Code:</dt>
|
|
<dd class="col-sm-7">
|
|
<span class="badge bg-{{ $healthCheck->status_code < 300 ? 'success' : 'danger' }}">
|
|
{{ $healthCheck->status_code }}
|
|
</span>
|
|
</dd>
|
|
@endif
|
|
|
|
@if($healthCheck->response_time_ms)
|
|
<dt class="col-sm-5">Response Time:</dt>
|
|
<dd class="col-sm-7">{{ $healthCheck->response_time_ms }}ms</dd>
|
|
@endif
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|