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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 10x 10x 10x 10x 10x 10x 10x 10x 23x 23x 23x 23x 23x 23x 22x 22x 15x 7x 22x | import { Component, Input, OnInit } from "@angular/core" import { Store } from "@ngrx/store" import { map, Observable } from "rxjs" import { AttributeTypes, CcState, CodeMapNode, Node, PrimaryMetrics } from "../../../codeCharta.model" import { createAttributeTypeSelector } from "./createAttributeTypeSelector.selector" import { NodeSelectionService } from "../nodeSelection.service" import { isLeaf } from "../../../util/codeMapHelper" import { AsyncPipe } from "@angular/common" @Component({ selector: "cc-metric-chooser-type", templateUrl: "./metricChooserType.component.html", standalone: true, imports: [AsyncPipe] }) export class MetricChooserTypeComponent implements OnInit { @Input({ required: true }) metricFor: keyof PrimaryMetrics @Input() attributeType: keyof AttributeTypes = "nodes" isNodeALeaf$: Observable<boolean> attributeType$: Observable<string> constructor( private store: Store<CcState>, private nodeSelectionService: NodeSelectionService ) {} ngOnInit(): void { this.isNodeALeaf$ = this.nodeSelectionService.createNodeObservable().pipe(map((node: Node | CodeMapNode) => this.isNodeALeaf(node))) this.attributeType$ = this.store.select(createAttributeTypeSelector(this.attributeType, this.metricFor)) } private isNodeALeaf = (node: CodeMapNode | Node) => { Iif (!node) { return } if (this.isNode(node)) { return (node as Node).isLeaf } return isLeaf(node as CodeMapNode) } private isNode(node: CodeMapNode | Node) { return "isLeaf" in node } } |