Skip to content

Commit

Permalink
feat: add limits store to team alignment and hotspots
Browse files Browse the repository at this point in the history
  • Loading branch information
manfredsteyer committed Sep 27, 2024
1 parent 2f9b490 commit 5547a7c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .detective/hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bf3b350647d4b87dda725cc854504af6a0779b6d, v1.1.2
631a11342bb6aa1a99689435044d9deb25e8d4e6, v1.1.2
16 changes: 8 additions & 8 deletions .detective/log
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"Manfred Steyer <[email protected]>,Fri Sep 27 21:59:41 2024 +0200 719f061ae9dfba3795d03390d5e0e297f256cd71,feat: add store for limits"
"Manfred Steyer <[email protected]>,Fri Sep 27 21:59:41 2024 +0200 2f9b490469e722542cea8ac38eeabe02c5ea78e1,feat: add store for limits"
1 1 .detective/hash
10 0 .detective/log
19 0 apps/frontend/src/app/data/limits.store.ts
8 1 apps/frontend/src/app/features/coupling/coupling.component.html
21 8 apps/frontend/src/app/features/coupling/coupling.component.ts
2 0 apps/frontend/src/app/model/limits.ts
2 2 apps/frontend/src/app/ui/limits/limits.component.html
5 7 apps/frontend/src/app/ui/limits/limits.component.ts
22 0 .detective/log
15 0 apps/frontend/src/app/data/limits.store.ts
6 1 apps/frontend/src/app/features/coupling/coupling.component.html
16 8 apps/frontend/src/app/features/coupling/coupling.component.ts
4 0 apps/frontend/src/app/model/limits.ts
5 2 apps/frontend/src/app/ui/limits/limits.component.html
9 17 apps/frontend/src/app/ui/limits/limits.component.ts
32 0 package-lock.json
2 0 package.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
</mat-icon>
</div>

<app-limits [(limits)]="limits" [totalCommits]="totalCommits()"></app-limits>
<app-limits
[limits]="limits()"
(limitsChange)="updateLimits($event)"
[totalCommits]="totalCommits()"
>
</app-limits>
</div>

<div class="aggregated">
Expand Down
9 changes: 8 additions & 1 deletion apps/frontend/src/app/features/hotspot/hotspot.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from 'rxjs';

import { HotspotService } from '../../data/hotspot.service';
import { LimitsStore } from '../../data/limits.store';
import { StatusStore } from '../../data/status.store';
import {
AggregatedHotspot,
Expand Down Expand Up @@ -82,6 +83,8 @@ type LoadHotspotOptions = LoadAggregateOptions & {
styleUrl: './hotspot.component.css',
})
export class HotspotComponent {
private limitsStore = inject(LimitsStore);

private hotspotService = inject(HotspotService);
private eventService = inject(EventService);

Expand All @@ -100,7 +103,7 @@ export class HotspotComponent {

totalCommits = this.statusStore.commits;
minScoreControl = signal(10);
limits = signal(initLimits);
limits = this.limitsStore.limits;
metric = signal<ComplexityMetric>('Length');

metricOptions: Option[] = [
Expand Down Expand Up @@ -164,6 +167,10 @@ export class HotspotComponent {
});
}

updateLimits(limits: Limits) {
this.limitsStore.updateLimits(limits);
}

selectRow(row: AggregatedHotspot, index: number) {
const selectModule = this.aggregatedResult().aggregated[index].module;
this.selectedRow = row;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
help_outline
</mat-icon>
</div>
<app-limits [(limits)]="limits" [totalCommits]="totalCommits()"></app-limits>
<app-limits
[limits]="limits()"
(limitsChange)="updateLimits($event)"
[totalCommits]="totalCommits()"
>
</app-limits>
</div>

<ul id="legend">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
of,
} from 'rxjs';

import { LimitsStore } from '../../data/limits.store';
import { StatusStore } from '../../data/status.store';
import { TeamAlignmentService } from '../../data/team-alignment.service';
import { initLimits, Limits } from '../../model/limits';
Expand Down Expand Up @@ -51,13 +52,14 @@ type LoadTeamAlignmentOptions = {
styleUrl: './team-alignment.component.css',
})
export class TeamAlignmentComponent {
private limitsStore = inject(LimitsStore);
private taService = inject(TeamAlignmentService);
private eventService = inject(EventService);
private statusStore = inject(StatusStore);
private showError = injectShowError();

totalCommits = this.statusStore.commits;
limits = signal(initLimits);
limits = this.limitsStore.limits;
byUser = signal(false);

alignment$ = combineLatest({
Expand All @@ -76,6 +78,10 @@ export class TeamAlignmentComponent {
toAlignmentChartConfigs(this.teamAlignmentResult(), this.colors())
);

updateLimits(limits: Limits) {
this.limitsStore.updateLimits(limits);
}

private toColors(count: number): string[] {
return quantize(interpolateRainbow, count + 1);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Frontend</title>
<title>Detective</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
Expand Down

0 comments on commit 5547a7c

Please sign in to comment.