@fluxhub/fluxhub-lib 19.0.115 → 19.0.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32280,10 +32280,11 @@ class BpmnEditorComponent {
32280
32280
  </div>
32281
32281
  `;
32282
32282
  try {
32283
+ // Position overlay more to the right on the connection
32283
32284
  this.overlays.add(connection.id, {
32284
32285
  position: {
32285
- top: -10,
32286
- left: 0
32286
+ top: -30,
32287
+ right: -80 // Spostato più a destra
32287
32288
  },
32288
32289
  html: overlayHtml
32289
32290
  });
@@ -32445,67 +32446,60 @@ class win_log_v2 {
32445
32446
  });
32446
32447
  }
32447
32448
  calculateCompletedStepsFromLogs() {
32448
- // Extract unique step numbers from logs (operazione field may contain step info)
32449
- // Common step numbers: 10, 20, 30, 40, 50, etc. (900+ are final states)
32450
32449
  const stepNumbers = new Set();
32451
- const transitions = [];
32452
- // Parse logs to find step transitions
32453
- let previousStep = null;
32450
+ const transitionsMap = new Map();
32451
+ // Process logs to extract transitions from liv_ini → liv_fin
32454
32452
  this.logs.forEach((log) => {
32455
- // Check if this is a workflow transition log
32456
- // Usually identified by operazione containing step information
32457
- const operazione = log.operazione || '';
32458
- // Try to extract "from step X to step Y" pattern
32459
- // Common patterns: "10 → 20", "Step 10 to 20", "Passaggio da 10 a 20"
32460
- const transitionMatch = operazione.match(/(\d+)\s*(?:→|->|to|a)\s*(\d+)/i);
32461
- if (transitionMatch) {
32462
- const fromStep = parseInt(transitionMatch[1], 10);
32463
- const toStep = parseInt(transitionMatch[2], 10);
32453
+ // Check if this log has transition data
32454
+ if (log.liv_ini != null && log.liv_fin != null) {
32455
+ const fromStep = parseInt(log.liv_ini, 10);
32456
+ const toStep = parseInt(log.liv_fin, 10);
32457
+ // IMPORTANT: Ignore transitions beyond current step
32458
+ // Only process transitions where BOTH fromStep and toStep are <= currentStep
32459
+ if (fromStep > this.currentStep || toStep > this.currentStep) {
32460
+ return; // Skip this transition
32461
+ }
32462
+ // Validate step numbers (10-890 range, exclude final states 900+)
32464
32463
  if (fromStep >= 10 && fromStep < 900 && toStep >= 10) {
32465
32464
  stepNumbers.add(fromStep);
32466
32465
  if (toStep < 900) {
32467
32466
  stepNumbers.add(toStep);
32468
32467
  }
32469
- // Add transition data
32470
- transitions.push({
32471
- fromStep: fromStep,
32472
- toStep: toStep,
32473
- user: log.nc || log.username || 'Sistema',
32474
- date: this.formatDate(log.data_creazione)
32475
- });
32476
- previousStep = toStep;
32477
- }
32478
- }
32479
- else {
32480
- // Try to extract single step number
32481
- const matches = operazione.match(/\b(\d+)\b/g);
32482
- if (matches) {
32483
- matches.forEach((match) => {
32484
- const stepNum = parseInt(match, 10);
32485
- if (stepNum >= 10 && stepNum < 900) {
32486
- stepNumbers.add(stepNum);
32487
- // If we have a previous step, create transition
32488
- if (previousStep !== null && previousStep !== stepNum) {
32489
- transitions.push({
32490
- fromStep: previousStep,
32491
- toStep: stepNum,
32492
- user: log.nc || log.username || 'Sistema',
32493
- date: this.formatDate(log.data_creazione)
32494
- });
32495
- }
32496
- previousStep = stepNum;
32497
- }
32498
- });
32468
+ // Create unique key for this transition
32469
+ const transitionKey = `${fromStep}_${toStep}`;
32470
+ const timestamp = new Date(log.data_evento || log.data_creazione).getTime();
32471
+ // Check if we already have this transition
32472
+ const existing = transitionsMap.get(transitionKey);
32473
+ // Keep only the most recent transition for each fromStep → toStep
32474
+ if (!existing || timestamp > existing.timestamp) {
32475
+ transitionsMap.set(transitionKey, {
32476
+ fromStep: fromStep,
32477
+ toStep: toStep,
32478
+ user: log.idp || log.nc || log.username || 'Sistema',
32479
+ date: this.formatDate(log.data_evento || log.data_creazione),
32480
+ timestamp: timestamp
32481
+ });
32482
+ console.log(`Transition: ${fromStep} → ${toStep} by ${log.idp || log.nc} on ${this.formatDate(log.data_evento || log.data_creazione)}`);
32483
+ }
32499
32484
  }
32500
32485
  }
32501
32486
  });
32502
- // Add all steps less than current step (assumption: sequential workflow)
32503
- // Common step increments: 10, 20, 30, 40, 50...
32487
+ // Add all steps less than current step (fallback for sequential workflow)
32504
32488
  for (let step = 10; step < this.currentStep && step < 900; step += 10) {
32505
32489
  stepNumbers.add(step);
32506
32490
  }
32491
+ // Convert map to array (without timestamp)
32492
+ const transitions = Array.from(transitionsMap.values()).map(t => ({
32493
+ fromStep: t.fromStep,
32494
+ toStep: t.toStep,
32495
+ user: t.user,
32496
+ date: t.date
32497
+ }));
32507
32498
  this.completedSteps = Array.from(stepNumbers).sort((a, b) => a - b);
32508
32499
  this.transitionData = transitions;
32500
+ console.log('Completed steps:', this.completedSteps);
32501
+ console.log('Transitions found:', transitions.length);
32502
+ console.log('Transition data:', this.transitionData);
32509
32503
  }
32510
32504
  formatDate(dateStr) {
32511
32505
  if (!dateStr)