Skip to content
Snippets Groups Projects
Commit 58d2ff58 authored by Jaden Diefenbaugh's avatar Jaden Diefenbaugh
Browse files

add links to exps in tables

parent 9d3c2951
No related branches found
No related tags found
1 merge request!223Reports overhaul
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* displays a table report item * displays a table report item
*/ */
angular.module('reportApp') angular.module('reportApp')
.directive("tableItem", ['GroupsService', 'ExperimentsService', function(GroupsService, ExperimentsService){ .directive("tableItem", ['GroupsService', 'ExperimentsService', 'UrlService', function(GroupsService, ExperimentsService, UrlService){
return { return {
scope: { scope: {
group: '=', group: '=',
...@@ -139,6 +139,22 @@ angular.module('reportApp') ...@@ -139,6 +139,22 @@ angular.module('reportApp')
return str; return str;
}; };
// get experiment url for linking to exps
// returns the url if successful else false
scope.getExperimentUrl = (expName) => {
// if theres more than 2 '/' in the expName,
// its the absolute URL, and the user has access
// to view the experiment.
if(expName.split('/').length > 3){
return UrlService.getExperimentUrl(expName);
}
// else, its the short name
// (just the exp name, not including author/toolchain)
// and the user cant see the exp
return false;
};
}, },
template: ` template: `
<div ng-if='isViewingCsv.val'> <div ng-if='isViewingCsv.val'>
...@@ -167,7 +183,12 @@ angular.module('reportApp') ...@@ -167,7 +183,12 @@ angular.module('reportApp')
<tbody> <tbody>
<tr ng-repeat="exp in group.experiments | orderBy:sortFunc:sortField.isReversed"> <tr ng-repeat="exp in group.experiments | orderBy:sortFunc:sortField.isReversed">
<td ng-repeat='field in fields'> <td ng-repeat='field in fields'>
{{ getFieldVal(exp, field) }} <a ng-if='$index == 0 && getExperimentUrl(exp)' href='{{ getExperimentUrl(exp) }}'>
{{ getFieldVal(exp, field) }}
</a>
<span ng-if='!$index == 0 || !getExperimentUrl(exp)'>
{{ getFieldVal(exp, field) }}
</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment