File size: 3,523 Bytes
0a40ab8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% extends "base.html" %}

{% block title %}Add Monitoring Source - PoliSage{% endblock %}

{% block content %}
<div class="container mt-4">
    <h2>Add New Monitoring Source</h2>

    {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
        {% for category, message in messages %}
          <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
            {{ message }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
          </div>
        {% endfor %}
      {% endif %}
    {% endwith %}

    <form method="POST" action="{{ url_for("monitoring.add_source") }}">
        <div class="mb-3">
            <label for="name" class="form-label">Source Name <span class="text-danger">*</span></label>
            <input type="text" class="form-control" id="name" name="name" value="{{ name or "" }}" required>
            <div class="form-text">A descriptive name for this source (e.g., "State Court Opinions Feed").</div>
        </div>

        <div class="mb-3">
            <label for="url" class="form-label">Source URL <span class="text-danger">*</span></label>
            <input type="url" class="form-control" id="url" name="url" value="{{ url or "" }}" required>
            <div class="form-text">The web address (URL) of the source (e.g., website, RSS feed).</div>
        </div>

        <div class="mb-3">
            <label for="source_type" class="form-label">Source Type <span class="text-danger">*</span></label>
            <select class="form-select" id="source_type" name="source_type" required>
                <option value="" disabled {% if not source_type %}selected{% endif %}>Select Type...</option>
                <option value="Official Gazette" {% if source_type == "Official Gazette" %}selected{% endif %}>Official Gazette</option>
                <option value="Court Website" {% if source_type == "Court Website" %}selected{% endif %}>Court Website</option>
                <option value="News Feed" {% if source_type == "News Feed" %}selected{% endif %}>News Feed</option>
                <option value="RSS" {% if source_type == "RSS" %}selected{% endif %}>RSS Feed</option>
                <option value="API" {% if source_type == "API" %}selected{% endif %}>API Endpoint</option>
                <option value="Other" {% if source_type == "Other" %}selected{% endif %}>Other</option>
            </select>
            <div class="form-text">Categorize the source type.</div>
        </div>

        <div class="mb-3">
            <label for="frequency_minutes" class="form-label">Check Frequency (minutes)</label>
            <input type="number" class="form-control" id="frequency_minutes" name="frequency_minutes" value="{{ frequency_minutes or 1440 }}" min="1">
            <div class="form-text">How often the system should check this source for updates (e.g., 60 for hourly, 1440 for daily).</div>
        </div>

        <div class="form-check mb-3">
            <input class="form-check-input" type="checkbox" id="is_active" name="is_active" value="true" {% if is_active %}checked{% endif %}>
            <label class="form-check-label" for="is_active">
                Active (Enable monitoring for this source)
            </label>
        </div>

        <button type="submit" class="btn btn-primary">Add Source</button>
        <a href="{{ url_for("monitoring.list_sources") }}" class="btn btn-secondary">Cancel</a>
    </form>
</div>
{% endblock %}