stackviz/app/js/directives/timeline-details.js
Tim Buckley d84e984fb7 Add timeline view with Angular support.
This re-adds the Tempest timeline view as a set of Angular
directives. This includes related functionality, such as the Dstat
parser and some array utilities. The timeline view consists of
a timeline component, which includes the d3 chart, and a separate
details component, which shows additional information for tests
when selected in the timeline.

Change-Id: Ifaaeda91b0617e8cf7a60d30728005f5c8d00546
2015-10-29 13:58:35 -06:00

45 lines
922 B
JavaScript

'use strict';
var directivesModule = require('./_index.js');
/**
* @ngInject
*/
function timelineDetails() {
var controller = function($scope) {
$scope.item = null;
$scope.$watch('hoveredItem', function(value) {
if (value && !$scope.selectedItem) {
$scope.item = value;
} else if (!value && !$scope.selectedItem) {
$scope.item = null;
}
});
$scope.$watch('selectedItem', function(value) {
if (value) {
$scope.item = value;
} else {
if ($scope.hoveredItem) {
$scope.item = $scope.hoveredItem;
} else {
$scope.item = null;
}
}
});
};
return {
restrict: 'EA',
scope: {
'hoveredItem': '=',
'selectedItem': '='
},
controller: controller,
templateUrl: 'directives/timeline-details.html'
};
}
directivesModule.directive('timelineDetails', timelineDetails);