Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show result text in job list #3506

Merged
merged 6 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
{{ object.comment }}
<split></split>

<div class="child-mb-0 text-left">
{{ object.rendered_result_text }}
</div>

<split></split>
<ul class="list-unstyled mb-0 text-left">
{% if object.error_message %}

Expand Down
4 changes: 4 additions & 0 deletions app/grandchallenge/algorithms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ class JobsList(PaginatedTableListView):
sort_field="comment",
optional_condition=lambda obj: bool(obj.comment),
),
Column(
title="Result",
optional_condition=lambda obj: bool(obj.rendered_result_text),
),
Column(title="Results"),
Column(title="Viewer"),
]
Expand Down
63 changes: 38 additions & 25 deletions app/grandchallenge/core/static/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ p {
line-height: 1.6;
}

.child-mb-0>* {
chrisvanrun marked this conversation as resolved.
Show resolved Hide resolved
margin-bottom: 0;
}

.jumbotron {
text-shadow: 0.1rem 0.1rem 0.2rem #000000;
}
Expand All @@ -25,7 +29,8 @@ p {
}

/* fix modal display with overflow-y: scroll on html */
.modal, .modal-open {
.modal,
chrisvanrun marked this conversation as resolved.
Show resolved Hide resolved
.modal-open {
padding-right: 0 !important;
}

Expand All @@ -52,12 +57,12 @@ p {
flex-wrap: wrap;
}

.row.equal-height > [class*='col-'] {
.row.equal-height>[class*='col-'] {
display: flex;
flex-direction: column;
}

.row.equal-height > [class*='col-'] .card {
.row.equal-height>[class*='col-'] .card {
flex: 1;
}

Expand Down Expand Up @@ -96,15 +101,15 @@ dl.inline dt:after {
color: var(--light);
}

.breadcrumb-item > a {
.breadcrumb-item>a {
color: var(--secondary);
}

/* Fix display of select2 dropdowns when used in collapsible bootstrap elements */
.select2-container,
.select2-container li:only-child,
.select2-container input:placeholder-shown {
width: 100% !important;
width: 100% !important;
}

.console {
Expand All @@ -117,36 +122,38 @@ ul.socialaccount_providers {
padding: 0;
}

ul.socialaccount_providers > li {
ul.socialaccount_providers>li {
min-width: 19rem;
}

.nav-pills > li > .nav-link {
.nav-pills>li>.nav-link {
color: #000;
}
.nav-pills > li > .nav-link:hover {

.nav-pills>li>.nav-link:hover {
border-radius: 1.2rem;
color: #000;
background-color: #ecf0f1;
}
.nav-pills > li > .nav-link.active {

.nav-pills>li>.nav-link.active {
border-radius: 1.2rem;
}

.nav-tabs > .nav-item > .nav-link {
.nav-tabs>.nav-item>.nav-link {
color: #000;
border-top: 0 transparent;
border-right: 0 transparent;
border-left: 0 transparent;
border-bottom: 0.25rem solid transparent;
}

.nav-tabs > .nav-item > .nav-link:hover {
.nav-tabs>.nav-item>.nav-link:hover {
border: inherit;
border-bottom: 0.25rem solid #f0f0f0;
}

.nav-tabs > .nav-item > .nav-link.active {
.nav-tabs>.nav-item>.nav-link.active {
border: inherit;
font-weight: bold;
border-bottom: 0.25rem solid #2c3e50;
Expand All @@ -156,7 +163,7 @@ ul.socialaccount_providers > li {
padding: 0;
}

.challengeDropdown > .nav-link {
.challengeDropdown>.nav-link {
color: #000;
}

Expand All @@ -170,40 +177,43 @@ ul.socialaccount_providers > li {
padding-bottom: 0.2rem;
}

.phaseButton:focus, .phaseButton:hover {
box-shadow:none !important;
.phaseButton:focus,
.phaseButton:hover {
box-shadow: none !important;
}

.gc-card {
border-radius: 0.9rem;
}

.gc-card:hover, .gc-card:focus-within {
.gc-card:hover,
.gc-card:focus-within {
box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.2);
}

/* Reset card shadow when above-stretched-link elements are focused */
.gc-card:has(.above-stretched-link:focus) {
box-shadow: none;
box-shadow: none;
}

.gc-card .card-img-top{
.gc-card .card-img-top {
border-top-left-radius: 0.9rem;
border-top-right-radius: 0.9rem;
}

.carousel-control-next, .carousel-control-prev {
.carousel-control-next,
.carousel-control-prev {
width: 3rem;
}

.documentation-sidebar {
top:5rem;
top: 5rem;
z-index: 1;
}

.thumbnail {
max-height:90px;
max-width:90px;
max-height: 90px;
max-width: 90px;
}

.box-shadow {
Expand All @@ -218,20 +228,23 @@ ul.socialaccount_providers > li {
}

a[aria-expanded=true] .fa-chevron-right {
display: none;
display: none;
}

a[aria-expanded=false] .fa-chevron-down {
display: none;
display: none;
}


/* htmx */
.htmx-indicator {
display:none;
display: none;
}

.htmx-request .htmx-indicator {
display: inline-block;
}

.htmx-request.htmx-indicator {
display: inline-block;
}
29 changes: 0 additions & 29 deletions app/tests/algorithms_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import pytest
from django.contrib.auth.models import Group
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.core.files.base import ContentFile
from django.utils import timezone
from django.utils.text import slugify
Expand All @@ -20,9 +19,6 @@
InterfaceKind,
)
from grandchallenge.subdomains.utils import reverse
from grandchallenge.workstations.templatetags.workstations import (
workstation_session_control_data,
)
from tests.algorithms_tests.factories import (
AlgorithmFactory,
AlgorithmImageFactory,
Expand Down Expand Up @@ -1413,13 +1409,6 @@ def test_job_list_row_template_ajax_renders(client):
time_limit=algorithm.time_limit,
)

ctrl_data = workstation_session_control_data(
workstation=algorithm.workstation,
context_object=algorithm,
algorithm_job=job,
config=algorithm.workstation_config,
)

headers = {"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"}

response = get_view_for_user(
Expand All @@ -1444,28 +1433,10 @@ def test_job_list_row_template_ajax_renders(client):
"algorithms:job-detail",
kwargs={"slug": job.algorithm_image.algorithm.slug, "pk": job.pk},
)
job_created = str(naturaltime(job.created))

response_content = json.loads(response.content.decode("utf-8"))

assert response.status_code == 200

assert response_content["recordsTotal"] == 1

assert len(response_content["data"]) == 1

assert job_details_url in response_content["data"][0][0]

assert job_created in response_content["data"][0][1]

assert editor.username in response_content["data"][0][2]

assert job.get_status_display() in response_content["data"][0][3]

assert "Result and images are private" in response_content["data"][0][4]

assert job.comment in response_content["data"][0][5]

assert "Empty" in response_content["data"][0][6]

assert ctrl_data in response_content["data"][0][7]
33 changes: 1 addition & 32 deletions app/tests/archives_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pathlib import Path

import pytest
from django.contrib.humanize.templatetags.humanize import naturaltime
from guardian.shortcuts import assign_perm, remove_perm
from requests import put

Expand All @@ -15,9 +14,6 @@
from grandchallenge.cases.widgets import WidgetChoices
from grandchallenge.components.models import ComponentInterface, InterfaceKind
from grandchallenge.subdomains.utils import reverse
from grandchallenge.workstations.templatetags.workstations import (
workstation_session_control_data,
)
from tests.algorithms_tests.factories import AlgorithmJobFactory, Job
from tests.archives_tests.factories import (
ArchiveFactory,
Expand Down Expand Up @@ -1352,7 +1348,7 @@ def make_request():


@pytest.mark.django_db
def test_job_list_row_template_ajax_renders(client):
def test_item_job_list_row_template_ajax_renders(client):
archive = ArchiveFactory()
editor = UserFactory()
archive.add_editor(editor)
Expand All @@ -1372,15 +1368,6 @@ def test_job_list_row_template_ajax_renders(client):
)
job.inputs.set([civ])

algorithm = job.algorithm_image.algorithm

ctrl_data = workstation_session_control_data(
workstation=algorithm.workstation,
context_object=algorithm,
algorithm_job=job,
config=algorithm.workstation_config,
)

headers = {"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"}

response = get_view_for_user(
Expand All @@ -1406,28 +1393,10 @@ def test_job_list_row_template_ajax_renders(client):
"algorithms:job-detail",
kwargs={"slug": job.algorithm_image.algorithm.slug, "pk": job.pk},
)
job_created = str(naturaltime(job.created))

response_content = json.loads(response.content.decode("utf-8"))

assert response.status_code == 200

assert response_content["recordsTotal"] == 1

assert len(response_content["data"]) == 1

assert job_details_url in response_content["data"][0][0]

assert job_created in response_content["data"][0][1]

assert algorithm.title in response_content["data"][0][2]

assert job.get_status_display() in response_content["data"][0][3]

assert "Result and images are private" in response_content["data"][0][4]

assert job.comment in response_content["data"][0][5]

assert "Empty" in response_content["data"][0][6]

assert ctrl_data in response_content["data"][0][7]