Files
newznab-tmux-NNTmux/resources/views/admin/regexes/release-naming-test.blade.php
T
2026-08-28 00:59:02 +02:00

187 lines
10 KiB
PHP

@extends('layouts.admin')
@section('content')
<div class="space-y-6">
<x-admin.card>
<x-admin.page-header :title="$title ?? 'Release Naming Regex Test'" icon="fas fa-flask">
<x-slot:actions>
<x-admin.button :href="url('/admin/release_naming_regexes-list')" tone="gray" icon="fas fa-arrow-left">Back to List</x-admin.button>
</x-slot:actions>
</x-admin.page-header>
<!-- Info Alert -->
<div class="px-6 py-4 bg-blue-50 border-b border-blue-100">
<div class="flex">
<i class="fas fa-info-circle text-blue-500 text-xl mr-3"></i>
<p class="text-sm text-blue-700">
Test your release naming regex patterns against actual release data from your database.
</p>
</div>
</div>
<!-- Test Form -->
<form method="GET" action="{{ url('/admin/release_naming_regexes-test') }}" class="px-6 py-6">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
<!-- Group Field -->
<div class="md:col-span-1">
<label for="group" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Group: <span class="text-red-500">*</span>
</label>
<input type="text"
id="group"
name="group"
class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
value="{{ $group }}"
placeholder="alt.binaries.teevee"
required>
<p class="mt-2 text-sm text-gray-500">
Enter a newsgroup name to test against
</p>
</div>
<!-- Show Limit Field -->
<div>
<label for="showlimit" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Show Limit:
</label>
<input type="number"
id="showlimit"
name="showlimit"
class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
value="{{ $showlimit }}"
min="1"
max="1000">
<p class="mt-2 text-sm text-gray-500">
Results to display
</p>
</div>
<!-- Query Limit Field -->
<div>
<label for="querylimit" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Query Limit:
</label>
<input type="number"
id="querylimit"
name="querylimit"
class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
value="{{ $querylimit }}"
min="1"
max="500000">
<p class="mt-2 text-sm text-gray-500">
Max releases to query
</p>
</div>
</div>
<!-- Regex Field -->
<div class="mb-6">
<label for="regex" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Regex: <span class="text-red-500">*</span>
</label>
<textarea id="regex"
name="regex"
class="w-full px-4 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm"
rows="4"
required
placeholder="/^(?P<name>.*?)([\. ]S\d{1,3}[\. ]?E\d{1,3})/i">{{ regex_display_value($regex) }}</textarea>
<p class="mt-2 text-sm text-gray-500">
Enter the regex pattern to test. Include delimiters and flags.
</p>
</div>
<!-- Submit Button -->
<button type="submit" class="px-6 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded-lg hover:bg-blue-700">
<i class="fas fa-play mr-2"></i>Test Regex
</button>
</form>
<!-- Results Section -->
@if($data)
<div class="px-6 py-6 border-t border-gray-200">
<h2 class="text-xl font-semibold text-gray-800 dark:text-gray-200 mb-4">
<i class="fas fa-chart-bar mr-2"></i>Test Results:
</h2>
@if(count($data) > 0)
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-24">Release ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Original Name</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">New Name</th>
<th class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider w-28">Match</th>
</tr>
</thead>
<tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
@foreach($data as $row)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm font-semibold text-gray-900">
{{ $row['releaseID'] ?? $row['id'] ?? 'N/A' }}
</td>
<td class="px-6 py-4 text-sm text-gray-500">
<div class="max-w-xl wrap-break-word">
{{ $row['oldName'] ?? $row['name'] ?? '' }}
</div>
</td>
<td class="px-6 py-4 text-sm">
@if(isset($row['newName']) && $row['newName'])
<div class="max-w-xl wrap-break-word font-semibold text-green-600">
{{ $row['newName'] }}
</div>
@else
<span class="text-gray-400"></span>
@endif
</td>
<td class="px-6 py-4 whitespace-nowrap text-center">
@if(isset($row['match']) && $row['match'])
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-800">
<i class="fas fa-check mr-1"></i>Match
</span>
@else
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold bg-red-100 text-red-800">
<i class="fas fa-times mr-1"></i>No Match
</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- Success Summary -->
<div class="mt-6 p-4 bg-green-50 border border-green-200 rounded-lg">
<div class="flex">
<i class="fas fa-check-circle text-green-500 text-xl mr-3"></i>
<div>
<p class="text-green-800 font-medium">
Tested {{ count($data) }} releases
</p>
<p class="text-sm text-green-700 mt-1">
Review the matches above to verify your regex pattern is working correctly.
</p>
</div>
</div>
</div>
@else
<!-- No Results Warning -->
<div class="p-4 bg-yellow-50 border border-yellow-200 rounded-lg">
<div class="flex">
<i class="fas fa-exclamation-triangle text-yellow-500 text-xl mr-3"></i>
<div>
<p class="text-yellow-800 font-medium">No releases found</p>
<p class="text-sm text-yellow-700 mt-1">
No releases found for the specified group or no matches found. Try a different group or regex pattern.
</p>
</div>
</div>
</div>
@endif
</div>
@endif
</x-admin.card>
</div>
@endsection