diff --git a/src/statistics/bot-statistics.js b/src/statistics/bot-statistics.js index 02584f9..d9b4fc6 100644 --- a/src/statistics/bot-statistics.js +++ b/src/statistics/bot-statistics.js @@ -15,8 +15,10 @@ class BotStats extends LitElement { loading: { type: Boolean, value: true }, alertMessage: { type: String }, statistics: { type: Object }, - selectedMeasure: { type: Object, state: true , value: null}, + selectedMeasure: { type: Object, state: true, value: null }, successModelLoaded: { type: Boolean, state: true }, + enhance: { type: Boolean, state: true, value: false }, + selectedModel: { type: String, state: true, value: "petri-net" }, }; configModal = null; @@ -60,20 +62,22 @@ class BotStats extends LitElement { - ${this.alertMessage - ? html`` - : ""} + ${ + this.alertMessage + ? html`` + : "" + }
Loading...
- +
+ + +
+
+
@@ -124,21 +154,23 @@ class BotStats extends LitElement { ${this.statistics?.averageConversationLength}
- ${this.statistics?.conformance?.fitness?.averageFitness != - null - ? html` Deviating conversations: - - ${Math.round( - 100 * - (1 - - this.statistics?.conformance?.fitness - ?.averageFitness) * - 100 - ) / 100} - % -
` - : ""} + ${ + this.statistics?.conformance?.fitness?.averageFitness != + null + ? html` Deviating conversations: + + ${Math.round( + 100 * + (1 - + this.statistics?.conformance?.fitness + ?.averageFitness) * + 100 + ) / 100} + % +
` + : "" + }
@@ -161,8 +193,9 @@ class BotStats extends LitElement { class="spinner-border position-absolute" role="status" style="top:50%;left:50%;" - ?hidden="${this.successModelLoaded || - this.alertMessage != null}" + ?hidden="${ + this.successModelLoaded || this.alertMessage != null + }" > Loading... @@ -217,6 +250,7 @@ class BotStats extends LitElement { `; } firstUpdated() { + this.selectedModel = "petri-net"; // listen for the router to change to #bot-statistics window.addEventListener("hashchange", async () => { this.init = false; @@ -225,13 +259,19 @@ class BotStats extends LitElement { }); this.runInit(); } - changeView(e) { - if (e.target.value === "petri-net") { + changeView() { + if (this.selectedModel === "petri-net") { this.loading = true; - this.fetchConversationModel(this.configMap.get("bot-name")?.toString()); + this.fetchConversationModel( + this.configMap.get("bot-name")?.toString(), + this.enhance + ); } else { this.loading = true; - this.fetchBPMNModel(this.configMap.get("bot-name")?.toString()); + this.fetchBPMNModel( + this.configMap.get("bot-name")?.toString(), + this.enhance + ); } } @@ -385,7 +425,7 @@ class BotStats extends LitElement { } } - async fetchBPMNModel(botName) { + async fetchBPMNModel(botName, enhance = false) { if (!botName) { return; } @@ -413,7 +453,7 @@ class BotStats extends LitElement { let url = joinAbsoluteUrlPath(pm4botsEndpointInput, "bot", botName, "bpmn"); url += `?bot-manager-url=${botManagerEndpointInput}`; url += `&event-log-url=${eventLogEndpointInput}`; - url += `&enhance=${true}`; + url += `&enhance=${enhance}`; try { const response = await fetch(url, { @@ -473,7 +513,7 @@ class BotStats extends LitElement { } } - async fetchConversationModel(botName) { + async fetchConversationModel(botName, enhance = false) { if (!botName) { return; } @@ -505,7 +545,7 @@ class BotStats extends LitElement { ); url += `?bot-manager-url=${botManagerEndpointInput}`; url += `&event-log-url=${eventLogEndpointInput}`; - url += `&enhance=${true}`; + url += `&enhance=${enhance}`; try { const response = await fetch(url, {