All files / app/codeCharta/ui/ribbonBar/edgeSettingsPanel/edgeMetricToggle edgeMetricToggle.component.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 3/3
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 294x   4x 4x 4x   4x 4x               4x     3x     3x       1x      
import { Component, OnInit } from "@angular/core"
import { Observable } from "rxjs"
import { isEdgeMetricVisibleSelector } from "../../../../state/store/appSettings/isEdgeMetricVisible/isEdgeMetricVisible.selector"
import { toggleEdgeMetricVisible } from "../../../../state/store/appSettings/isEdgeMetricVisible/isEdgeMetricVisible.actions"
import { Store } from "@ngrx/store"
import { CcState } from "../../../../codeCharta.model"
import { MatCheckbox } from "@angular/material/checkbox"
import { AsyncPipe } from "@angular/common"
 
@Component({
    selector: "cc-edge-metric-toggle",
    templateUrl: "./edgeMetricToggle.component.html",
    standalone: true,
    imports: [MatCheckbox, AsyncPipe]
})
export class EdgeMetricToggleComponent implements OnInit {
    isEdgeMetricVisible$: Observable<boolean>
 
    constructor(private store: Store<CcState>) {}
 
    ngOnInit(): void {
        this.isEdgeMetricVisible$ = this.store.select(isEdgeMetricVisibleSelector)
    }
 
    toggleEdgeMetric() {
        this.store.dispatch(toggleEdgeMetricVisible())
    }
}