-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76656b3
commit 28b7c31
Showing
5 changed files
with
110 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
b710a462a265c9bf0de882fc6886c806a46d2279, v1.1.2 | ||
37698fb21ae14ef200051ddf81bbee302fd731c1, v1.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
"Manfred Steyer <[email protected]>,Fri Sep 27 22:48:19 2024 +0200 76656b36d327a6c9f45040294c99cc83a30d84b0,refactor(frontend): remove unnecessary rendering effect in hotspot component" | ||
1 1 .detective/hash | ||
9 0 .detective/log | ||
5 1 apps/frontend/src/app/features/hotspot/hotspot.component.html | ||
26 7 apps/frontend/src/app/features/hotspot/hotspot.component.ts | ||
|
||
"Manfred Steyer <[email protected]>,Fri Sep 27 22:20:25 2024 +0200 5547a7c4196a2ba80acb704250c0a76d9e1101c1,feat: add limits store to team alignment and hotspots" | ||
1 1 .detective/hash | ||
8 8 .detective/log | ||
|
13 changes: 11 additions & 2 deletions
13
apps/frontend/src/app/features/coupling/coupling.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { inject } from '@angular/core'; | ||
import { patchState, signalStore, withMethods, withState } from '@ngrx/signals'; | ||
import { rxMethod } from '@ngrx/signals/rxjs-interop'; | ||
import { catchError, Observable, of, pipe, switchMap, tap } from 'rxjs'; | ||
|
||
import { CouplingService } from '../../data/coupling.service'; | ||
import { | ||
CouplingResult, | ||
initCouplingResult, | ||
} from '../../model/coupling-result'; | ||
import { GraphType } from '../../model/graph-type'; | ||
import { Limits } from '../../model/limits'; | ||
import { injectShowError } from '../../utils/error-handler'; | ||
|
||
export type CouplingFilter = { | ||
groupByFolder: boolean; | ||
minConnections: number; | ||
}; | ||
|
||
export type LoadOptions = { | ||
type: GraphType; | ||
limits: Limits; | ||
}; | ||
|
||
export const CouplingStore = signalStore( | ||
{ providedIn: 'root' }, | ||
withState({ | ||
filter: { | ||
groupByFolder: false, | ||
minConnections: 1, | ||
} as CouplingFilter, | ||
couplingResult: initCouplingResult, | ||
}), | ||
withMethods( | ||
( | ||
_store, | ||
couplingService = inject(CouplingService), | ||
showError = injectShowError() | ||
) => ({ | ||
_loadCoupling(options: LoadOptions): Observable<CouplingResult> { | ||
return couplingService.load(options.type, options.limits).pipe( | ||
catchError((err) => { | ||
showError(err); | ||
return of(initCouplingResult); | ||
}) | ||
); | ||
}, | ||
}) | ||
), | ||
withMethods((store) => ({ | ||
updateFilter(filter: Partial<CouplingFilter>) { | ||
patchState(store, (state) => ({ | ||
filter: { | ||
...state.filter, | ||
...filter, | ||
}, | ||
})); | ||
}, | ||
rxLoad: rxMethod<LoadOptions>( | ||
pipe( | ||
switchMap((options) => store._loadCoupling(options)), | ||
tap((couplingResult) => patchState(store, { couplingResult })) | ||
) | ||
), | ||
})) | ||
); |