All files / app/codeCharta/state/effects/nodeContextMenu/flattenButtons flattenButtons.component.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 3/3
100% Lines 8/8

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 434x 4x   4x 4x                 4x     4x     1x                       1x                      
import { Component, Input } from "@angular/core"
import { Store } from "@ngrx/store"
import { CodeMapNode } from "../../../../codeCharta.model"
import { addBlacklistItem, removeBlacklistItem } from "../../../store/fileSettings/blacklist/blacklist.actions"
import { MatButton } from "@angular/material/button"
 
@Component({
    selector: "cc-flatten-buttons",
    templateUrl: "./flattenButtons.component.html",
    styleUrls: ["../nodeContextMenuButton.component.scss"],
    standalone: true,
    imports: [MatButton]
})
export class FlattenButtonsComponent {
    @Input() codeMapNode: Pick<CodeMapNode, "path" | "type" | "isFlattened">
 
    constructor(private store: Store) {}
 
    flattenNode() {
        this.store.dispatch(
            addBlacklistItem({
                item: {
                    path: this.codeMapNode.path,
                    type: "flatten",
                    nodeType: this.codeMapNode.type
                }
            })
        )
    }
 
    unFlattenNode() {
        this.store.dispatch(
            removeBlacklistItem({
                item: {
                    path: this.codeMapNode.path,
                    type: "flatten",
                    nodeType: this.codeMapNode.type
                }
            })
        )
    }
}