Skip to content

Commit

Permalink
Show all notes within a job of a user
Browse files Browse the repository at this point in the history
  • Loading branch information
guilbaults committed Aug 13, 2024
1 parent d5c8250 commit c1b51fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion jobstats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from jobstats.analyze_job import Comment
from django.http import Http404
import os
from django.db.models import Q

GPU_MEMORY = {
'GRID V100D-4C': 4,
Expand Down Expand Up @@ -278,7 +279,7 @@ def job(request, username, job_id):
context['array_jobs'] = JobTable.objects.filter(id_array_job=job.id_array_job).order_by('id_array_task')

if request.user.is_staff:
context['notes'] = Note.objects.filter(job_id=job_id).filter(deleted_at=None).order_by('-modified_at')
context['notes'] = Note.objects.filter(Q(username=username) | Q(job_id=job_id)).filter(deleted_at=None).order_by('-modified_at')

context['tres_req'] = job.parse_tres_req()
context['total_mem'] = context['tres_req']['total_mem'] * 1024 * 1024
Expand Down
21 changes: 10 additions & 11 deletions templates/notes_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
<h1>{% translate "Internal notes" %}</h1>

{% for note in notes %}
<div class="alert alert-primary" role="alert">
<div class="container">
<div class="row">
<div class="col">
<a href="{{ note.get_absolute_url }}"><h2 class="alert-heading">{{ note.title }}</h2></a>
</div>
<div class="col-3">
{% translate "Modified at:" %} <span class="utc_date">{{ note.modified_at | date:"c" }}</span>
</div>
</div>
<div class="card border-primary">
<div class="card-header">
{% if note.job_id %}
<a href="{{ note.get_absolute_url }}">{{ note.title }}</a> <a href="{{settings.BASE_URL}}secure/jobstats/{{note.username}}/{{ note.job_id }}"> ({{ note.job_id }})</a> - <span class="utc_date">{{ note.modified_at | date:"c" }}</span>
{% else %}
{{ note.title }} - <span class="utc_date">{{ note.modified_at | date:"c" }}</span>
{% endif %}
</div>
<div class="card-body">
<p class="card-text">{{ note.notes | linebreaks}}</p>
</div>
<p>{{ note.notes }}</p>
</div>
{% empty %}
<p>{% translate "No notes found." %}</p>
Expand Down

0 comments on commit c1b51fd

Please sign in to comment.