Skip to content

Commit

Permalink
change view-server layer data when change node selection and open vie…
Browse files Browse the repository at this point in the history
…w-server layer
  • Loading branch information
denzelsN committed Apr 10, 2017
1 parent 8883c8d commit fe79ba8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
67 changes: 37 additions & 30 deletions web/src/main/webapp/features/serverList/server-list.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
tooltipService.init( "serverList" );
*/
var showLayer = function() {
function showLayer() {
$element.animate({
"right": 421
}, 500, function() {});
};
var showChart = function( instanceName, histogram, timeSeriesHistogram ) {
}
function showChart( instanceName, histogram, timeSeriesHistogram ) {
scope.selectedAgent = instanceName;
scope.$broadcast('changedCurrentAgent.forServerList', instanceName );
if ( bInitialized ) {
Expand All @@ -43,7 +43,34 @@
scope.$broadcast('loadChartDirective.initAndRenderWithData.forServerList', timeSeriesHistogram, '100%', '220px', false, true);
bInitialized = true;
}
};
}
function setData(bIsNodeServer, node, oNavbarVoService) {
scope.bIsNode = bIsNodeServer;
scope.node = node;
scope.oNavbarVoService = oNavbarVoService;
scope.hasScatter = false;
if ( bIsNodeServer ) {
if ( node.isWas ) {
scope.hasScatter = true;
}
scope.serverList = node.serverList;
scope.bIsNode = true;
scope.$broadcast('scatterDirective.initializeWithNode.forServerList', node);

$timeout(function() {
var instanceName = $element.find( "._node input[type=radio][checked]" ).val();
showChart( instanceName, scope.node.agentHistogram[instanceName], scope.node.agentTimeSeriesHistogram[instanceName] );
});
} else {
scope.linkList = scope.node.sourceHistogram;
scope.bIsNode = false;

$timeout(function () {
var instanceName = $element.find("._link input[type=radio][checked]").val();
showChart( instanceName, scope.node.sourceHistogram[instanceName], scope.node.sourceTimeSeriesHistogram[instanceName]);
});
}
}
scope.hideLayer = function( delay ) {
delay = delay || 100;
$element.animate({
Expand Down Expand Up @@ -82,35 +109,15 @@
}
bVisible = true;
if ( angular.isUndefined( scope.node ) || scope.node === null || ( scope.node.key !== node.key ) ) {
scope.bIsNode = bIsNodeServer;
scope.node = node;
scope.oNavbarVoService = oNavbarVoService;
scope.hasScatter = false;
if ( bIsNodeServer ) {
if ( node.isWas ) {
scope.hasScatter = true;
}
scope.serverList = node.serverList;
scope.bIsNode = true;
scope.$broadcast('scatterDirective.initializeWithNode.forServerList', node);

$timeout(function() {
var instanceName = $element.find( "._node input[type=radio][checked]" ).val();
showChart( instanceName, scope.node.agentHistogram[instanceName], scope.node.agentTimeSeriesHistogram[instanceName] );
});
} else {
scope.linkList = scope.node.sourceHistogram;
scope.bIsNode = false;

$timeout(function () {
var instanceName = $element.find("._link input[type=radio][checked]").val();
showChart( instanceName, scope.node.sourceHistogram[instanceName], scope.node.sourceTimeSeriesHistogram[instanceName]);
});
}
setData(bIsNodeServer, node, oNavbarVoService);
}
showLayer();
});

scope.$on('serverListDirective.setData', function ( event, bIsNodeServer, node, oNavbarVoService ) {
if ( angular.isUndefined( scope.node ) || scope.node === null || ( scope.node.key !== node.key ) ) {
setData(bIsNodeServer, node, oNavbarVoService);
}
});
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
scope.$on("sidebarTitleDirective.initialize." + scope.namespace, function (event, oSidebarTitleVoService, node, navbarVoService) {
initialize( oSidebarTitleVoService, node, navbarVoService );
initializeAgentList( node );
$rootScope.$broadcast("serverListDirective.setData", bIsNode, htLastNode, oNavbarVoService);
});

/**
Expand Down

0 comments on commit fe79ba8

Please sign in to comment.