Skip to content

Commit

Permalink
Merge branch 'tickets/DM-32200'
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKrughoff committed Oct 13, 2021
2 parents a41dea6 + e7d8471 commit f4d4039
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Kustomization

images:
- name: lsstsqre/rubintv
newTag: 0.0.11
newTag: 0.0.12

resources:
- configmap.yaml
Expand Down
21 changes: 10 additions & 11 deletions src/rubintv/handlers/external/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ async def get_table(request: web.Request) -> web.Response:
if "num" in request.query:
num = int(request.query["num"])
else:
num = 10
if "beg_date" in request.query:
num = 50
if "beg_date" in request.query and request.query["beg_date"]:
beg_date = datetime.fromisoformat(request.query["beg_date"])
else:
beg_date = None # type: ignore[assignment]
if "end_date" in request.query:
if "end_date" in request.query and request.query["end_date"]:
end_date = datetime.fromisoformat(request.query["end_date"])
else:
end_date = None # type: ignore[assignment]
Expand Down Expand Up @@ -117,22 +117,21 @@ def get_formatted_table(
imgs[chan] = timeSort(bucket, channels[chan].prefix, num)
keys = list(imgs.keys())
for i, img in enumerate(
imgs["im"]
): # I know there will always be an im style image
imgs["im"][i].chans.append(channels["im"])
imgs["monitor"]
): # I know there will always be a monitor style image
imgs["monitor"][i].chans.append(channels["monitor"])
for k in keys:
if k == "im":
if k == "monitor":
continue
match = False
for mim in imgs[k]:
if img.cleanDate() == mim.cleanDate() and img.seq == mim.seq:
imgs["im"][i].chans.append(channels[k])
imgs["monitor"][i].chans.append(channels[k])
match = True
break
if not match:
# Ignore typing here since the template expects None if there
# is no spec image for this run
imgs["im"][i].chans.append(None)
imgs["monitor"][i].chans.append(None)

env = Environment(
loader=PackageLoader("rubintv", "templates"),
Expand All @@ -146,7 +145,7 @@ def get_formatted_table(
templ = env.get_template(template)
return templ.render(
ncols=len(channels),
imgs=imgs["im"],
imgs=imgs["monitor"],
)


Expand Down
8 changes: 4 additions & 4 deletions src/rubintv/templates/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ <h2>More to come!</h2>
</div>

<div><h2>Search date range</h2>
<h3>Omit dates to search for the top N records.</h3>
<form style="background-color:light blue;" onSubmit="return search_process();" id="searchevents">
<label for="date">Begin Date: Format=2021-06-08:</label><br>
<input type="text" style="text-align:center;" id="beg_date" name="beg_date" value="2021-06-08"><br>
<input type="text" style="text-align:center;" id="beg_date" name="beg_date" value=""><br>
<label for="date">End Date: Format=2021-06-08:</label><br>
<input type="text" style="text-align:center;" id="end_date" name="end_date" value="2021-06-10"><br><br>
<input type="text" style="text-align:center;" id="end_date" name="end_date" value=""><br><br>
<label for="num">Number in Table:</label><br>
<input type="text" style="text-align:center;" id="num" name="num" value="500"><br><br>
<input type="text" style="text-align:center;" id="num" name="num" value="50"><br><br>
<input type="submit" value="Submit">

<script>
Expand Down Expand Up @@ -183,7 +184,6 @@ <h2>More to come!</h2>
<td><a href="{{ '/rubintv/' + chan.endpoint + '/' + img.cleanDate() + '/' + img.seq|string }}">{{chan.name}}</a></td>
{% else %}
<td></td>
<td></td>
{% endif %}
{% endfor %}
</tr>
Expand Down

0 comments on commit f4d4039

Please sign in to comment.