Skip to content

Commit

Permalink
Merge pull request #14 from Blackbaud-MatthewBell/kpi-dashboard-impro…
Browse files Browse the repository at this point in the history
…vements

More feature for KPI dashboards
  • Loading branch information
Blackbaud-MatthewBell committed Aug 22, 2017
2 parents 02d8742 + 4cc14e8 commit a7388c3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
21 changes: 19 additions & 2 deletions js/src/datamartreport/datamartreport.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,11 @@
if (projectId && domain) {
reportUrl = domain + '/dashboards/embedded/#/project/';
reportUrl += projectId;
reportUrl += '/reportId/edit';

if ($scope.multiple) {
reportUrl += '?showNavigation=true';
}

resolve(reportUrl);
}
});
Expand All @@ -303,6 +307,14 @@

setiFrameUrl();
});

$scope.handleFrameEvent = function (message) {
if ($scope.autoSize) {
if (message.event.name === 'resized' && message.event.data && message.event.data.height) {
$scope.frameHeight = (message.event.data.height) + 'px';
}
}
};
}

function link($scope, el) {
Expand Down Expand Up @@ -375,7 +387,8 @@
kpiDashboardController($scope);
}],
reportLink: link,
dashboardLink: link
dashboardLink: link,
kpiDashboardLink: link
};
}])

Expand Down Expand Up @@ -494,6 +507,7 @@
* @param {directive} bb-data-mart-kpi-dashboard
* @param {directive} [bb-data-mart-kpi-dashboard.height] Sets the height attribute of the iFrame.
* @param {directive} [bb-data-mart-kpi-dashboard.width] Sets the width attribute of the iFrame.
* @param {directive} [bb-data-mart-kpi-dashboard.bb-data-mart-kpi-dashboard-multiple] If true, allows creating and editing multiple dashboards.
* @param {directive} [bb-data-mart-kpi-dashboard.bb-data-mart-designer-api] Overrides the default BBDataMartAPI used by the directive.
*/
.directive('bbDataMartKpiDashboard', ['bbDataMartReportService', function (bbDataMartReportService) {
Expand All @@ -504,8 +518,11 @@
scope: {
frameHeight: '@height',
frameWidth: '@width',
multiple: '=bbDataMartKpiDashboardMultiple',
autoSize: '=bbDataMartKpiDashboardAutoSize',
api: '=bbDataMartKpiDashboardApi'
},
link: bbDataMartReportService.kpiDashboardLink,
controller: bbDataMartReportService.kpiDashboardController
};
}]);
Expand Down
1 change: 1 addition & 0 deletions js/src/datamartreport/docs/datamartreport.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ Directive for displaying the KPI Dashboard on a page. When loaded, the directive
- `bb-data-mart-kpi-dashboard`
- `height` - ( _Optional_ ) Sets the height attribute of the iFrame.
- `width` - ( _Optional_ ) Sets the width attribute of the iFrame.
- `bb-data-mart-kpi-dashboard-multiple` - ( _Optional_ ) If true, allows creating and editing multiple dashboards.
- `bb-data-mart-designer-api` - ( _Optional_ ) Overrides the default BBDataMartAPI used by the directive.
Expand Down
14 changes: 12 additions & 2 deletions js/src/datamartreport/test/datamartreport.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,17 @@
$scope.$digest();

expect(el.find('iframe').length).toBe(1);
expect(el.find('iframe').attr('src')).toBe(DOMAIN + '/dashboards/embedded/#/project/' + PROJECTID + '/reportId/edit');
expect(el.find('iframe').attr('src')).toBe(DOMAIN + '/dashboards/embedded/#/project/' + PROJECTID);
});

it('KPI Dashboard supporting multiple dashboards should create an iframe with the correct URL', function () {
var $scope = $rootScope.$new(),
el = $compile('<bb-data-mart-kpi-dashboard bb-data-mart-kpi-dashboard-multiple="true"/>')($scope);

$scope.$digest();

expect(el.find('iframe').length).toBe(1);
expect(el.find('iframe').attr('src')).toBe(DOMAIN + '/dashboards/embedded/#/project/' + PROJECTID + '?showNavigation=true');
});

it('Data mart designer should maintain authentication with GoodData while it is on the page', function () {
Expand Down Expand Up @@ -318,7 +328,7 @@
$scope.$digest();

expect(el.find('iframe').length).toBe(1);
expect(el.find('iframe').attr('src')).toBe(DOMAIN + '/dashboards/embedded/#/project/' + PROJECTID + '/reportId/edit');
expect(el.find('iframe').attr('src')).toBe(DOMAIN + '/dashboards/embedded/#/project/' + PROJECTID);
});
});
}());

0 comments on commit a7388c3

Please sign in to comment.