Skip to content

Commit

Permalink
Merge pull request #487 from vizor-games/bugfix/Fix_dates_and_result_…
Browse files Browse the repository at this point in the history
…displaying

Fix dates and result displaying
  • Loading branch information
cjlapao authored Apr 22, 2024
2 parents 357cd07 + b1596b7 commit de9ff98
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 0 additions & 6 deletions rq_dashboard/templates/rq_dashboard/job.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,18 @@ <h2><strong>Job ID</strong>: {{ id }}</h2>
<p class="ellipsify"><strong>Description</strong>:<br><%= d.description %></p>
<p><strong>Origin queue</strong>:<br><%= d.origin %></p>
<p><strong>Status</strong>:<br><%= d.status %></p>
<% if (d.result) { %>
<p><strong>Result</strong>:<br><%= d.result %></p>
<% } %>
</span>

<span class="col-6">
<p><strong>Created at</strong>:<br> <%= d.created_at %></p>
<p><strong>Enqueued at</strong>:<br> <%= d.enqueued_at %></p>
<% if (d.exc_info) { %>
<p><strong>Ended at</strong>:<br> <%= d.ended_at %></p>
<% } %>
</span>

<% if (d.exc_info) { %>
<div class = "row col-12">
<pre class="exc_info col-12"><%= d.exc_info %></pre>
</div>
<% } %>
</script>
</div>

Expand Down
9 changes: 7 additions & 2 deletions rq_dashboard/templates/rq_dashboard/scripts/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
$job_data.empty();

job.created_at = toRelative(Date.create(job.created_at)) + ' / ' + toShort(Date.create(job.created_at));
if (job.enqueued_at !== undefined) {
if (job.enqueued_at !== null) {
job.enqueued_at = toRelative(Date.create(job.enqueued_at)) + ' / ' + toShort(Date.create(job.enqueued_at));
} else {
job.enqueued_at = '-'
}
if (job.ended_at !== undefined) {
if (job.ended_at !== null) {
job.ended_at = toRelative(Date.create(job.ended_at)) + ' / ' + toShort(Date.create(job.ended_at));
} else {
job.ended_at = '-'
}

if (job.status === "failed") {
$("#requeue-job-btn").show()
}
Expand Down
2 changes: 1 addition & 1 deletion rq_dashboard/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def job_info(instance_number, job_id):
ended_at=serialize_date(job.ended_at),
origin=job.origin,
status=job.get_status(),
result=job._result,
result=job.return_value(),
exc_info=str(job.exc_info) if job.exc_info else None,
description=job.description,
)
Expand Down

0 comments on commit de9ff98

Please sign in to comment.