All files / app/codeCharta/ui/customConfigs/customConfigNoteDialogButton customConfigNoteDialogButton.component.ts

100% Statements 13/13
100% Branches 3/3
100% Functions 3/3
100% Lines 12/12

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 367x 7x 7x   7x               7x         37x     3x   3x         3x 3x 1x 1x          
import { Component, Input } from "@angular/core"
import { MatDialog } from "@angular/material/dialog"
import { CustomConfigNoteDialogComponent } from "./customConfigNoteDialog/customConfigNoteDialog.component"
import { CustomConfigItem } from "../customConfigs.component"
import { CustomConfigHelper } from "../../../util/customConfigHelper"
 
@Component({
    selector: "cc-custom-config-note-dialog-button",
    templateUrl: "./customConfigNoteDialogButton.component.html",
    styleUrls: ["./customConfigNoteDialogButton.component.scss"],
    standalone: true
})
export class CustomConfigNoteDialogButtonComponent {
    @Input() customConfigItem: CustomConfigItem
 
    customConfigNote: string
 
    constructor(private dialog: MatDialog) {}
 
    openDialog(): void {
        this.customConfigNote = this.customConfigItem.note
 
        const dialogReference = this.dialog.open(CustomConfigNoteDialogComponent, {
            width: "600px",
            data: this.customConfigNote
        })
 
        dialogReference.afterClosed().subscribe(result => {
            if (result !== undefined && this.customConfigNote !== result) {
                this.customConfigNote = result
                CustomConfigHelper.editCustomConfigNote(this.customConfigItem.id, result)
            }
        })
    }
}