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

Visit Filter on query and archive thumbnails pages #1412

Merged
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
19 changes: 14 additions & 5 deletions jwql/website/apps/jwql/data_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1968,23 +1968,29 @@ def thumbnails_ajax(inst, proposal, obs_num=None):

# Extract information for sorting with dropdown menus
# (Don't include the proposal as a sorting parameter if the proposal has already been specified)
detectors, proposals = [], []
detectors, proposals, visits = [], [], []
for rootname in list(data_dict['file_data'].keys()):
proposals.append(data_dict['file_data'][rootname]['filename_dict']['program_id'])
try: # Some rootnames cannot parse out detectors
detectors.append(data_dict['file_data'][rootname]['filename_dict']['detector'])
except KeyError:
pass
try: # Some rootnames cannot parse out visit
visits.append(data_dict['file_data'][rootname]['filename_dict']['visit'])
except KeyError:
pass

if proposal is not None:
dropdown_menus = {'detector': sorted(detectors),
'look': THUMBNAIL_FILTER_LOOK,
'exp_type': sorted(exp_types)}
'exp_type': sorted(exp_types),
'visit': sorted(visits)}
else:
dropdown_menus = {'detector': sorted(detectors),
'proposal': sorted(proposals),
'look': THUMBNAIL_FILTER_LOOK,
'exp_type': sorted(exp_types)}
'exp_type': sorted(exp_types),
'visit': sorted(visits)}

data_dict['tools'] = MONITORS
data_dict['dropdown_menus'] = dropdown_menus
Expand Down Expand Up @@ -2079,10 +2085,13 @@ def thumbnails_query_ajax(rootnames):
rootname in list(data_dict['file_data'].keys())]
proposals = [data_dict['file_data'][rootname]['filename_dict']['program_id'] for
rootname in list(data_dict['file_data'].keys())]
visits = [data_dict['file_data'][rootname]['filename_dict']['visit'] for
rootname in list(data_dict['file_data'].keys())]

dropdown_menus = {'instrument': instruments,
'detector': detectors,
'proposal': proposals}
'detector': sorted(detectors),
BradleySappington marked this conversation as resolved.
Show resolved Hide resolved
'proposal': sorted(proposals),
'visit': sorted(visits)}

data_dict['tools'] = MONITORS
data_dict['dropdown_menus'] = dropdown_menus
Expand Down
3 changes: 2 additions & 1 deletion jwql/website/apps/jwql/static/js/jwql.js
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,8 @@ function update_thumbnail_array(data) {
var content = '<div class="thumbnail" data-instrument="' + instrument +
'" data-detector="' + filename_dict.detector + '" data-proposal="' + filename_dict.program_id +
'" data-file_root="' + rootname + '" data-group_root="' + filename_dict.group_root +
'" data-exp_start="' + file.expstart + '" data-look="' + viewed + '" data-exp_type="' + exp_type + '">';
'" data-exp_start="' + file.expstart + '" data-look="' + viewed + '" data-exp_type="' + exp_type +
'" data-visit="' + filename_dict.visit + '">';
content += '<div class="thumbnail-group">'
content += '<a class="thumbnail-link" href="#" data-image-href="/' +
instrument + '/' + rootname + '/" data-group-href="/' +
Expand Down
Loading