use of org.opennms.features.topology.plugins.topo.bsm.ReductionKeyVertex in project opennms by OpenNMS.
the class BusinessServiceVertexInfoPanelItemProvider method createComponent.
private Component createComponent(AbstractBusinessServiceVertex ref, GraphContainer graphContainer) {
final FormLayout formLayout = new FormLayout();
formLayout.setSpacing(false);
formLayout.setMargin(false);
ref.accept(new BusinessServiceVertexVisitor<Void>() {
@Override
public Void visit(BusinessServiceVertex vertex) {
final BusinessService businessService = businessServiceManager.getBusinessServiceById(vertex.getServiceId());
formLayout.addComponent(createLabel("Reduce function", getReduceFunctionDescription(businessService.getReduceFunction())));
// Apply Reduce Function specific details
businessService.getReduceFunction().accept(new ReduceFunctionVisitor<Void>() {
@Override
public Void visit(HighestSeverity highestSeverity) {
return null;
}
@Override
public Void visit(HighestSeverityAbove highestSeverityAbove) {
return null;
}
@Override
public // Threshold is not very transparent, we add an Explain Button in these cases
Void visit(Threshold threshold) {
final Button explainButton = createButton("Explain", "Explain the Threshold function", FontAwesome.TABLE, (Button.ClickListener) event -> {
ThresholdExplanationWindow explainWindow = new ThresholdExplanationWindow(SimulationAwareStateMachineFactory.createSimulatedStateMachine(businessServiceManager, graphContainer.getCriteria()).explain(businessService, (Threshold) businessService.getReduceFunction()));
UI.getCurrent().addWindow(explainWindow);
});
explainButton.setStyleName(BaseTheme.BUTTON_LINK);
formLayout.addComponent(explainButton);
return null;
}
@Override
public Void visit(ExponentialPropagation exponentialPropagation) {
return null;
}
});
return null;
}
@Override
public Void visit(IpServiceVertex vertex) {
IpService ipService = businessServiceManager.getIpServiceById(vertex.getIpServiceId());
formLayout.addComponent(createLabel("Interface", ipService.getIpAddress()));
formLayout.addComponent(createLabel("Service", ipService.getServiceName()));
if (!ipService.getServiceName().equals(vertex.getLabel())) {
formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
}
return null;
}
@Override
public Void visit(ReductionKeyVertex vertex) {
formLayout.addComponent(createLabel("Reduction Key", vertex.getReductionKey()));
if (!vertex.getReductionKey().equals(vertex.getLabel())) {
formLayout.addComponent(createLabel("Friendly Name", vertex.getLabel()));
}
return null;
}
});
return formLayout;
}
use of org.opennms.features.topology.plugins.topo.bsm.ReductionKeyVertex in project opennms by OpenNMS.
the class BusinessServiceVertexStatusInfoPanelItemProvider method createComponent.
private Component createComponent(BusinessServiceVertex vertex, GraphContainer container) {
final FormLayout rootLayout = new FormLayout();
rootLayout.setSizeFull();
rootLayout.setSpacing(false);
rootLayout.setMargin(false);
rootLayout.addStyleName("severity");
final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory.createStateMachine(businessServiceManager, container.getCriteria());
final Status overallStatus = BusinessServicesStatusProvider.getStatus(stateMachine, vertex);
rootLayout.addComponent(createStatusLabel("Overall", overallStatus));
rootLayout.addComponent(new Label());
final BusinessServiceGraph graph = stateMachine.getGraph();
final BusinessService businessService = businessServiceManager.getBusinessServiceById(vertex.getServiceId());
final Set<GraphVertex> impactingVertices = getImpactingVertices(stateMachine, graph, businessService);
for (final Edge edge : businessService.getEdges()) {
// Get the topology vertex for the child to determine the display label
final Vertex childVertex = businessServicesTopologyProvider.getVertex(edge.accept(new EdgeVisitor<VertexRef>() {
@Override
public VertexRef visit(final IpServiceEdge edge) {
return new IpServiceVertex(edge.getIpService(), 0);
}
@Override
public VertexRef visit(final ReductionKeyEdge edge) {
return new ReductionKeyVertex(edge.getReductionKey(), 0);
}
@Override
public VertexRef visit(final ChildEdge edge) {
return new BusinessServiceVertex(edge.getChild(), 0);
}
}));
final Status edgeStatus = stateMachine.getOperationalStatus(edge);
rootLayout.addComponent(createStatusLabel(childVertex.getLabel(), edgeStatus, String.format("%s × %d <i class=\"pull-right glyphicon %s\"></i>", edgeStatus.getLabel(), edge.getWeight(), impactingVertices.contains(graph.getVertexByEdgeId(edge.getId())) ? "glyphicon-flash" : "")));
}
return rootLayout;
}
Aggregations