1 <ng-template #matcherTpl
4 <div class="input-group my-2">
5 <ng-container *ngFor="let config of matcherConfig">
6 <span class="input-group-text"
7 *ngIf="config.attribute === 'isRegex'"
8 [ngbTooltip]="config.tooltip">
9 <i *ngIf="matcher[config.attribute]">~</i>
10 <i *ngIf="!matcher[config.attribute]">=</i>
13 <ng-container *ngIf="config.attribute !== 'isRegex'">
15 id="matcher-{{config.attribute}}-{{index}}"
17 [value]="matcher[config.attribute]"
23 <!-- Matcher actions -->
26 id="matcher-edit-{{index}}"
29 (click)="showMatcherModal(index)">
30 <i [ngClass]="[icons.edit]"></i>
34 id="matcher-delete-{{index}}"
37 (click)="deleteMatcher(index)">
38 <i [ngClass]="[icons.trash]"></i>
41 <span class="help-block"></span>
44 <div class="cd-col-form">
45 <form #formDir="ngForm"
51 <div class="card-header">
52 <span i18n>{{ action | titlecase }} {{ resource | upperFirst }}</span>
53 <cd-helper *ngIf="edit"
54 i18n>Editing a silence will expire the old silence and recreate it as a new silence</cd-helper>
58 <div class="card-body">
59 <div class="form-group row">
60 <label class="cd-col-form-label required"
63 <div class="cd-col-form-input">
64 <input class="form-control"
65 formControlName="createdBy"
69 <span *ngIf="form.showError('createdBy', formDir, 'required')"
70 class="invalid-feedback"
71 i18n>This field is required!</span>
76 <div class="form-group row">
77 <label class="cd-col-form-label required"
80 <div class="cd-col-form-input">
81 <textarea class="form-control"
82 formControlName="comment"
87 <span *ngIf="form.showError('comment', formDir, 'required')"
88 class="invalid-feedback"
89 i18n>This field is required!</span>
94 <div class="form-group row">
95 <label class="cd-col-form-label"
97 <span class="required"
98 i18n>Start time</span>
99 <cd-helper i18n>If the start time lies in the past the creation time will be used</cd-helper>
101 <div class="cd-col-form-input">
102 <input class="form-control"
103 formControlName="startsAt"
104 [ngbPopover]="popStart"
108 (keypress)="ps.close()">
109 <span *ngIf="form.showError('startsAt', formDir, 'required')"
110 class="invalid-feedback"
111 i18n>This field is required!</span>
116 <div class="form-group row">
117 <label class="cd-col-form-label required"
119 i18n>Duration</label>
120 <div class="cd-col-form-input">
121 <input class="form-control"
122 formControlName="duration"
126 <span *ngIf="form.showError('duration', formDir, 'required')"
127 class="invalid-feedback"
128 i18n>This field is required!</span>
133 <div class="form-group row">
134 <label class="cd-col-form-label required"
136 i18n>End time</label>
137 <div class="cd-col-form-input">
138 <input class="form-control"
139 formControlName="endsAt"
140 [ngbPopover]="popEnd"
144 (keypress)="pe.close()">
145 <span *ngIf="form.showError('endsAt', formDir, 'required')"
146 class="invalid-feedback"
147 i18n>This field is required!</span>
153 <legend class="required"
154 i18n>Matchers</legend>
156 <div class="cd-col-form-offset">
157 <h5 *ngIf="matchers.length === 0"
158 [ngClass]="{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
159 <strong i18n>A silence requires at least one matcher</strong>
162 <span *ngFor="let matcher of matchers; let i=index;">
163 <ng-container *ngTemplateOutlet="matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
168 <button type="button"
170 class="btn btn-light float-end my-3"
171 [ngClass]="{'btn-warning': formDir.submitted && matchers.length === 0 }"
172 (click)="showMatcherModal()">
173 <i [ngClass]="[icons.add]"></i>
174 <ng-container i18n>Add matcher</ng-container>
180 <div *ngIf="matchers.length && matcherMatch"
181 class="cd-col-form-offset {{matcherMatch.cssClass}}"
183 <span class="text-muted {{matcherMatch.cssClass}}">
184 {{ matcherMatch.status }}
190 <div class="card-footer">
191 <div class="text-right">
192 <cd-form-button-panel (submitActionEvent)="submit()"
194 [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
201 <ng-template #popStart>
202 <cd-date-time-picker [control]="form.get('startsAt')"
203 [hasSeconds]="false"></cd-date-time-picker>
207 <ng-template #popEnd>
208 <cd-date-time-picker [control]="form.get('endsAt')"
209 [hasSeconds]="false"></cd-date-time-picker>