Skip to content

Commit

Permalink
[ALS-5208] Remove Open Access from Authorized BDC
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 committed Nov 30, 2023
1 parent c433619 commit 7445652
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
<a class="header-btn authorized-access-visible header-navigation" data-href="/picsureui/queryBuilder" href="#" id="query-builder-btn" tabindex="-1" title="Authorized Access" aria-label="Authorized Access">Authorized Access</a>
{{/contains}}
{{#contains privileges 'FENCE_PRIV_OPEN_ACCESS'}}
<a class="header-btn header-navigation" data-href="/picsureui/openAccess#" href="#" id="open-access-btn" tabindex="-1" title="Open Access" aria-label="Open Access">Open Access</a>
<a id="api-btn" data-href="/picsureui/api" class="header-navigation header-btn authenticated-visible" href="#" tabindex="-1" title="API" aria-haspopup="true" aria-label="API">API</a>
<button data-intro="#help-header-button" data-sequence="14" class="dropdown-toggle nav-dropdown header-btn authenticated-visible" aria-expanded="false" id="help-dropdown-toggle" tabindex="-1" title="Help" aria-label="Help dropwdown" aria-controls="help-menu-list">
Help <i class="fa fa-caret-down" aria-hidden="true"></i>
Expand Down
53 changes: 0 additions & 53 deletions biodatacatalyst-ui/src/main/webapp/picsureui/overrides/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,6 @@ define(["backbone", "handlebars", "studyAccess/studyAccess", "picSure/settings",
});
};

let displayOpenAccess = function() {
sessionStorage.setItem("isOpenAccess", true);
Backbone.pubSub.trigger('destroySearchView');
$(".header-btn.active").removeClass('active');
$(".header-btn[data-href='/picsureui/openAccess#']").addClass('active');
$('#main-content').empty();
$('#main-content').append(this.layoutTemplate(settings));
const toolSuiteView = new ToolSuiteView({
el: $('#tool-suite-panel'),
isOpenAccess: true
});

const outputPanelView = new outputPanel.View({toolSuiteView: toolSuiteView});
const query = queryBuilder.generateQueryNew({}, {}, null, settings.openAccessResourceId);
outputPanelView.render();
$('#query-results').append(outputPanelView.$el);

const parsedSess = JSON.parse(sessionStorage.getItem("session"));

const searchView = new SearchView({
queryTemplate: JSON.parse(parsedSess.queryTemplate),
queryScopes: parsedSess.queryScopes,
el : $('#filter-list')
});

if($('#search-results-panel').is(":visible")) {
$('#guide-me-button-container').hide();
}

const filterListView = new FilterListView({
outputPanelView : outputPanelView,
el : $('#filter-list-panel')
});
filterListView.render();
toolSuiteView.render();
};

let displayAPI = function() {
$(".header-btn.active").removeClass('active');
$(".header-btn[data-href='/picsureui/api']").addClass('active');
Expand All @@ -91,22 +54,6 @@ define(["backbone", "handlebars", "studyAccess/studyAccess", "picSure/settings",
* "picsureui/queryBuilder2" : function() { renderQueryBuilder2(); }
*/
"picsureui/dataAccess" : displayDataAccess,
"picsureui/openAccess" : function() {
let genomicFilters = getGenomicFilters();
if (genomicFilters.length>0) {
if (confirm(genomicFilterWarningText)) {
filterModel.get('activeFilters').remove(genomicFilters, {silent: true});
displayOpenAccess.call(this);
} else {
// go back to the previous page. Since we do not currently track the previous page with
// backbone js we have to use the browser history to go back two pages. Since a user
// must've visited our page and selected filters this should be safe.
window.history.go(-2);
}
} else {
displayOpenAccess.call(this);
}
},
"picsureui/queryBuilder(/)" : function() {
sessionStorage.setItem("isOpenAccess", false);
let antiScopes = getInvalidActiveFilters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,8 @@ remove when above bug is fixed */
}

.explor-panel {
width: 1000px;
height: 350px;
width: 650px;
min-height: 400px;
margin-bottom: 0;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,97 +1,78 @@
<style>
.plain-list li i {
width: 50%;
}
.plain-list li span {
width: 50%;
align-content: center;
}
.plain-list li{
margin-top: .5em;
}
.panel-heading div {
width: 50%;
}
</style>
<div class="center-panel">
<div class="panel panel-outline explor-panel">
<div class="panel-heading no-border center-panel">
<div class="side-border heading-space">
<div>
<h4 class="access-title">Authorized Access</h4>
<button type="button" data-href="/picsureui/queryBuilder" aria-label="Explore Authorized Access"
<div style="text-align: center">
<h4 class="access-title">Authorized Access</h4>
<button type="button" data-href="/picsureui/queryBuilder" aria-label="Explore Authorized Access"
{{#if authorizedAccess}}class="btn btn-primary btn-blue clickable-button"{{/if}}
{{#unless authorizedAccess}}class="btn btn-primary btn-grey"{{/unless}}
{{#unless authorizedAccess}}disabled="disabled"{{/unless}}>
Explore Now
</button>
</div>
<div class="participants-container">
<h4 class="">{{auth_studies_cnt}} Studies</h4>
<h5 class="" id="authorized-participants"></h5>
<div id="authorized-participants-spinner"></div>
</div>
{{#unless authorizedAccess}}class="btn btn-primary btn-grey"{{/unless}}
{{#unless authorizedAccess}}disabled="disabled"{{/unless}}>
Explore Now
</button>
</div>
<div class="heading-space">
<div>
<h4 class="access-title">Open Access</h4>
<button type="button" class="btn btn-primary btn-blue clickable-button" data-href="/picsureui/openAccess" aria-label="Explore Open Access">Explore Now</button>
</div>
<div class="participants-container">
<h4 id="open-studies-count" class=""></h4>
<h5 id="open-participants" class=""></h5>
<div id="open-participants-spinner"></div>
</div>
<div class="participants-container">
<h4 class="">{{auth_studies_cnt}} Studies</h4>
<h5 class="" id="authorized-participants"></h5>
<div style="width: 25%" id="authorized-participants-spinner"></div>
</div>
</div>
<div class="panel-body" style="display: flex;">
<div class="body-space side-border">
<ul class="plain-list">
<li style="display: flex; flex-direction:row">
<i class="fa-regular fa-address-card" aria-hidden="true"></i>
<i class="fa-solid fa-dna" aria-hidden="true"></i>
<span>Authorized Phenotypic and Genomic Datasets</span>
</li>
<li>
<i class="fa fa-users" aria-hidden="true"></i>
<span>Aggregate Counts</span>
</li>
<li>
<i class="fa-regular fa-user" aria-hidden="true"></i>
<span>Participant-level Data</span>
</li>
<li>
<i class="fa fa-pie-chart" aria-hidden="true"></i>
<span>Visualizations</span>
</li>
<li>
<i class="fa-solid fa-laptop-code" aria-hidden="true"></i>
<span>R and Python API Access</span>
</li>
</ul>
</div>
<div class="body-space">
<ul class="plain-list">
<li>
<i class="fa-regular fa-circle-check" aria-hidden="true"></i>
<span>No Authorization Required</span>
</li>
<li>
<i class="fa-regular fa-address-card" aria-hidden="true"></i>
<span>All Phenotypic Datasets Available in PIC-SURE</span>
</li>
<li>
<i class="fa fa-users" aria-hidden="true"></i>
<span>Aggregate Counts Only</span>
</li>
<li>
<i class="fa-solid fa-laptop-code" aria-hidden="true"></i>
<span>R and Python API Access</span>
</li>
</ul>
</div>
</div>
<div style="margin-top: 1em;">
<ul class="plain-list">
<li style="display: flex; flex-direction:row;">
<i class="fa-regular fa-address-card" aria-hidden="true" style="width: 20%; margin-left: 5%"></i>
<i class="fa-solid fa-dna" aria-hidden="true" style="width: 20%; margin-right: 5%"></i>
<span>Phenotypic and Genomic Datasets</span>
</li>
<li>
<i class="fa fa-users" aria-hidden="true"></i>
<span>Aggregate Counts</span>
</li>
<li>
<i class="fa-regular fa-user" aria-hidden="true"></i>
<span>Participant-level Data</span>
</li>
<li>
<i class="fa fa-pie-chart" aria-hidden="true"></i>
<span>Visualizations</span>
</li>
<li>
<i class="fa-solid fa-laptop-code" aria-hidden="true"></i>
<span>R and Python API Access</span>
</li>
</ul>
</div>
</div>
</div>



<div id="studies-access">
<div class="space-out">
<div>
<h2 class="studies-title">Data Access Table</h2>
<h4 class="studies-sub-title">View all studies and associated information available in PIC-SURE separated by consent group. Check personalized authorization for available studies in the "Access" column.</h4>
<h4 class="studies-sub-title">View all studies and associated information available in PIC-SURE separated by
consent group. Check personalized authorization for available studies in the "Access" column.</h4>
</div>
<div class="freeze-message">
<div>{{freeze_msg}}</div>
</div>
</div>
<div class="flex-col table-responsive" style="overflow-x: visible !important;">
<table id="data-access-table" style="width:100%" class="table table-striped row-border hover" role="region" aria-label="A table showing infomation about studies included in Pic-sure. Use the first column to request access to studies."></table>
<table id="data-access-table" style="width:100%" class="table table-striped row-border hover" role="region"
aria-label="A table showing infomation about studies included in Pic-sure. Use the first column to request access to studies."></table>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ define(["jquery", "backbone", "handlebars", "text!studyAccess/studyAccess.hbs",
open_cnts: {},
auth_cnts: {},
resources: {
open: settings.openAccessResourceId,
auth: settings.picSureResourceId
}
};
Expand Down Expand Up @@ -90,11 +89,7 @@ define(["jquery", "backbone", "handlebars", "text!studyAccess/studyAccess.hbs",
this.records.denied.sort(funcSort);
this.records.na.sort(funcSort);

// count the number of studies (accessible and total)
var allRecs = [].concat(this.records.permitted, this.records.denied, this.records.na);
var temp = allRecs.map((rec) => { return rec.study_identifier; });
temp = [...new Set(temp)];
studyAccess.open_cnts.studies = temp.length;
// get counts for studies and participants
var temp = this.records.permitted.map((rec) => { return rec.study_identifier; });
temp = [...new Set(temp)];
studyAccess.auth_cnts.studies = temp.length;
Expand All @@ -111,7 +106,6 @@ define(["jquery", "backbone", "handlebars", "text!studyAccess/studyAccess.hbs",
// get counts for studies and participants
this.records.auth_studies_cnt = studyAccess.auth_cnts.studies;
this.records.auth_participants_cnt = studyAccess.auth_cnts.participants;
this.records.open_participants_cnt = studyAccess.open_cnts.participants;
this.records.freeze_msg = studyAccess.freezeMsg;
this.records.authorizedAccess = !!this.authorizedAccess;

Expand Down Expand Up @@ -144,36 +138,6 @@ define(["jquery", "backbone", "handlebars", "text!studyAccess/studyAccess.hbs",
spinner.medium(deferredParticipants, "#authorized-participants-spinner", "spinner1");
}

if (studyAccess.resources.open !== false) {
search.execute("\\_studies\\",
function(response) {
let openStudies = response.suggestions.length;
$('#open-studies-count').html(openStudies + " Studies");

var query = queryBuilder.generateQueryNew({}, {}, null, studyAccess.resources.open);
query.query.expectedResultType = "CROSS_COUNT";
query.query.crossCountFields = [STUDY_CONSENTS];
var deferredParticipants = $.ajax({
url: window.location.origin + "/picsure/query/sync",
type: 'POST',
headers: {"Authorization": "Bearer " + JSON.parse(sessionStorage.getItem("session")).token},
contentType: 'application/json',
data: JSON.stringify(query),
success: (function (response) {
const parsedCountString = response[STUDY_CONSENTS] ? parseInt(response[STUDY_CONSENTS]).toLocaleString() + " Participants" : "Count Unavailable";
$("#open-participants").html(parsedCountString);
}).bind(this),
statusCode: {
401: function(){
}
},
error: transportErrors.handleAll
});
spinner.medium(deferredParticipants, "#open-participants-spinner", "spinner2");
},
studyAccess.resources.open);
}

this.dataAccessTable = $('#data-access-table').DataTable({
data: [...this.records.permitted, ...this.records.denied],
searching: true,
Expand Down

0 comments on commit 7445652

Please sign in to comment.