From 3d30751e0651d84fc2f251bcc5082285513257a4 Mon Sep 17 00:00:00 2001 From: Paul Boon Date: Fri, 31 Mar 2023 11:35:59 +0200 Subject: [PATCH 1/2] Show names of subdataverses instead of the aliases --- installationplots.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/installationplots.js b/installationplots.js index ef6dd3f..73ebf89 100644 --- a/installationplots.js +++ b/installationplots.js @@ -2,6 +2,7 @@ var alias; //The Dataverse server address - can be "" if this app is deployed on the same server. var dvserver = ""; +var displayName = ""; $(document).ready(function() { @@ -24,6 +25,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 @@ -44,7 +46,7 @@ $(document).ready(function() { $('#subtitle').html("

Showing Metrics from the whole repository

"); $('#selectString').html('
Click a sub-' + config.dataverseTerm + ' name to see its metrics
'); } else { - $('#subtitle').html("

Showing Metrics from the " + alias + " " + config.dataverseTerm + "

"); + //$('#subtitle').html("

Showing Metrics from the " + alias + " " + config.dataverseTerm + "

"); $('#selectString').html('
Show Metrics for the whole repository
Click a sub-' + config.dataverseTerm + ' name to see its metrics
'); } @@ -532,10 +534,19 @@ function addAlias() { //Turn dataverse names into links to the metrics page using that dataverse as the parent function updateNames(node) { - node.name = "" + node.alias + ""; + node.name = "" + node.name + ""; if (typeof node.children !== 'undefined') { node.children.forEach((childnode) => { updateNames(childnode); }); } } + +function updateDisplayName(name, config) { + displayName = name; + if (alias != null) { + $('#subtitle').hide(); + $('#subtitle').html("

Showing Metrics from the " + displayName + " " + config.dataverseTerm + "

"); + $('#subtitle').fadeIn("slow"); + } +} \ No newline at end of file From 18ba25031fd75e21819248dff316a3d70524df68 Mon Sep 17 00:00:00 2001 From: Paul Boon Date: Tue, 4 Apr 2023 15:51:20 +0200 Subject: [PATCH 2/2] Cleanup --- installationplots.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/installationplots.js b/installationplots.js index 73ebf89..0273081 100644 --- a/installationplots.js +++ b/installationplots.js @@ -2,7 +2,6 @@ var alias; //The Dataverse server address - can be "" if this app is deployed on the same server. var dvserver = ""; -var displayName = ""; $(document).ready(function() { @@ -46,7 +45,7 @@ $(document).ready(function() { $('#subtitle').html("

Showing Metrics from the whole repository

"); $('#selectString').html('
Click a sub-' + config.dataverseTerm + ' name to see its metrics
'); } else { - //$('#subtitle').html("

Showing Metrics from the " + alias + " " + config.dataverseTerm + "

"); + // Note that the subtitle is updated async via ajax $('#selectString').html('
Show Metrics for the whole repository
Click a sub-' + config.dataverseTerm + ' name to see its metrics
'); } @@ -543,10 +542,9 @@ function updateNames(node) { } function updateDisplayName(name, config) { - displayName = name; if (alias != null) { $('#subtitle').hide(); - $('#subtitle').html("

Showing Metrics from the " + displayName + " " + config.dataverseTerm + "

"); + $('#subtitle').html("

Showing Metrics from the " + name + " " + config.dataverseTerm + "

"); $('#subtitle').fadeIn("slow"); } } \ No newline at end of file