1 <ng-template #matcherTpl
let-matcher=
"matcher" let-index=
"index">
2 <div class=
"input-group">
3 <ng-container *
ngFor=
"let config of matcherConfig">
4 <span class=
"input-group-addon"
5 [tooltip]=config.tooltip
>
6 <i class=
"icon-prepend" [ngClass]=
"[config.icon]"></i>
8 <ng-container *
ngIf=
"config.attribute !== 'isRegex'">
10 id=
"matcher-{{config.attribute}}-{{index}}"
12 [value]=
"matcher[config.attribute]"
16 <ng-container *
ngIf=
"config.attribute === 'isRegex'">
17 <span class=
"input-group-addon">
18 <input type=
"checkbox"
19 id=
"matcher-{{config.attribute}}-{{index}}"
20 [checked]=
"matcher[config.attribute]"
26 <!-- Matcher actions -->
27 <span class=
"input-group-btn">
29 class=
"btn btn-default"
30 id=
"matcher-edit-{{index}}"
33 (click)=
"showMatcherModal(index)">
34 <i [ngClass]=
"[icons.edit]"></i>
37 class=
"btn btn-default"
38 id=
"matcher-delete-{{index}}"
41 (click)=
"deleteMatcher(index)">
42 <i [ngClass]=
"[icons.trash]"></i>
46 <span class=
"help-block"></span>
49 <div class=
"col-sm-12 col-lg-6">
50 <form #
formDir=
"ngForm"
52 class=
"form-horizontal"
55 <div class=
"panel panel-default">
56 <div class=
"panel-heading">
57 <h3 class=
"panel-title">
58 <span i18n=
"@@formTitle">
59 {{ action | titlecase }} {{ resource | upperFirst }}
61 <cd-helper *
ngIf=
"edit"
62 i18n
>Editing a silence will expire the old silence and recreate it as a new silence
</cd-helper>
67 <div class=
"panel-body">
68 <div [ngClass]=
"{'has-error': form.showError('createdBy', formDir)}"
70 <label class=
"control-label col-sm-3"
72 <ng-container i18n
>Creator
</ng-container>
73 <span class=
"required"></span>
75 <div class=
"col-sm-9">
76 <input class=
"form-control"
77 formControlName=
"createdBy"
81 <span *
ngIf=
"form.showError('createdBy', formDir, 'required')"
83 i18n
>This field is required!
</span>
88 <div [ngClass]=
"{'has-error': form.showError('comment', formDir)}"
90 <label class=
"control-label col-sm-3"
92 <ng-container i18n
>Comment
</ng-container>
93 <span class=
"required"></span>
95 <div class=
"col-sm-9">
96 <textarea class=
"form-control"
97 formControlName=
"comment"
102 <span *
ngIf=
"form.showError('comment', formDir, 'required')"
104 i18n
>This field is required!
</span>
109 <div [ngClass]=
"{'has-error': form.showError('startsAt', formDir)}"
111 <label class=
"control-label col-sm-3"
113 <ng-container i18n
>Start time
</ng-container>
114 <cd-helper i18n
>If the start time lies in the past the creation time will be used
</cd-helper>
115 <span class=
"required"></span>
117 <div class=
"col-sm-9">
118 <input [bsConfig]=
"bsConfig"
121 formControlName=
"startsAt"
124 <span *
ngIf=
"form.showError('startsAt', formDir, 'required')"
126 i18n
>This field is required!
</span>
131 <div [ngClass]=
"{'has-error': form.showError('duration', formDir)}"
133 <label class=
"control-label col-sm-3"
135 <ng-container i18n
>Duration
</ng-container>
136 <span class=
"required"></span>
138 <div class=
"col-sm-9">
139 <input class=
"form-control"
140 formControlName=
"duration"
144 <span *
ngIf=
"form.showError('duration', formDir, 'required')"
146 i18n
>This field is required!
</span>
151 <div [ngClass]=
"{'has-error': form.showError('endsAt', formDir)}"
153 <label class=
"control-label col-sm-3"
155 <ng-container i18n
>End time
</ng-container>
156 <span class=
"required"></span>
158 <div class=
"col-sm-9">
159 <input [bsConfig]=
"bsConfig"
162 formControlName=
"endsAt"
165 <span *
ngIf=
"form.showError('endsAt', formDir, 'required')"
167 i18n
>This field is required!
</span>
173 <legend i18n
>Matchers
<span class=
"required">*
</span></legend>
174 <div class=
"col-sm-offset-3 col-sm-9">
175 <h5 *
ngIf=
"matchers.length === 0"
176 [ngClass]=
"{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
177 <strong i18n
>A silence requires at least one matcher
</strong>
180 <span *
ngFor=
"let matcher of matchers; let i=index;">
181 <ng-container *
ngTemplateOutlet=
"matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
184 <span class=
"form-control no-border">
185 <button type=
"button"
187 class=
"btn btn-sm btn-default btn-label pull-right"
188 [ngClass]=
"{'btn-warning': formDir.submitted && matchers.length === 0 }"
189 (click)=
"showMatcherModal()">
190 <i [ngClass]=
"[icons.width, icons.add]"></i>
191 <ng-container i18n
>Add matcher
</ng-container>
195 <div *
ngIf=
"matchers.length && matcherMatch"
196 class=
"col-sm-offset-3 col-sm-9 {{matcherMatch.cssClass}}"
198 <span class=
"help-block {{matcherMatch.cssClass}}">
199 {{ matcherMatch.status }}
205 <div class=
"panel-footer">
206 <div class=
"button-group text-right">
207 <cd-submit-button (submitAction)=
"submit()"
212 {{ action | titlecase }} {{ resource | upperFirst }}
214 <cd-back-button></cd-back-button>