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

[WIP] Jdaviz integration #1658

Open
wants to merge 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
33ee243
First try at adding JDaviz to image explorer
york-stsci Nov 22, 2024
f82e328
Merge branch 'spacetelescope:develop' into jdaviz_integration
york-stsci Nov 25, 2024
a08fc7a
Updated image template to a different frame format
york-stsci Nov 25, 2024
f5256e3
Trying safe for the iframe
york-stsci Nov 25, 2024
7354f33
Trying a change to X-Frame-Options
york-stsci Nov 25, 2024
a2c8a7b
Removed X-Frame-Options because it doesn't help with this issue, and …
york-stsci Nov 25, 2024
be1437b
Trying to allow django to load this particular frame over non-https
york-stsci Nov 25, 2024
520bc6e
Trying reverse proxy
york-stsci Nov 25, 2024
36f6cdd
Hopefully fixing typo in setting up proxy as absolute page
york-stsci Nov 25, 2024
ee85845
Adding X-FRAME-OPTIONS setting to allow self-embed for reverse proxy
york-stsci Nov 25, 2024
9bcd5fd
Turned the quicklook into a regular expression path because the rever…
york-stsci Nov 25, 2024
5bd807f
Try to make the path bare to avoid route conflict issues
york-stsci Nov 25, 2024
a2935ea
Updating policies for django
york-stsci Nov 25, 2024
93c7dd0
Trying adding a forwarded header to solara
york-stsci Nov 25, 2024
e21f17d
Trying doing quickview as an explicit path
york-stsci Nov 26, 2024
b3923e5
Increasing size of iframe
york-stsci Nov 26, 2024
f258e0a
First attempt at image exploration with jdaviz nginx
york-stsci Nov 27, 2024
e037942
Trying another way to populate the frame
york-stsci Nov 27, 2024
55bafe3
Trying https version
york-stsci Nov 27, 2024
d4ceb12
Trying https version
york-stsci Nov 27, 2024
931470a
Trying a way to do pre-path
york-stsci Nov 27, 2024
a0b581f
Updated proxy
york-stsci Nov 30, 2024
8cd25fb
Updated proxy
york-stsci Nov 30, 2024
524ccc6
Removed double-jdaviz URL
york-stsci Dec 9, 2024
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
71 changes: 1 addition & 70 deletions jwql/website/apps/jwql/templates/explore_image.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,77 +22,8 @@ <h3>{{ file_root }}_{{ filetype }}.fits</h3>
<div class="row">
<!-- Display the image -->
<div class="col-xl-9">
<!-- Loading animation -->
<div id="loading" class="text-center">
<div class="lds-css ng-scope">
<div style="width:100%;height:100%" class="lds-magnify">
<div>
<div>
<div>
</div>
<div>
</div>
</div>
</div>
</div>
Loading ...
</div>
</div>

<!-- Display the data -->
<div id='explore_image'></div>
<a id="explore_image_fail" style='display: none'>Image explorer failed to load</a>

<!-- Allow the user to change the settings in the image to explore -->
<h4>Data Settings</h4>
<div class="col">
<div class="row">
<input class="mr-2" type="checkbox" id="show_line_plots">
<label class="form-check-label" for="show_line_plots">Show column/row plots</label>
</div>

<div class="row">
Extension:&nbsp;&nbsp;
{% for extension in extensions %}
{% if extension == 'SCI' %}
<input type="radio" name="extension" value="{{ extension }}" id="{{ extension }}" checked="checked" onclick='explore_image_update_enable_options("{{ extension_ints }}", "{{ extension_groups }}");'> {{ extension }} &nbsp;&nbsp;&nbsp;&nbsp;
{% else %}
<input type="radio" name="extension" value="{{ extension }}" id="{{ extension }}" onclick='explore_image_update_enable_options("{{ extension_ints }}", "{{ extension_groups }}");'> {{ extension }} &nbsp;&nbsp;&nbsp;&nbsp;
{% endif %}
{% endfor %}
</div>

<div class="row">
<div class="explorer_options" id="integrationInput1">
<input type="number" id="integration1" min="0" size="3" step="1">
<label id="integration1-name" for="integration1">Integration</label>
</div>
<div class="explorer_options" id="groupInput1">
<input type="number" id="group1" min="0" size="3" step="1">
<label id="group1-name" for="group1">Group</label>
</div>
</div>
<div class="form-check" id="calcDifferenceForm">
<input class="form-check-input" type="checkbox" id="calcDifference" onclick='explore_image_update_enable_options("{{ extension_ints }}", "{{ extension_groups }}");'>
<label class="form-check-label" for="calcDifference">Calculate Difference</label>
</div>
<div class="row">
<div class="explorer_options" id="integrationInput2">
<input type="number" id="integration2" min="0" size="3" step="1">
<label id="integration2-name" for="integration2">Integration</label>
</div>
<div class="explorer_options" id="groupInput2">
<input type="number" id="group2" min="0" size="3" step="1">
<label id="group2-name" for="group2">Group</label>
</div>
</div>
</div>
<p>
<a class="btn btn-primary my-2 mx-2" role="button" onclick="update_explore_image_page('{{inst}}', '{{file_root}}', '{{filetype}}', '{{base_url}}', true)"> Apply Settings</a>
</p>
<iframe id="quickview" height="800px" width="750px" src="https://{{jdaviz_host}}/jdaviz?file={{file_path}}"></iframe>
</div>


</div>

<!-- Display the anomaly form -->
Expand Down
3 changes: 3 additions & 0 deletions jwql/website/apps/jwql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,13 @@ def explore_image(request, inst, file_root, filetype):
context = {'inst': inst,
'file_root': file_root,
'filetype': filetype,
'file_path': full_fits_file,
'extensions': extensions,
'extension_groups': extension_groups,
'extension_ints': extension_ints,
'base_url': get_base_url(),
'jdaviz_host': get_config()["jdaviz"]["host"],
'jdaviz_port': get_config()["jdaviz"]["port"],
'anomaly_form': anomaly_form,
'comment_form': comment_form}

Expand Down
8 changes: 7 additions & 1 deletion jwql/website/jwql_proj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = get_config()['django_debug']

# Security settings to allow Jdaviz quicklook
# Might well be avoidable if the Jdaviz Solara server were behind an SSH reverse proxy.
X_FRAME_OPTIONS = "SAMEORIGIN"
SECURE_CONTENT_TYPE_NOSNIFF = False

ALLOWED_HOSTS = ['*']

Expand All @@ -52,6 +56,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'revproxy.apps.RevProxyConfig'
]

MIDDLEWARE = [
Expand Down Expand Up @@ -163,4 +168,5 @@
CSRF_TRUSTED_ORIGINS = ['https://jwql.stsci.edu',
'https://jwql-test.stsci.edu',
'https://jwql-dev.stsci.edu',
'https://127.0.0.1']
'https://127.0.0.1',
'http://dljwql.stsci.edu']
8 changes: 7 additions & 1 deletion jwql/website/jwql_proj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@
"""

from django.contrib import admin
from django.urls import include, path
from django.urls import include, path, re_path
from revproxy.views import ProxyView

from ..apps.jwql import views
from jwql.utils.utils import get_config

jdaviz_host = get_config()["jdaviz"]["host"]
jdaviz_port = get_config()["jdaviz"]["port"]

# Define custom error page views
handler404 = views.not_found # Page not found
Expand All @@ -60,4 +65,5 @@
urlpatterns = [
path('', include('jwql.website.apps.jwql.urls')),
path('admin/', admin.site.urls),
re_path(r'(?P<path>quickview.*)', ProxyView.as_view(upstream=f'http://{jdaviz_host}:{jdaviz_port}', add_x_forwarded=True))
]
Loading