Skip to content

Commit 4819ddd

Browse files
committed
-> Slightly more useful message about unconnected user accounts and over-large manifests
1 parent 89040fe commit 4819ddd

File tree

3 files changed

+39
-70
lines changed

3 files changed

+39
-70
lines changed

static/js/image_search.js

Lines changed: 32 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,50 +1669,38 @@ require([
16691669
filtObj = new Object();
16701670
for (ckey in window.filterObj){
16711671
if (ckey ==='Program'){
1672-
16731672
for (ind=0;ind<window.filterObj[ckey].length;ind++){
16741673
program = window.filterObj[ckey][ind];
16751674
if (program in window.projSets){
16761675
if (!('Program.'+program in window.filterObj)){
16771676
collObj= collObj.concat(window.projSets[program]);
16781677
}
1679-
}
1680-
else {
1678+
} else {
16811679
collObj.push(program);
16821680
}
16831681
}
1684-
}
1685-
else if (ckey.startsWith('Program.')){
1682+
} else if (ckey.startsWith('Program.')){
16861683
for (ind=0;ind<window.filterObj[ckey].length;ind++){
16871684
collObj.push(window.filterObj[ckey][ind]);
16881685
}
1689-
}
1690-
else{
1686+
} else {
16911687
nmA = ckey.split('.');
16921688
nm=nmA[nmA.length-1];
16931689
if (nm.endsWith('_rng')){
16941690
if (window.filterObj[ckey].type==='none'){
16951691
nm=nm.replace('_rng','');
1696-
}
1697-
else {
1692+
} else {
16981693
nm = nm.replace('_rng', '_' + window.filterObj[ckey].type);
16991694
}
17001695
if ( ('rng' in window.filterObj[ckey]) && ('none' in window.filterObj[ckey]) ){
17011696
filtObj[nm] = [window.filterObj[ckey]['rng'],'None']
1702-
}
1703-
1704-
else if ('rng' in window.filterObj[ckey]){
1697+
} else if ('rng' in window.filterObj[ckey]){
17051698
filtObj[nm] = window.filterObj[ckey]['rng']
1706-
}
1707-
else if ('none' in window.filterObj[ckey]){
1699+
} else if ('none' in window.filterObj[ckey]){
17081700
noneKey=nm.replace('_rng','');
17091701
filtObj[noneKey]=['None'];
17101702
}
1711-
1712-
1713-
1714-
}
1715-
else {
1703+
} else {
17161704
filtObj[nm] = window.filterObj[ckey];
17171705
}
17181706
}
@@ -1747,10 +1735,14 @@ require([
17471735
if (is_cohort) {
17481736
if (data.file_parts_count > data.display_file_parts_count) {
17491737
$('#file-export-option').prop('title', 'Your cohort exceeds the maximum for download.');
1750-
$('#file-manifest-max-exceeded').show();
17511738
$('#file-export-option input').prop('disabled', 'disabled');
17521739
$('#file-export-option input').prop('checked', false);
1753-
$('#bq-export-option input').prop('checked', true).trigger("click");
1740+
if(!user_is_social) {
1741+
$('#need-social-account').show();
1742+
} else {
1743+
$('#file-manifest-max-exceeded').show();
1744+
$('#bq-export-option input').prop('checked', true).trigger("click");
1745+
}
17541746
} else {
17551747
var select_box_div = $('#file-part-select-box');
17561748
var select_box = select_box_div.find('select');
@@ -2527,12 +2519,8 @@ require([
25272519
filtnm=checkBox.value;
25282520
hasCheckBox = true;
25292521
numCheckBoxes++;
2530-
}
2531-
else
2532-
{
2533-
2522+
} else {
25342523
filtnm=$(filterCat).children('.list-group-sub-item__body, .list-group-item__body, .collection-list')[0].id;
2535-
25362524
if ($(filterCat).children('.list-group-item__heading').children('input:checkbox').length>0) {
25372525
hasCheckBox = true;
25382526
numCheckBoxes++;
@@ -2662,35 +2650,26 @@ require([
26622650

26632651
if (item1 ===item2){
26642652
if ( isSeries && (curInd===0)){
2665-
26662653
var seriesNuma = parseInt( $(a).children()[1].innerText );
26672654
var seriesNumb = parseInt( $(b).children()[1].innerText );
2668-
26692655
if (seriesNuma === seriesNumb){
26702656
return 0;
2671-
}
2672-
else if (((seriesNuma > seriesNumb) )){
2657+
} else if (((seriesNuma > seriesNumb) )){
26732658
return 1;
2674-
}
2675-
else {
2659+
} else {
26762660
return -1;
26772661
}
2678-
}
2679-
else{
2662+
} else {
26802663
return 0;
26812664
}
2682-
}
2683-
2684-
else if (((item1 > item2) && asc) || ((item2 > item1) && !asc)) {
2665+
} else if (((item1 > item2) && asc) || ((item2 > item1) && !asc)) {
26852666
return 1;
2686-
}
2687-
else {
2667+
} else {
26882668
return -1
26892669
}
26902670
});
26912671
$(tbl).find('tbody').append(rowSet);
2692-
}
2693-
2672+
};
26942673

26952674
var filterItemBindings = function (filterId) {
26962675
$('#' + filterId).find('input:checkbox').on('click', function () {
@@ -2803,16 +2782,16 @@ require([
28032782

28042783
}
28052784

2806-
}
2785+
};
28072786

28082787
var addFilterBindings = function(id){
28092788
var filterCats = findFilterCats(id,false);
28102789
for (var i=0;i<filterCats.length;i++){
28112790
filterItemBindings(filterCats[i]);
28122791
}
2813-
}
2792+
};
28142793

2815-
var addSliders = function(id,initialized,hideZeros, parStr){
2794+
var addSliders = function(id,initialized,hideZeros, parStr){
28162795
$('#'+id).find('.list-group-item__body.isQuant').each(function() {
28172796
$(this).find('.more-checks').addClass('hide');
28182797
$(this).find('.less-checks').addClass('hide');
@@ -2828,7 +2807,6 @@ require([
28282807
var wNone = $(this).hasClass('wNone');
28292808
var checked = ($(this).find('.noneBut').length>0) ? $(this).find('.noneBut').find(':input')[0].checked : false;
28302809

2831-
28322810
if (!initialized) {
28332811
var slideDivId = $(this).prop('id') + '_slide';
28342812
curmin = $(this).attr('data-curmin');
@@ -2846,51 +2824,39 @@ require([
28462824
addSlider = false;
28472825
$(this).removeClass('hasSlider');
28482826
//$(this).removeClass('isActive');
2849-
}
2850-
else if (isActive){
2827+
} else if (isActive){
28512828
if (curmin === 'NA') {
28522829
min = lower;
2853-
}
2854-
else {
2830+
} else {
28552831
min = Math.min(lower, Math.floor(curmin));
28562832
}
28572833
if (curmax === 'NA'){
28582834
max = upper;
2859-
}
2860-
else {
2835+
} else {
28612836
max = Math.max(upper, Math.ceil(curmax));
28622837
}
2863-
2864-
}
2865-
else{
2838+
} else {
28662839
min = Math.floor(curmin);
28672840
max = Math.ceil(curmax);
28682841
lower=min;
28692842
upper=max;
28702843
//$(this).attr('data-curminrng', lower);
28712844
//$(this).attr('data-curmaxrng', upper);
2872-
}
28732845
}
2874-
2875-
else if (!isActive){
2846+
} else if (!isActive){
28762847
lower=min;
28772848
upper=max;
28782849
//$(this).attr('data-curminrng', lower);
28792850
//$(this).attr('data-curmaxrng', upper);
28802851
}
2881-
2882-
28832852
}
28842853

2885-
28862854
if (addSlider) {
28872855
$(this).addClass('hasSlider');
28882856
mkSlider($(this).prop('id'), min, max, 1, true, wNone, parStr, $(this).data('filter-attr-id'), $(this).data('filter-display-attr'), lower, upper, isActive,checked);
2889-
}
2890-
else{
2857+
} else{
28912858
$(this).removeClass('hasSlider');
28922859
//$(this).removeClass('isActive');
2893-
28942860
}
28952861
});
28962862
};
@@ -2952,10 +2918,8 @@ require([
29522918
// For collection list
29532919
$('.collection-list').each(function() {
29542920
var $group = $(this);
2955-
29562921
var checkboxes = $group.find("input:checked");
2957-
if (checkboxes.length > 0)
2958-
{
2922+
if (checkboxes.length > 0) {
29592923
var values = [];
29602924
var my_id = "";
29612925
checkboxes.each(function() {
@@ -3040,7 +3004,6 @@ require([
30403004
var cohort_loaded = false;
30413005
function load_preset_filters() {
30423006
if (is_cohort && !cohort_loaded) {
3043-
console.debug("Unloaded cohort found, loading...");
30443007
var loadPending = load_filters(cohort_filters);
30453008
loadPending.done(function () {
30463009
console.debug("Load pending complete.");
@@ -3060,7 +3023,7 @@ require([
30603023
} else if (Object.keys(filters_for_load).length > 0) {
30613024
var loadPending = load_filters(filters_for_load);
30623025
loadPending.done(function () {
3063-
console.debug("External filter load done.");
3026+
//console.debug("External filter load done.");
30643027
});
30653028
} else {
30663029
// check for localStorage key of saved filters from a login
@@ -3070,7 +3033,7 @@ require([
30703033
if (has_sliders) {
30713034
let loadPending = load_sliders(ANONYMOUS_SLIDERS, !has_filters);
30723035
loadPending.done(function () {
3073-
console.debug("Sliders loaded from anonymous login.");
3036+
//console.debug("Sliders loaded from anonymous login.");
30743037
});
30753038
}
30763039
if (has_filters) {

templates/cohorts/cohort_details.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ <h3 class="pull-left" role="heading" aria-level="1">Cohort Name: {{ cohort.name
8585
<script>
8686
var cohort_filters = {{ cohort_filters|safe }};
8787
var is_cohort = true;
88-
var collection_tooltips = {{ collection_tooltips|safe }};
8988
var cohort_version = "{{ cohort_version|safe }}";
9089
var cohort_id = "{{ cohort_id|safe }}";
90+
var user_is_social = {% if is_social %}true{% else %}false{% endif %};
91+
var collection_tooltips = {{ collection_tooltips|safe }};
9192
</script>
9293
<script type="text/javascript" src="{% static 'js/libs/d3.v5.min.js' %}"></script>
9394
{{ block.super }}

templates/cohorts/export-manifest-modal.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ <h4 class="modal-title" id="exportManifestModal">Export Cohort Manifest</h4>
2222
<button type="button" class="close" data-hide="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
2323
Your manifest is too large to be downloaded. Please use our BigQuery export option. (This requires a Google Account login.)
2424
</div>
25+
<div id="need-social-account" class="alert alert-warning alert-dismissable" style="display: none;">
26+
<button type="button" class="close" data-hide="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
27+
Your cohort exceeds the maximum size allowed for download, but your account doesn't appear to be a linked Google account.
28+
A Google linked account is required for BigQuery table export.
29+
</div>
2530
</div>
2631
</div>
2732

0 commit comments

Comments
 (0)