From b69f4881a69e84e14136f58ca5c7f3425bb3407e Mon Sep 17 00:00:00 2001 From: jaden <noreply@example.com> Date: Tue, 13 Jun 2017 10:01:41 +0200 Subject: [PATCH] fixed unearthed race condition after closing #12 --- .../reports/app/directives/panelExperiments.js | 18 +++++++++++++----- .../reports/app/services/experimentsService.js | 2 -- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/beat/web/reports/static/reports/app/directives/panelExperiments.js b/beat/web/reports/static/reports/app/directives/panelExperiments.js index cb42a17df..32326886e 100644 --- a/beat/web/reports/static/reports/app/directives/panelExperiments.js +++ b/beat/web/reports/static/reports/app/directives/panelExperiments.js @@ -36,6 +36,9 @@ angular.module('reportApp').directive("groupPanelExperiments", ['GroupsService', scope.experiments = ExperimentsService.experiments; scope.dropdownId = `${scope.group.name}_exp_add_dropdown`; + scope.getExpName = (expName) => scope.experiments[expName] ? expName : expName.split('/').pop(); + const getExp = (expName) => scope.experiments[expName] || scope.experiments[expName.split('/').pop()]; + // find experiments that are not in the group but are // compatible with the existing experiments (if any) scope.expsNotInGroup = () => { @@ -50,7 +53,12 @@ angular.module('reportApp').directive("groupPanelExperiments", ['GroupsService', // collects an array of formatted databases & protocols of an experiment // format is "<database name>@<protocol name>" scope.getExpDatabases = (expName) => { - let dbs = scope.experiments[expName].declaration.datasets; + const expObj = getExp(expName); + if(!expObj){ + return; + } + + let dbs = expObj.declaration.datasets; return Array.from(new Set(Object.values(dbs).map(db => `${db.database}@${db.protocol}`))); }; @@ -108,15 +116,15 @@ angular.module('reportApp').directive("groupPanelExperiments", ['GroupsService', <table ng-if='group.experiments.length > 0' class="table table-striped table-hover"> <thead> <tr> - <th></th> + <th ng-if='!isViewmode()'></th> <th>Alias</th> <th>Experiment</th> <th>Databases/Protocols</th> </tr> </thead> <tbody> - <tr ng-repeat='expName in group.experiments' ng-if='experiments[expName]'> - <td> + <tr ng-repeat='expName in group.experiments'> + <td ng-if='!isViewmode()'> <div class='btn-group action-buttons'> <span style='cursor: pointer;' @@ -129,7 +137,7 @@ angular.module('reportApp').directive("groupPanelExperiments", ['GroupsService', </td> <td ng-if='!isViewmode()'><input ng-model='group.aliases[expName]'></input></td> <td ng-if='isViewmode()'><span>{{ group.aliases[expName] }}</span></td> - <td><a href='{{ getExpUrl(expName) }}'>{{ expName }}</a></td> + <td><a href='{{ getExpUrl(expName) }}'>{{ getExpName(expName) }}</a></td> <td> <span ng-repeat='db in getExpDatabases(expName)'> <a href='{{ getDatabaseUrl(db.split("@")[0]) }}'>{{ db }}</a> diff --git a/beat/web/reports/static/reports/app/services/experimentsService.js b/beat/web/reports/static/reports/app/services/experimentsService.js index 1ccc16e33..1adef6fec 100644 --- a/beat/web/reports/static/reports/app/services/experimentsService.js +++ b/beat/web/reports/static/reports/app/services/experimentsService.js @@ -202,11 +202,9 @@ angular.module('reportApp').factory('ExperimentsService', ['experimentFactory', } }); - /* console.log(expData); console.log(tableData); console.log(plotData); - */ cleanGroups(rawExpNames); -- GitLab