aboutsummaryrefslogtreecommitdiff
path: root/web/app/templates/home.html
blob: 0ecad4448f4d33c16e356c5dc44ed7eb16f48fa5 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{% extends 'base.html' %}
{% block title %}Home{% endblock %}

{% block content %}
<h2>Welcome, {{ user.id }}!</h2>
<p>You are logged in.</p>

<a href="{{ url_for('main.logout') }}" role="button" class="secondary">Logout</a>

{% if user.admin == True %}
<details name="example" style="margin-top: 40px;">
  <summary>Create a New User</summary>
  <form method="post" action="{{ url_for('main.create_user') }}">
      <input type="text" name="username" placeholder="New Username" required>
      <input type="password" name="password" placeholder="New Password" required>
      <label for="admin">Admin?</label>
      <input type="checkbox" name="admin" id="admin" required>
      <button type="submit">Create User</button>
  </form>

</details>
{% endif %}

<h3>Create a New Scrape Job</h3>
<form method="post" action="{{ url_for('main.enqueue_job') }}">
    <input type="text" name="name" placeholder="Name" required>

    <label for="act">Select One or More Acts:</label>
    <select name="act" id="act" multiple style="margin-bottom: 30px; padding: 5px;" required>
      {% for code, name in acts %}
        <option value="{{ code }}" style="color: black;">{{ name }}</option>
      {% endfor %}
    </select>

    <label for="act">Comma Separated Section List</label>
    <input type="text" name="section" placeholder="Sections">

    <select name="state_code">
      {% for code, name in states %}
        <option value="{{ code }}">{{ name }}</option>
      {% endfor %}
    </select>

    <button type="submit">Create Scrape Job</button>
</form>

<script>
  document.addEventListener('DOMContentLoaded', function () {
    new SlimSelect({
      select: '#act'
    });
  })
</script>

<h3>Jobs</h3>
<table>
  <thead>
    <tr>
      <th scope="col">Job Name</th>
      <th scope="col">Job Status</th>
      <th scope="col">Output</th>
    </tr>
  </thead>
  <tbody>
    {% for job in completed_jobs %}
    <tr>
      <td>{{ job['name'] }}</td>
      <td>JobStatus.COMPLETED</td>
      <td><a href="{{ url_for('main.download_output', filename=job['name']) }}">Download</a></td>
    </tr>
    {% endfor %}
    {% for job in jobs %}
    <tr>
      <td>{{ job.args[0] }}</td>
      <td>{{ job._status }}</td>
      <td>Not Available</td>
    </tr>
    {% endfor %}
  </tbody>
</table>

{% endblock %}