Skip to content

Commit

Permalink
Merge branch 'ui-v2' of https://github.com/IGS/gEAR into ui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Jan 20, 2024
2 parents ef1d85a + 8fcc5b5 commit e343af3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion www/expression.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h3 class="mt-3 ml-3 mr-6">Search<br />results (<span id="gene-result-count"></s
<div id="annotation-and-grid-c" class="column">
<h3 class="mb-2 mt-0">
Showing results for:
<span id="currently-selected-gene">Sox2</span>
<span id="currently-selected-gene"></span>
<span id="currently-selected-gene-product" class="is-hidden"></span>
</h3>
<section id="annotation-panel" class="pl-3 pr-3 pb-3 mb-3">
Expand Down
15 changes: 14 additions & 1 deletion www/js/expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ document.addEventListener('DOMContentLoaded', () => {
try {
const [annotRes, tilegridRes] = await Promise.allSettled([fetchGeneAnnotations(), setupTileGrid(selected_dc_share_id)]);
tilegrid = tilegridRes.value;

// auto-select the first gene in the list
const first_gene = document.querySelector('.gene-result-list-item');
if (first_gene) {
first_gene.click();
}

} catch (error) {
logErrorInConsole(error);
}
Expand All @@ -89,7 +96,9 @@ document.addEventListener('DOMContentLoaded', () => {
if (!event.target.classList.contains('gene-result-list-item')) {
return;
}

const gene_symbol = event.target.textContent;
document.querySelector('#currently-selected-gene').innerHTML = gene_symbol;

// remove is-selected from all the existing rows, then add it to this one
const rows = document.querySelectorAll('.gene-result-list-item');
Expand Down Expand Up @@ -269,7 +278,11 @@ const setupTileGrid = async (layout_share_id) => {
tilegrid.applyTileGrid(is_multigene);
await tilegrid.addAllDisplays();
await tilegrid.addDefaultDisplays();
await tilegrid.renderDisplays(selected_genes, is_multigene, svg_scoring_method);

// Don't render yet if a gene is not selected
if (currently_selected_gene_symbol) {
await tilegrid.renderDisplays(selected_genes, is_multigene, svg_scoring_method);
}
} catch (error) {
logErrorInConsole(error);
} finally {
Expand Down

0 comments on commit e343af3

Please sign in to comment.