Skip to content

Commit

Permalink
fix for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhoune committed Feb 8, 2024
1 parent 5ee3d8b commit 6e07a5f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/statistics/canvas-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ class CanvasStatsOverlay extends LitElement {
let currFrequencyMax = 0;
let currFrequencyMin = Infinity;
for (const edge of statistics.graph.edges) {
if (edge.performance?.mean > currDurationMax) {
currDurationMax = edge.performance?.mean;
if (edge.performance > currDurationMax) {
currDurationMax = edge.performance;
}
if (edge.frequency > currFrequencyMax) {
currFrequencyMax = edge.frequency;
}
if (edge.performance?.mean < currDurationMin) {
currDurationMin = edge.performance?.mean;
if (edge.performance < currDurationMin) {
currDurationMin = edge.performance;
}
if (edge.frequency < currFrequencyMin) {
currFrequencyMin = edge.frequency;
Expand Down Expand Up @@ -153,16 +153,19 @@ class CanvasStatsOverlay extends LitElement {
);
return;
}
const botModel = this.y.getMap("data").get("model");

const url = `${pm4botsEndpointInput}/bot/${botName}/enhanced-model?bot-manager-url=${botManagerEndpointInput}&event-log-url=${eventLogEndpointInput}`;
try {
const response = await fetch(url, {
method: "POST",
timeout: 10000,
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({'bot-model':botModel}),
});
this.loading = false;

Expand Down Expand Up @@ -214,11 +217,11 @@ class CanvasStatsOverlay extends LitElement {
addOverlayToExistingEdge(
sourceNode,
targetNode,
edge.performance?.mean,
edge.performance,
this
);
} else if (!findEdgeInAddedEdges(addedEdges, sourceId, targetId)) {
addMissingEdge(sourceNode, targetNode, edge.performance?.mean, this);
addMissingEdge(sourceNode, targetNode, edge.performance, this);
addedEdges.push({ sourceId, targetId });
}
}
Expand Down Expand Up @@ -283,14 +286,14 @@ class CanvasStatsOverlay extends LitElement {
} else {
const label =
type === "duration"
? edge.performance?.mean
? edge.performance?.mean.toFixed(2) + "s"
? edge.performance
? edge.performance.toFixed(2) + "s"
: ""
: edge.frequency;
const metric =
type === "duration"
? edge.performance?.mean
? edge.performance?.mean.toFixed(2)
? edge.performance
? edge.performance.toFixed(2)
: 0
: edge.frequency;
updateOverlay(sourceNode, targetNode, label, type, this, metric);
Expand Down

0 comments on commit 6e07a5f

Please sign in to comment.