• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

11.43
/src/dialog/confirm/confirm.component.ts
1
import { ThyFormDirective, ThyFormGroupFooterAlign, ThyFormGroupFooterComponent } from 'ngx-tethys/form';
2
import { finalize } from 'rxjs/operators';
3

4
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Input, OnDestroy, OnInit } from '@angular/core';
5

6
import { NgClass } from '@angular/common';
7
import { FormsModule } from '@angular/forms';
8
import { ThyButtonComponent } from 'ngx-tethys/button';
9
import { DialogBodyComponent } from '../body/dialog-body.component';
10
import { ThyConfirmConfig, THY_CONFIRM_DEFAULT_OPTIONS, THY_CONFIRM_DEFAULT_OPTIONS_VALUE } from '../confirm.config';
11
import { ThyDialogRef } from '../dialog-ref';
12
import { DialogHeaderComponent } from '../header/dialog-header.component';
13

14
/**
15
 * @private
16
 */
1✔
17
@Component({
18
    selector: 'thy-confirm-default',
×
19
    templateUrl: './confirm.component.html',
×
20
    changeDetection: ChangeDetectionStrategy.OnPush,
×
21
    standalone: true,
×
22
    imports: [
23
        DialogHeaderComponent,
24
        DialogBodyComponent,
×
25
        FormsModule,
×
26
        ThyFormDirective,
×
27
        ThyFormGroupFooterComponent,
×
28
        NgClass,
×
29
        ThyButtonComponent
×
30
    ]
×
31
})
×
32
export class ThyConfirmComponent implements OnInit, OnDestroy {
33
    loading: boolean;
34

×
35
    @Input() options: ThyConfirmConfig;
×
36

×
37
    public title: string;
×
38

39
    public content: string;
×
40

×
41
    public okText: string;
42

43
    public okType: string;
×
44

×
45
    public cancelText: string;
46

47
    public okLoadingText: string;
48

49
    public footerAlign: ThyFormGroupFooterAlign;
×
50

51
    constructor(
52
        private dialogRef: ThyDialogRef<ThyConfirmComponent>,
53
        private changeDetectorRef: ChangeDetectorRef,
×
54
        @Inject(THY_CONFIRM_DEFAULT_OPTIONS) private defaultConfig: ThyConfirmConfig
×
55
    ) {
56
        this.defaultConfig = { ...(THY_CONFIRM_DEFAULT_OPTIONS_VALUE as ThyConfirmConfig), ...this.defaultConfig };
57
    }
1✔
58

59
    ngOnInit() {
60
        this.defaultConfig = { ...this.defaultConfig, ...this.options };
61
        this.title = this.defaultConfig.title;
62
        this.content = this.defaultConfig.content;
1✔
63
        this.okText = this.defaultConfig.okText;
64
        this.okType = this.defaultConfig.okType;
65
        this.cancelText = this.defaultConfig.cancelText;
66
        this.okLoadingText = this.defaultConfig.okLoadingText || this.okText;
1✔
67
        this.footerAlign = this.defaultConfig.footerAlign;
68
    }
69

70
    confirm() {
71
        this.loading = true;
72
        const result = this.options.onOk();
73
        if (result && result.subscribe) {
74
            result
75
                .pipe(
76
                    finalize(() => {
77
                        this.loading = false;
78
                        this.changeDetectorRef.markForCheck();
79
                    })
80
                )
81
                .subscribe(success => {
82
                    if (success) {
83
                        this.close();
84
                    }
85
                });
86
        } else {
87
            this.close();
88
        }
89
    }
90

91
    close() {
92
        this.options?.onCancel?.();
93
        this.dialogRef.close();
94
    }
95

96
    ngOnDestroy() {}
97
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc