• 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

10.71
/src/message/message.service.ts
1
import { Overlay } from '@angular/cdk/overlay';
2
import { Inject, Injectable, Injector, TemplateRef } from '@angular/core';
3
import { ThyMessageContainerComponent } from './message-container.component';
4
import { ThyMessageRef } from './message-ref';
5
import { ThyMessageQueue } from './message-queue.service';
6
import { ThyGlobalMessageConfig, ThyMessageConfig, THY_MESSAGE_DEFAULT_CONFIG, THY_MESSAGE_DEFAULT_CONFIG_VALUE } from './message.config';
7
import { ThyAbstractMessageService } from './abstract';
8

9
@Injectable({
1✔
10
    providedIn: 'root'
11
})
×
12
export class ThyMessageService extends ThyAbstractMessageService<ThyMessageContainerComponent> {
×
13
    private _lastMessageId = 0;
×
14

×
15
    private defaultConfig: ThyGlobalMessageConfig;
16

17
    constructor(
18
        overlay: Overlay,
19
        injector: Injector,
20
        private messageQueue: ThyMessageQueue,
21
        @Inject(THY_MESSAGE_DEFAULT_CONFIG) config: ThyGlobalMessageConfig
22
    ) {
23
        super(overlay, injector, messageQueue);
×
24
        this.defaultConfig = {
×
25
            ...THY_MESSAGE_DEFAULT_CONFIG_VALUE,
26
            ...config
27
        };
28
    }
29

30
    /**
31
     * 打开 success 类型的 Message
32
     */
33
    success(content: string | TemplateRef<any>, config?: ThyMessageConfig): ThyMessageRef {
×
34
        return this.show({
×
35
            ...(config || {}),
36
            type: 'success',
37
            content
38
        });
39
    }
40

41
    /**
42
     * 打开 error 类型的 Message
43
     */
×
44
    error(content: string | TemplateRef<any>, config?: ThyMessageConfig): ThyMessageRef {
×
45
        return this.show({
46
            ...(config || {}),
47
            type: 'error',
48
            content
49
        });
50
    }
51

52
    /**
53
     * 打开 info 类型的 Message
×
54
     */
×
55
    info(content: string | TemplateRef<any>, config?: ThyMessageConfig): ThyMessageRef {
56
        return this.show({
57
            ...(config || {}),
58
            type: 'info',
59
            content
60
        });
61
    }
62

63
    /**
×
64
     * 打开 warning 类型的 Message
×
65
     */
66
    warning(content: string | TemplateRef<any>, config?: ThyMessageConfig): ThyMessageRef {
67
        return this.show({
68
            ...(config || {}),
69
            type: 'warning',
70
            content
×
71
        });
×
72
    }
×
73

×
74
    /**
×
75
     * 打开 loading 类型的 Message
76
     */
77
    loading(content: string | TemplateRef<any>, config?: ThyMessageConfig): ThyMessageRef {
×
78
        return this.show({
79
            ...(config || {}),
1✔
80
            type: 'loading',
81
            content
82
        });
83
    }
84

85
    protected show(config: ThyMessageConfig): ThyMessageRef {
86
        this.container = this.createContainer(ThyMessageContainerComponent);
1✔
87

88
        const messageConfig = this.formatOptions(config);
89
        const messageRef = new ThyMessageRef(messageConfig, this.overlayRef, this.messageQueue);
90
        this.messageQueue.add(messageRef);
91
        return messageRef;
92
    }
93

94
    private formatOptions(config: ThyMessageConfig) {
95
        return Object.assign({ id: String(this._lastMessageId++) }, this.defaultConfig, config);
96
    }
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