Skip to content

Commit a2d043b

Browse files
authored
Merge pull request #87 from PaulBoon/86-Show-names-of-subdataverses
Issue 86: Show names of subdataverses instead of the aliases
2 parents 981faf9 + 18ba250 commit a2d043b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: installationplots.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ $(document).ready(function() {
2424
dvserver + '/api/info/metrics/tree' + addAlias(),
2525
function(data) {
2626
var nodes = data.data;
27+
updateDisplayName(nodes.name, config);
2728
if (typeof nodes.children !== 'undefined') {
2829
nodes.children.forEach((node) => {
2930
//Make each element in the tree (below the root) a link to get the metrics for that sub-dataverse
@@ -44,7 +45,7 @@ $(document).ready(function() {
4445
$('#subtitle').html("<h2>Showing Metrics from the whole repository</h2>");
4546
$('#selectString').html('<div>Click a sub-' + config.dataverseTerm + ' name to see its metrics</div>');
4647
} else {
47-
$('#subtitle').html("<h2>Showing Metrics from the " + alias + " " + config.dataverseTerm + "</h2>");
48+
// Note that the subtitle is updated async via ajax
4849
$('#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>');
4950
}
5051

@@ -538,10 +539,18 @@ function addAlias() {
538539

539540
//Turn dataverse names into links to the metrics page using that dataverse as the parent
540541
function updateNames(node) {
541-
node.name = "<a href='" + window.location.href.split("?")[0] + "?parentAlias=" + node.alias + "'>" + node.alias + "</a>";
542+
node.name = "<a href='" + window.location.href.split("?")[0] + "?parentAlias=" + node.alias + "'>" + node.name + "</a>";
542543
if (typeof node.children !== 'undefined') {
543544
node.children.forEach((childnode) => {
544545
updateNames(childnode);
545546
});
546547
}
547548
}
549+
550+
function updateDisplayName(name, config) {
551+
if (alias != null) {
552+
$('#subtitle').hide();
553+
$('#subtitle').html("<h2>Showing Metrics from the " + name + " " + config.dataverseTerm + "</h2>");
554+
$('#subtitle').fadeIn("slow");
555+
}
556+
}

0 commit comments

Comments
 (0)