@@ -4,11 +4,11 @@ import { FitType, mxgraph, ShapeBpmnElementKind } from 'bpmn-visualization';
44import { frequencyScale } from './colors.js'
55import { getFrequencyOverlay } from './overlays.js' ;
66import { colorLegend , overlayLegend } from './legend.js' ;
7- import { getBpmnActivityElementbyName } from './utils.js' ;
7+ import { apiUrl , getBpmnActivityElementbyName } from './utils.js' ;
88
99export function getBPMNDiagram ( formData ) {
1010 console . log ( 'Get bpmn...' ) ;
11- return fetch ( 'http://localhost:6969/ discover/inductive-miner' , {
11+ return fetch ( ` ${ apiUrl } / discover/inductive-miner` , {
1212 method : 'POST' ,
1313 body : formData
1414 } ) . then ( response => response . text ( ) )
@@ -30,7 +30,7 @@ function visualizeBPMN(data) {
3030
3131function computeFrequency ( ) {
3232 console . log ( 'Compute frequency stats...' ) ;
33- fetch ( 'http://localhost:6969/ stats/frequency' )
33+ fetch ( ` ${ apiUrl } / stats/frequency` )
3434 . then ( response => response . json ( ) )
3535 . then ( data => visualizeFrequency ( data ) )
3636 . catch ( error => console . log ( error ) )
@@ -55,19 +55,19 @@ function visualizeFrequency(data) {
5555 if ( activityElement ) {
5656 const activityCell = graph . getModel ( ) . getCell ( activityElement . bpmnSemantic . id )
5757 let style = graph . getModel ( ) . getStyle ( activityCell ) ;
58+ style = mxgraph . mxUtils . setStyle ( style , mxgraph . mxConstants . STYLE_FILLCOLOR , myFrequencyScale ( freqValue ) )
5859
59- style = mxgraph . mxUtils . setStyle ( style , mxgraph . mxConstants . STYLE_FILLCOLOR , myFrequencyScale ( freqValue ) )
6060 if ( freqValue > avg ) {
6161 style = mxgraph . mxUtils . setStyle ( style , mxgraph . mxConstants . STYLE_FONTCOLOR , 'white' )
6262 }
6363 graph . getModel ( ) . setStyle ( activityCell , style ) ;
6464
65- //add frequency overlay
66- globals . bpmnVisualization . bpmnElementsRegistry . addOverlays (
67- activityElement . bpmnSemantic . id ,
68- getFrequencyOverlay ( freqValue , max ,
69- myFrequencyScale ( freqValue ) ) )
70- } }
65+ //add frequency overlay
66+ globals . bpmnVisualization . bpmnElementsRegistry . addOverlays (
67+ activityElement . bpmnSemantic . id ,
68+ getFrequencyOverlay ( freqValue , max , myFrequencyScale ( freqValue ) ) )
69+ }
70+ }
7171 // Allow to save the style in a new state, in particular keep the rounded activity
7272 graph . refresh ( ) ;
7373 } finally {
0 commit comments