1 <ng-template #matcherTpl
4 <div class="input-group my-2">
5 <ng-container *ngFor="let config of matcherConfig">
6 <div class="input-group-prepend">
7 <span class="input-group-text"
8 *ngIf="config.attribute === 'isRegex'"
9 [ngbTooltip]="config.tooltip">
10 <i *ngIf="matcher[config.attribute]">~</i>
11 <i *ngIf="!matcher[config.attribute]">=</i>
15 <ng-container *ngIf="config.attribute !== 'isRegex'">
17 id="matcher-{{config.attribute}}-{{index}}"
19 [value]="matcher[config.attribute]"
25 <!-- Matcher actions -->
26 <span class="input-group-append">
29 id="matcher-edit-{{index}}"
32 (click)="showMatcherModal(index)">
33 <i [ngClass]="[icons.edit]"></i>
37 id="matcher-delete-{{index}}"
40 (click)="deleteMatcher(index)">
41 <i [ngClass]="[icons.trash]"></i>
45 <span class="help-block"></span>
48 <div class="cd-col-form">
49 <form #formDir="ngForm"
55 <div class="card-header">
56 <span i18n>{{ action | titlecase }} {{ resource | upperFirst }}</span>
57 <cd-helper *ngIf="edit"
58 i18n>Editing a silence will expire the old silence and recreate it as a new silence</cd-helper>
62 <div class="card-body">
63 <div class="form-group row">
64 <label class="cd-col-form-label required"
67 <div class="cd-col-form-input">
68 <input class="form-control"
69 formControlName="createdBy"
73 <span *ngIf="form.showError('createdBy', formDir, 'required')"
74 class="invalid-feedback"
75 i18n>This field is required!</span>
80 <div class="form-group row">
81 <label class="cd-col-form-label required"
84 <div class="cd-col-form-input">
85 <textarea class="form-control"
86 formControlName="comment"
91 <span *ngIf="form.showError('comment', formDir, 'required')"
92 class="invalid-feedback"
93 i18n>This field is required!</span>
98 <div class="form-group row">
99 <label class="cd-col-form-label"
101 <span class="required"
102 i18n>Start time</span>
103 <cd-helper i18n>If the start time lies in the past the creation time will be used</cd-helper>
105 <div class="cd-col-form-input">
106 <input class="form-control"
107 formControlName="startsAt"
108 [ngbPopover]="popStart"
112 (keypress)="ps.close()">
113 <span *ngIf="form.showError('startsAt', formDir, 'required')"
114 class="invalid-feedback"
115 i18n>This field is required!</span>
120 <div class="form-group row">
121 <label class="cd-col-form-label required"
123 i18n>Duration</label>
124 <div class="cd-col-form-input">
125 <input class="form-control"
126 formControlName="duration"
130 <span *ngIf="form.showError('duration', formDir, 'required')"
131 class="invalid-feedback"
132 i18n>This field is required!</span>
137 <div class="form-group row">
138 <label class="cd-col-form-label required"
140 i18n>End time</label>
141 <div class="cd-col-form-input">
142 <input class="form-control"
143 formControlName="endsAt"
144 [ngbPopover]="popEnd"
148 (keypress)="pe.close()">
149 <span *ngIf="form.showError('endsAt', formDir, 'required')"
150 class="invalid-feedback"
151 i18n>This field is required!</span>
157 <legend class="required"
158 i18n>Matchers</legend>
160 <div class="cd-col-form-offset">
161 <h5 *ngIf="matchers.length === 0"
162 [ngClass]="{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
163 <strong i18n>A silence requires at least one matcher</strong>
166 <span *ngFor="let matcher of matchers; let i=index;">
167 <ng-container *ngTemplateOutlet="matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
172 <button type="button"
174 class="btn btn-light float-right my-3"
175 [ngClass]="{'btn-warning': formDir.submitted && matchers.length === 0 }"
176 (click)="showMatcherModal()">
177 <i [ngClass]="[icons.add]"></i>
178 <ng-container i18n>Add matcher</ng-container>
184 <div *ngIf="matchers.length && matcherMatch"
185 class="cd-col-form-offset {{matcherMatch.cssClass}}"
187 <span class="text-muted {{matcherMatch.cssClass}}">
188 {{ matcherMatch.status }}
194 <div class="card-footer">
195 <div class="text-right">
196 <cd-form-button-panel (submitActionEvent)="submit()"
198 [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
205 <ng-template #popStart>
206 <cd-date-time-picker [control]="form.get('startsAt')"
207 [hasSeconds]="false"></cd-date-time-picker>
211 <ng-template #popEnd>
212 <cd-date-time-picker [control]="form.get('endsAt')"
213 [hasSeconds]="false"></cd-date-time-picker>