| angular.module('xos.diagnostic') |
| .directive('serviceTopology', function(){ |
| controller: function($element, $window, $scope, d3, serviceTopologyConfig, ServiceRelation, Instances, Subscribers, ServiceTopologyHelper){ |
| .on('resize.service', () => { |
| console.error('Tree is missing'); |
| // TODO update instead clear and redraw |
| d3.select($element[0]).select('svg').remove(); |
| const width = el.clientWidth - (serviceTopologyConfig.widthMargin * 2); |
| const height = el.clientHeight - (serviceTopologyConfig.heightMargin * 2); |
| const treeLayout = d3.layout.tree() |
| svg = d3.select($element[0]) |
| .style('width', `${el.clientWidth}px`) |
| .style('height', `${el.clientHeight}px`) |
| const treeContainer = svg.append('g') |
| .attr('transform', `translate(${serviceTopologyConfig.widthMargin * 2},${serviceTopologyConfig.heightMargin})`); |
| // ServiceTopologyHelper.drawLegend(svg); |
| ServiceTopologyHelper.updateTree(treeContainer, treeLayout, root, el); |
| $scope.$watch(() => this.serviceChain, (chain) => { |
| if(angular.isDefined(chain)){ |