diff --git a/apps/backend/project.json b/apps/backend/project.json
index e25ef43..d339c51 100644
--- a/apps/backend/project.json
+++ b/apps/backend/project.json
@@ -14,7 +14,7 @@
"runBuildTargetDependencies": false,
"args": [
"--path",
- "/Users/manfredsteyer/tmp/angular",
+ "/Users/manfredsteyer/projects/public/standalone-example-cli",
"--open",
"false"
]
diff --git a/apps/backend/src/services/hotspot.ts b/apps/backend/src/services/hotspot.ts
index 51c1698..7cb0bcb 100644
--- a/apps/backend/src/services/hotspot.ts
+++ b/apps/backend/src/services/hotspot.ts
@@ -144,17 +144,15 @@ function aggregateStats(
let countOk = 0;
for (const stat of moduleStats) {
- if (stat > hotspotBoundary) {
+ if (stat >= hotspotBoundary) {
countHotspot++;
- } else if (stat < warningBoundary) {
- countOk++;
- } else {
+ } else if (stat >= warningBoundary) {
countWarning++;
+ } else {
+ countOk++;
}
}
- // const countBelow = moduleStats.length - count;
-
const displayFolder = toDisplayFolder(module);
const parent = path.dirname(displayFolder);
diff --git a/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.html b/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.html
index 9007618..95837cf 100644
--- a/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.html
+++ b/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.html
@@ -11,7 +11,7 @@
@if (loadingHotspots()) { Determining Hotspots ...
- } @else if (hotspotResult().hotspots.length > 0) {
+ } @else if (hotspots().length > 0) {
diff --git a/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.ts b/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.ts
index 1bf1cf0..c5d60c8 100644
--- a/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.ts
+++ b/apps/frontend/src/app/features/hotspot/hotspot-detail/hotspot-detail.component.ts
@@ -45,11 +45,11 @@ export class HotspotDetailComponent {
loadingHotspots = this.hotspotStore.loadingHotspots;
aggregatedResult = this.hotspotStore.aggregatedResult;
- hotspotResult = this.hotspotStore.hotspotResult;
+ hotspots = this.hotspotStore.hotspotsInRange;
formattedHotspots = computed(() =>
formatHotspots(
- this.hotspotResult().hotspots,
+ this.hotspots(),
untracked(() => this.hotspotStore.filter.module())
)
);
diff --git a/apps/frontend/src/app/features/hotspot/hotspot.component.ts b/apps/frontend/src/app/features/hotspot/hotspot.component.ts
index f4e6ba3..1d5ec04 100644
--- a/apps/frontend/src/app/features/hotspot/hotspot.component.ts
+++ b/apps/frontend/src/app/features/hotspot/hotspot.component.ts
@@ -98,6 +98,8 @@ export class HotspotComponent {
treeMapConfig = computed(() => toTreeMapConfig(this.formattedAggregated()));
constructor() {
+ this.hotspotStore.resetResults();
+
const loadAggregatedEvents = {
filterChanged: this.eventService.filterChanged.pipe(startWith(null)),
minScore: toObservable(this.minScore().value).pipe(
diff --git a/apps/frontend/src/app/features/hotspot/hotspot.store.ts b/apps/frontend/src/app/features/hotspot/hotspot.store.ts
index 7ec22b8..212163f 100644
--- a/apps/frontend/src/app/features/hotspot/hotspot.store.ts
+++ b/apps/frontend/src/app/features/hotspot/hotspot.store.ts
@@ -1,5 +1,11 @@
-import { inject } from '@angular/core';
-import { patchState, signalStore, withMethods, withState } from '@ngrx/signals';
+import { computed, inject } from '@angular/core';
+import {
+ patchState,
+ signalStore,
+ withComputed,
+ withMethods,
+ withState,
+} from '@ngrx/signals';
import { rxMethod } from '@ngrx/signals/rxjs-interop';
import { catchError, filter, Observable, of, pipe, switchMap, tap } from 'rxjs';
@@ -21,6 +27,7 @@ export type HotspotFilter = {
minScore: number;
metric: ComplexityMetric;
module: string;
+ scoreRange: ScoreRange;
};
export type LoadAggregateOptions = {
@@ -62,6 +69,16 @@ export const HotspotStore = signalStore(
loadingAggregated: false,
loadingHotspots: false,
}),
+ withComputed((store) => ({
+ hotspotsInRange: computed(() =>
+ store.hotspotResult().hotspots.filter((h) => {
+ return (
+ h.score >= store.filter().scoreRange.from &&
+ h.score < store.filter().scoreRange.to
+ );
+ })
+ ),
+ })),
withMethods(
(
store,
@@ -132,7 +149,15 @@ export const HotspotStore = signalStore(
},
})
),
+
withMethods((store) => ({
+ resetResults(): void {
+ patchState(store, {
+ aggregatedResult: initAggregatedHotspotsResult,
+ hotspotResult: initHotspotResult,
+ });
+ },
+
updateFilter(filter: Partial) {
patchState(store, (state) => ({
filter: {
diff --git a/apps/frontend/src/app/ui/treemap/treemap.component.ts b/apps/frontend/src/app/ui/treemap/treemap.component.ts
index 8405c4f..a06ca80 100644
--- a/apps/frontend/src/app/ui/treemap/treemap.component.ts
+++ b/apps/frontend/src/app/ui/treemap/treemap.component.ts
@@ -71,10 +71,16 @@ export class TreeMapComponent implements OnChanges, OnDestroy {
const ctx = canvas.getContext('2d');
const config = this.chartConfig();
+ if (config.data.datasets[0].data.length === 0) {
+ return;
+ }
+
if (!ctx) {
throw new Error('2d context not found');
}
+ console.log('config', config);
+
this.chart?.destroy();
config.options = config.options ?? {};