Skip to content

Commit

Permalink
Merge pull request #87 from PaulBoon/86-Show-names-of-subdataverses
Browse files Browse the repository at this point in the history
Issue 86: Show names of subdataverses instead of the aliases
  • Loading branch information
qqmyers authored Jun 13, 2023
2 parents 981faf9 + 18ba250 commit a2d043b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions installationplots.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $(document).ready(function() {
dvserver + '/api/info/metrics/tree' + addAlias(),
function(data) {
var nodes = data.data;
updateDisplayName(nodes.name, config);
if (typeof nodes.children !== 'undefined') {
nodes.children.forEach((node) => {
//Make each element in the tree (below the root) a link to get the metrics for that sub-dataverse
Expand All @@ -44,7 +45,7 @@ $(document).ready(function() {
$('#subtitle').html("<h2>Showing Metrics from the whole repository</h2>");
$('#selectString').html('<div>Click a sub-' + config.dataverseTerm + ' name to see its metrics</div>');
} else {
$('#subtitle').html("<h2>Showing Metrics from the " + alias + " " + config.dataverseTerm + "</h2>");
// Note that the subtitle is updated async via ajax
$('#selectString').html('<div><a href= "' + window.location.href.split('?')[0] +'">Show Metrics for the whole repository</a></div><div>Click a sub-' + config.dataverseTerm + ' name to see its metrics</div>');
}

Expand Down Expand Up @@ -538,10 +539,18 @@ function addAlias() {

//Turn dataverse names into links to the metrics page using that dataverse as the parent
function updateNames(node) {
node.name = "<a href='" + window.location.href.split("?")[0] + "?parentAlias=" + node.alias + "'>" + node.alias + "</a>";
node.name = "<a href='" + window.location.href.split("?")[0] + "?parentAlias=" + node.alias + "'>" + node.name + "</a>";
if (typeof node.children !== 'undefined') {
node.children.forEach((childnode) => {
updateNames(childnode);
});
}
}

function updateDisplayName(name, config) {
if (alias != null) {
$('#subtitle').hide();
$('#subtitle').html("<h2>Showing Metrics from the " + name + " " + config.dataverseTerm + "</h2>");
$('#subtitle').fadeIn("slow");
}
}

0 comments on commit a2d043b

Please sign in to comment.