|
1
|
{% extends "base.html" %} |
|
2
|
{% block title %}{{ form_title }} — {{ project.name }} — Fossilrepo{% endblock %} |
|
3
|
|
|
4
|
{% block content %} |
|
5
|
<h1 class="text-2xl font-bold text-gray-100 mb-2">{{ project.name }}</h1> |
|
6
|
{% include "fossil/_project_nav.html" %} |
|
7
|
|
|
8
|
<div class="mb-4"> |
|
9
|
<a href="{% url 'fossil:ticket_reports' slug=project.slug %}" class="text-sm text-brand-light hover:text-brand">← Back to Reports</a> |
|
10
|
</div> |
|
11
|
|
|
12
|
<div class="mx-auto max-w-3xl"> |
|
13
|
<h2 class="text-xl font-bold text-gray-100 mb-4">{{ form_title }}</h2> |
|
14
|
|
|
15
|
<form method="post" class="space-y-4 rounded-lg bg-gray-800 p-6 shadow border border-gray-700"> |
|
16
|
{% csrf_token %} |
|
17
|
|
|
18
|
<div> |
|
19
|
<label class="block text-sm font-medium text-gray-300 mb-1">Title <span class="text-red-400">*</span></label> |
|
20
|
<input type="text" name="title" required placeholder="Report title" |
|
21
|
value="{% if report %}{{ report.title }}{% endif %}" |
|
22
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm"> |
|
23
|
</div> |
|
24
|
|
|
25
|
<div> |
|
26
|
<label class="block text-sm font-medium text-gray-300 mb-1">Description</label> |
|
27
|
<textarea name="description" rows="2" placeholder="What does this report show?" |
|
28
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm">{% if report %}{{ report.description }}{% endif %}</textarea> |
|
29
|
</div> |
|
30
|
|
|
31
|
<div> |
|
32
|
<label class="block text-sm font-medium text-gray-300 mb-1">SQL Query <span class="text-red-400">*</span></label> |
|
33
|
<textarea name="sql_query" rows="10" required |
|
34
|
placeholder="SELECT tkt_uuid, title, status, type FROM ticket WHERE status = 'Open' ORDER BY tkt_ctime DESC" |
|
35
|
class="w-full rounded-md border-gray-700 bg-gray-800 text-gray-100 shadow-sm focus:border-brand focus:ring-brand sm:text-sm font-mono">{% if report %}{{ report.sql_query }}{% endif %}</textarea> |
|
36
|
<div class="mt-2 text-xs text-gray-500 space-y-1"> |
|
37
|
<p>Must be a SELECT statement. INSERT, UPDATE, DELETE, DROP, and other write operations are not allowed.</p> |
|
38
|
<p>Available placeholders: <code class="text-gray-400">{status}</code>, <code class="text-gray-400">{type}</code> (filled from query parameters).</p> |
|
39
|
<p>Common columns: <code class="text-gray-400">tkt_uuid</code>, <code class="text-gray-400">title</code>, <code class="text-gray-400">status</code>, <code class="text-gray-400">type</code>, <code class="text-gray-400">priority</code>, <code class="text-gray-400">severity</code>, <code class="text-gray-400">subsystem</code>, <code class="text-gray-400">tkt_ctime</code>.</p> |
|
40
|
</div> |
|
41
|
</div> |
|
42
|
|
|
43
|
<label class="flex items-center gap-2 text-sm text-gray-300 cursor-pointer"> |
|
44
|
<input type="checkbox" name="is_public" |
|
45
|
{% if report %}{% if report.is_public %}checked{% endif %}{% else %}checked{% endif %} |
|
46
|
class="rounded border-gray-600 bg-gray-900 text-brand focus:ring-brand"> |
|
47
|
Public (visible to all project members) |
|
48
|
</label> |
|
49
|
|
|
50
|
<div class="flex justify-end gap-3 pt-2"> |
|
51
|
<a href="{% url 'fossil:ticket_reports' slug=project.slug %}" |
|
52
|
class="rounded-md bg-gray-700 px-4 py-2 text-sm font-semibold text-gray-100 shadow-sm ring-1 ring-inset ring-gray-600 hover:bg-gray-600"> |
|
53
|
Cancel |
|
54
|
</a> |
|
55
|
<button type="submit" class="rounded-md bg-brand px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-brand-hover"> |
|
56
|
{{ submit_label }} |
|
57
|
</button> |
|
58
|
</div> |
|
59
|
</form> |
|
60
|
</div> |
|
61
|
{% endblock %} |
|
62
|
|