Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Types of changes:
- `Fixed`: for any bug fixes.
- `Security`: in case of vulnerabilities.

## [x.y.z]

### Changed
- Issue report and resolve condensed to a single endpoint named `issue_handling`, functionality preserved.

## [1.12.0]

### Added
Expand Down
3 changes: 1 addition & 2 deletions app/host/static/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Disallow: /download_modelfit/
Disallow: /download_percentiles/
Disallow: /retrigger_transient/
Disallow: /reprocess_transient/
Disallow: /report_issue/
Disallow: /resolve_issue/
Disallow: /issue_handling/
Disallow: /healthz/
Disallow: /cutout_fits_plot/
Disallow: /fetch_sed_plot/
Expand Down
4 changes: 2 additions & 2 deletions app/host/templates/host/processing_status_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ <h4>Processing Status: <span class="badge {{ processing_status_badge_class }}">{
{% if item.user_warning %}
<a href="#" type="button" title="Issue reported. Click to clear. (requires authorization)"><span class="report"
{% if is_auth %}
onclick="window.open('{% url 'resolve_issue' item.pk %}','_self')"
onclick="window.open('{% url 'issue_handling' action='resolve' item_id=item.pk %}','_self')"
{% else %}
onclick="return false;"
{% endif %}
><i class="bi bi-exclamation-triangle issue-reported"></i></span></a>
{% else %}
<a href="#" type="button" title="No issues reported. Click to report an issue. (requires authorization)"><span class="report"
{% if is_auth %}
onclick="window.open('{% url 'report_issue' item.pk %}','_self')"
onclick="window.open('{% url 'issue_handling' action='report' item_id=item.pk %}','_self')"
{% else %}
onclick="return false;"
{% endif %}
Expand Down
11 changes: 3 additions & 8 deletions app/host/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,9 @@
name="retrigger_transient",
),
path(
f"""{base_path}report_issue/<item_id>""",
views.report_issue,
name="report_issue",
),
path(
f"""{base_path}resolve_issue/<item_id>""",
views.resolve_issue,
name="resolve_issue",
f"""{base_path}issue_handling/<str:action>/<int:item_id>""",
views.issue_handling,
name="issue_handling",
),
path(f"""{base_path}privacy""", views.privacy_policy, name='privacy'),
path(f"""{base_path}healthz""", views.healthz, name='healthz'),
Expand Down
22 changes: 6 additions & 16 deletions app/host/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,29 +741,19 @@ def update_home_page_statistics():
with open(os.path.join(settings.STATIC_ROOT, 'index.html'), 'w') as fp:
fp.write(html_body)


@login_required
@log_usage_metric()
def report_issue(request, item_id):
item = TaskRegister.objects.get(pk=item_id)
item.user_warning = True
item.save()
return HttpResponseRedirect(
reverse_lazy("results", kwargs={"transient_name": item.transient.name})
)


@login_required
@log_usage_metric()
def resolve_issue(request, item_id):
item = TaskRegister.objects.get(pk=item_id)
item.user_warning = False
def issue_handling(request, item_id, action):
item = get_object_or_404(TaskRegister, pk=item_id)
if action == 'report':
item.user_warning = True
elif action == 'resolve':
item.user_warning = False
item.save()
return HttpResponseRedirect(
reverse_lazy("results", kwargs={"transient_name": item.transient.name})
)


# Handler for 403 errors
def error_view(request, exception, template_name="403.html"):
return render(request, template_name)
Expand Down