Skip to content

Commit 050633f

Browse files
committed
Fix minor site errors
1 parent 90151c9 commit 050633f

File tree

7 files changed

+49
-27
lines changed

7 files changed

+49
-27
lines changed

python/rcdb/web/modules/runs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from rcdb.model import Run, ConfigurationFile, RunPeriod
1313
from rcdb.stopwatch import StopWatchTimer
1414
from rcdb.web.pagination import Pagination
15-
from sqlalchemy import func
15+
from sqlalchemy import func, desc
1616
from sqlalchemy.orm import subqueryload
1717

1818
mod = Blueprint('runs', __name__, url_prefix='/runs')
@@ -39,7 +39,7 @@ def index(page, run_from, run_to):
3939
condition_types = g.tdb.get_condition_types()
4040
query = g.tdb.session.query(Run)
4141

42-
run_periods = g.tdb.session.query(RunPeriod).all()
42+
run_periods = g.tdb.session.query(RunPeriod).order_by(desc(RunPeriod.start_date)).all()
4343

4444
# Run range is defined?
4545
if run_from != -1 and run_to != -1:
@@ -214,7 +214,7 @@ def _parse_run_range(run_range_str):
214214
def search():
215215
run_range = request.args.get('rr', '')
216216
search_query = request.args.get('q', '')
217-
run_periods = g.tdb.session.query(RunPeriod).all()
217+
run_periods = g.tdb.session.query(RunPeriod).order_by(desc(RunPeriod.start_date)).all()
218218

219219
run_from_str = request.args.get('runFrom', '')
220220
run_to_str = request.args.get('runTo', '')

python/rcdb/web/modules/select_values.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from flask import Blueprint, request, render_template, flash, g, redirect, url_for
2+
from sqlalchemy import desc
3+
24
from rcdb.model import ConditionType, RunPeriod
35
from rcdb.web.modules.runs import _parse_run_range
46

@@ -9,7 +11,7 @@
911
def index():
1012
# noinspection PyUnresolvedReferences
1113
all_conditions = g.tdb.session.query(ConditionType).order_by(ConditionType.name.asc()).all()
12-
run_periods = g.tdb.session.query(RunPeriod).all()
14+
run_periods = g.tdb.session.query(RunPeriod).order_by(desc(RunPeriod.start_date)).all()
1315

1416
run_from_str = request.args.get('runFrom', '')
1517
run_to_str = request.args.get('runTo', '')

python/rcdb/web/modules/statistics.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#from app.users.decorators import requires_login
77

88
#from app.users.models import User
9-
from rcdb.model import LogRecord, Run, SchemaVersion
9+
from rcdb.model import LogRecord, Run, SchemaVersion, RunPeriod
1010
from sqlalchemy.sql.expression import desc
1111

1212
mod = Blueprint('statistics', __name__, url_prefix='/statistics')
@@ -17,14 +17,12 @@ def index():
1717

1818
run_count = g.tdb.session.query(Run).count()
1919
run_last = g.tdb.session.query(Run).order_by(desc(Run.number)).first()
20-
boards_count = 0
21-
crates_count = 0
2220
db_versions = g.tdb.session.query(SchemaVersion).order_by(SchemaVersion.version.desc())
21+
run_periods = g.tdb.session.query(RunPeriod).order_by(desc(RunPeriod.start_date)).all()
2322

2423
return render_template("statistics/index.html",
24+
run_periods=run_periods,
2525
run_count=run_count,
2626
run_last=run_last,
27-
boards_count=boards_count,
28-
crates_count=crates_count,
2927
db_versions=db_versions)
3028
pass

python/rcdb/web/templates/layouts/base.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@
110110

111111
<!-- Statistics -->
112112
<li {% if request.endpoint == 'statistics.index' %} class="active"{% endif %}>
113-
<a href="{{ url_for('statistics.index') }}">Statistics</a>
113+
<a href="{{ url_for('statistics.index') }}">DB info</a>
114114
</li>
115-
<li><a href="#">Something else here</a></li>
116115
<li role="separator" class="divider"></li>
117116
<li><a href="https://github.com/JeffersonLab/rcdb">GitHub page</a> </li>
118117
<li><a href="https://github.com/JeffersonLab/rcdb/issues" target="_blank">File bugs&features</a></li>

python/rcdb/web/templates/logs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends 'layouts/base.html' %}
2-
{% from '../render_pagination.html' import render_pagination %}
2+
{% from 'render_pagination.html' import render_pagination %}
33
{% set page_title = 'Logs' %}
44

55
{% block container %}

python/rcdb/web/templates/run_search_box.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{% for period in run_periods %}
2222
<li>
2323
<a class="rr-min-selector" data-run-min="{{ period.run_min }}" data-run-max="{{ period.run_max }}" href="#">
24-
{{period.run_min}}-{{period.run_max}} {{period.name}} ({{period.description }})
24+
{{period.run_min}}-{{period.run_max}}&nbsp;&nbsp; {{period.name}} ({{period.description }})
2525
</a>
2626
</li>
2727
{% endfor %}
@@ -39,7 +39,9 @@
3939
<li><p class="text-center"><strong>Run periods:</strong></p></li>
4040
<li class="divider"></li>
4141
{% for period in run_periods %}
42-
<li><a class="rr-min-selector" data-run-min="{{ period.run_min }}" data-run-max="{{ period.run_max }}" href="#">{{ period.name + " " + period.description }}</a></li>
42+
<li><a class="rr-min-selector" data-run-min="{{ period.run_min }}" data-run-max="{{ period.run_max }}" href="#">
43+
{{period.run_min}}-{{period.run_max}}&nbsp;&nbsp; {{period.name}} ({{period.description }})
44+
</a></li>
4345
{% endfor %}
4446
</ul>
4547
</div>

python/rcdb/web/templates/statistics/index.html

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{% extends 'layouts/base.html' %}
22

3-
{% set page_title = 'Statistics' %}
3+
{% set page_title = 'DB info' %}
44

55
{% block container %}
66

77
<div class="container">
88

9-
<div class="blog-header"><h3 class="blog-title">Database schema version</h3></div>
9+
<div class="blog-header"><h3 class="blog-title">Database info</h3></div>
1010

1111
<table class="table">
1212
<!-- Run count -->
@@ -28,12 +28,9 @@
2828
</td>
2929
</tr>
3030
{% endfor %}
31+
</table>
3132

32-
33-
34-
35-
<div class="blog-header"><h3 class="blog-title">Statistics</h3></div>
36-
33+
{# Run information#}
3734
<table class="table">
3835
<!-- Run count -->
3936
<tr><td>Run count</td><td>{{ run_count }}</td></tr>
@@ -46,13 +43,37 @@
4643
&nbsp; Started: {{ run_last.start_time }}
4744
</td>
4845
</tr>
49-
50-
<!-- Boards count -->
51-
<tr> <td>Boards in DB</td> <td>{{ boards_count }}</td> </tr>
52-
53-
<!-- Crates count -->
54-
<tr> <td>Crates in DB</td> <td>{{ crates_count }}</td> </tr>
5546
</table>
47+
<!-- Run Periods Table -->
48+
<div class="mt-4">
49+
<h4>Run Periods</h4>
50+
<table class="table table-bordered table-striped">
51+
<thead>
52+
<tr>
53+
<th>ID</th>
54+
<th>Name</th>
55+
<th>Description</th>
56+
<th>Run Min</th>
57+
<th>Run Max</th>
58+
<th>Start Date</th>
59+
<th>End Date</th>
60+
</tr>
61+
</thead>
62+
<tbody>
63+
{% for period in run_periods %}
64+
<tr>
65+
<td>{{ period.id }}</td>
66+
<td>{{ period.name }}</td>
67+
<td>{{ period.description }}</td>
68+
<td>{{ period.run_min }}</td>
69+
<td>{{ period.run_max }}</td>
70+
<td>{{ period.start_date }}</td>
71+
<td>{{ period.end_date }}</td>
72+
</tr>
73+
{% endfor %}
74+
</tbody>
75+
</table>
76+
</div>
5677
</div>
5778

5879
{% endblock %}

0 commit comments

Comments
 (0)