feat(planner): implement cancellation for planning calculations

- Refactor leave-planner.worker.ts to support cancellation of ongoing calculations.
- Introduce `calculatePlanningAsyncInternal` for asynchronous planning calculations.
- Add cancellation handling in the worker message event.
- Update planning-date.ts with new utility functions for date manipulation.
- Extend translation-service.ts and translation files (en.json, de.json, es.json, fr.json) to include new strings related to planning horizon and cancellation.
- Create documentation for the cancellation feature in planner-cancellation.md.
- Add unit tests for cancellation functionality in leave-planner-cancellation.spec.ts and leave-planner.worker.spec.ts.

#57 #58
This commit is contained in:
nessar committed 2026-10-05 15:34:07 +02:00
1 parent 5c35a59805
commit 2edf2004f5
31 files changed
+2275 -304

No files matched your search

@@ -14,14 +14,25 @@
></mat-spinner>
<div class="spinner-text">{{ loadingProgress() }}%</div>
</div>
<p role="status">{{ tr().loading }}</p>
<p role="status">{{ isCancelling() ? tr().planning.cancelling : tr().loading }}</p>
<button
mat-stroked-button
type="button"
class="cancel-calculation"
[disabled]="isCancelling()"
(click)="cancelCalculation()"
>
{{ tr().planning.cancel }}
</button>
</div>
</div>
}
<header class="results-header">
<div class="results-heading">
<h2 id="planning-results-title" tabindex="-1">{{ tr().planning.title }}</h2>
<h2 #resultsTitle id="planning-results-title" tabindex="-1">
{{ tr().planning.title }}
</h2>
@if (planningOutcome()?.kind === 'InvalidInput') {
<p class="planning-status error" role="alert">
<mat-icon aria-hidden="true">error</mat-icon>
@@ -42,7 +53,7 @@
<mat-icon aria-hidden="true">{{
hasPlannerError() ? 'error' : 'warning'
}}</mat-icon>
{{ hasPlannerError() ? tr().planning.error : tr().planning.incomplete }}
{{ outcomeLabel(planningOutcome()!) }}
</p>
} @else if (planningOutcome()?.kind === 'Plan') {
<p class="planning-status success" role="status">