fng-reports 0.12.0-beta.274 → 0.12.0-beta.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/fng-reports.js +31 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-reports",
3
- "version": "0.12.0-beta.274",
3
+ "version": "0.12.0-beta.276",
4
4
  "description": "Reporting plugin for forms-angular",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "angular-messages": "1.8.3",
34
34
  "angular-mocks": "1.8.3",
35
35
  "angular-sanitize": "1.8.3",
36
- "forms-angular": "0.12.0-beta.274",
36
+ "forms-angular": "0.12.0-beta.276",
37
37
  "grunt": "^1.5.3",
38
38
  "grunt-autoprefixer": "3.0.4",
39
39
  "grunt-concurrent": "3.0.0",
@@ -28,35 +28,44 @@ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$q', '$filter
28
28
  $scope.gridOptions.plugins.forEach(function (p) {
29
29
  p.init($scope, gridApi.grid, null);
30
30
  });
31
- gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem) {
31
+ gridApi.selection.on.rowSelectionChanged($scope, function afterSelectionChange(rowItem, event) {
32
32
  var url = $scope.reportSchema.drilldown;
33
33
  if (url) {
34
34
  if (typeof url === 'string') {
35
- url = RoutingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
36
- var param = match.slice(1, -1),
37
- isParamTest = /\((.+)\)/.exec(param);
38
- if (isParamTest) {
39
- var instructions = $scope.reportSchema.params[isParamTest[1]];
40
- if (instructions && $scope.record) {
41
- $scope.param = $scope.record[isParamTest[1]];
42
- if (instructions.conversionExpression) {
43
- return $scope.$eval(instructions.conversionExpression);
35
+ // See if we are in an A tag, in which case we don't need to do anything
36
+ let inATag = event.target.tagName === 'A';
37
+ let elm = event.target;
38
+ do {
39
+ elm = elm.parentElement;
40
+ inATag = (elm.tagName === 'A');
41
+ } while (elm && !inATag && elm !== rowItem);
42
+ if (!inATag) {
43
+ url = RoutingService.buildUrl(url.replace(/\|.+?\|/g, function (match) {
44
+ var param = match.slice(1, -1),
45
+ isParamTest = /\((.+)\)/.exec(param);
46
+ if (isParamTest) {
47
+ var instructions = $scope.reportSchema.params[isParamTest[1]];
48
+ if (instructions && $scope.record) {
49
+ $scope.param = $scope.record[isParamTest[1]];
50
+ if (instructions.conversionExpression) {
51
+ return $scope.$eval(instructions.conversionExpression);
52
+ } else {
53
+ return instructions.value;
54
+ }
44
55
  } else {
45
- return instructions.value;
56
+ if ($scope.reportSchema.params[isParamTest[1]]) {
57
+ return $scope.reportSchema.params[isParamTest[1]].value || '';
58
+ } else {
59
+ console.error('No value for ' + isParamTest[1]);
60
+ return 'ERR';
61
+ }
46
62
  }
47
63
  } else {
48
- if ($scope.reportSchema.params[isParamTest[1]]) {
49
- return $scope.reportSchema.params[isParamTest[1]].value ||'';
50
- } else {
51
- console.error('No value for ' + isParamTest[1]);
52
- return 'ERR';
53
- }
64
+ return rowItem.entity[param];
54
65
  }
55
- } else {
56
- return rowItem.entity[param];
57
- }
58
- }));
59
- window.location = url;
66
+ }));
67
+ window.location = url;
68
+ }
60
69
  } else {
61
70
  console.error('Was expecting drilldown to be string but it was ' + typeof url + ' (' + url + ')'); // trying to track down Sentry 3037641567
62
71
  }