]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.html
bump version to 18.2.4-pve3
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / cluster / prometheus / silence-form / silence-form.component.html
CommitLineData
9f95a23c
TL
1<ng-template #matcherTpl
2 let-matcher="matcher"
3 let-index="index">
4 <div class="input-group my-2">
494da23a 5 <ng-container *ngFor="let config of matcherConfig">
39ae355f 6 <span class="input-group-text"
1e59de90
TL
7 *ngIf="config.attribute === 'isRegex'">
8 <i *ngIf="matcher[config.attribute]"
9 [ngbTooltip]="config.tooltip">~</i>
10 <i *ngIf="!matcher[config.attribute]"
11 ngbTooltip="Equals">=</i>
39ae355f 12 </span>
9f95a23c 13
494da23a
TL
14 <ng-container *ngIf="config.attribute !== 'isRegex'">
15 <input type="text"
16 id="matcher-{{config.attribute}}-{{index}}"
17 class="form-control"
18 [value]="matcher[config.attribute]"
19 disabled
20 readonly>
21 </ng-container>
494da23a 22 </ng-container>
9f95a23c 23
494da23a 24 <!-- Matcher actions -->
39ae355f
TL
25 <button type="button"
26 class="btn btn-light"
27 id="matcher-edit-{{index}}"
28 i18n-ngbTooltip
29 ngbTooltip="Edit"
30 (click)="showMatcherModal(index)">
31 <i [ngClass]="[icons.edit]"></i>
32 </button>
33 <button type="button"
34 class="btn btn-light"
35 id="matcher-delete-{{index}}"
36 i18n-ngbTooltip
37 ngbTooltip="Delete"
38 (click)="deleteMatcher(index)">
39 <i [ngClass]="[icons.trash]"></i>
40 </button>
494da23a
TL
41 </div>
42 <span class="help-block"></span>
43</ng-template>
44
9f95a23c 45<div class="cd-col-form">
494da23a
TL
46 <form #formDir="ngForm"
47 [formGroup]="form"
9f95a23c 48 class="form"
494da23a
TL
49 name="form"
50 novalidate>
9f95a23c
TL
51 <div class="card">
52 <div class="card-header">
a4b75251 53 <span i18n>{{ action | titlecase }} {{ resource | upperFirst }}</span>
9f95a23c
TL
54 <cd-helper *ngIf="edit"
55 i18n>Editing a silence will expire the old silence and recreate it as a new silence</cd-helper>
494da23a
TL
56 </div>
57
58 <!-- Creator -->
9f95a23c
TL
59 <div class="card-body">
60 <div class="form-group row">
61 <label class="cd-col-form-label required"
62 for="created-by"
63 i18n>Creator</label>
64 <div class="cd-col-form-input">
494da23a
TL
65 <input class="form-control"
66 formControlName="createdBy"
67 id="created-by"
68 name="created-by"
69 type="text">
70 <span *ngIf="form.showError('createdBy', formDir, 'required')"
9f95a23c 71 class="invalid-feedback"
494da23a
TL
72 i18n>This field is required!</span>
73 </div>
74 </div>
75
76 <!-- Comment -->
9f95a23c
TL
77 <div class="form-group row">
78 <label class="cd-col-form-label required"
79 for="comment"
80 i18n>Comment</label>
81 <div class="cd-col-form-input">
494da23a
TL
82 <textarea class="form-control"
83 formControlName="comment"
84 id="comment"
85 name="comment"
86 type="text">
87 </textarea>
88 <span *ngIf="form.showError('comment', formDir, 'required')"
9f95a23c 89 class="invalid-feedback"
494da23a
TL
90 i18n>This field is required!</span>
91 </div>
92 </div>
93
94 <!-- Start time -->
9f95a23c
TL
95 <div class="form-group row">
96 <label class="cd-col-form-label"
494da23a 97 for="starts-at">
9f95a23c
TL
98 <span class="required"
99 i18n>Start time</span>
494da23a 100 <cd-helper i18n>If the start time lies in the past the creation time will be used</cd-helper>
494da23a 101 </label>
9f95a23c 102 <div class="cd-col-form-input">
f67539c2 103 <input class="form-control"
494da23a 104 formControlName="startsAt"
f67539c2
TL
105 [ngbPopover]="popStart"
106 triggers="manual"
107 #ps="ngbPopover"
108 (click)="ps.open()"
109 (keypress)="ps.close()">
494da23a 110 <span *ngIf="form.showError('startsAt', formDir, 'required')"
9f95a23c 111 class="invalid-feedback"
494da23a
TL
112 i18n>This field is required!</span>
113 </div>
114 </div>
115
116 <!-- Duration -->
9f95a23c
TL
117 <div class="form-group row">
118 <label class="cd-col-form-label required"
119 for="duration"
120 i18n>Duration</label>
121 <div class="cd-col-form-input">
494da23a
TL
122 <input class="form-control"
123 formControlName="duration"
124 id="duration"
125 name="duration"
126 type="text">
127 <span *ngIf="form.showError('duration', formDir, 'required')"
9f95a23c 128 class="invalid-feedback"
494da23a
TL
129 i18n>This field is required!</span>
130 </div>
131 </div>
132
133 <!-- End time -->
9f95a23c
TL
134 <div class="form-group row">
135 <label class="cd-col-form-label required"
136 for="ends-at"
137 i18n>End time</label>
138 <div class="cd-col-form-input">
f67539c2 139 <input class="form-control"
494da23a 140 formControlName="endsAt"
f67539c2
TL
141 [ngbPopover]="popEnd"
142 triggers="manual"
143 #pe="ngbPopover"
144 (click)="pe.open()"
145 (keypress)="pe.close()">
494da23a 146 <span *ngIf="form.showError('endsAt', formDir, 'required')"
9f95a23c 147 class="invalid-feedback"
494da23a
TL
148 i18n>This field is required!</span>
149 </div>
150 </div>
151
152 <!-- Matchers -->
153 <fieldset>
9f95a23c
TL
154 <legend class="required"
155 i18n>Matchers</legend>
156
157 <div class="cd-col-form-offset">
494da23a
TL
158 <h5 *ngIf="matchers.length === 0"
159 [ngClass]="{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
160 <strong i18n>A silence requires at least one matcher</strong>
161 </h5>
162
163 <span *ngFor="let matcher of matchers; let i=index;">
164 <ng-container *ngTemplateOutlet="matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
165 </span>
166
9f95a23c
TL
167 <div class="row">
168 <div class="col-12">
169 <button type="button"
170 id="add-matcher"
39ae355f 171 class="btn btn-light float-end my-3"
9f95a23c
TL
172 [ngClass]="{'btn-warning': formDir.submitted && matchers.length === 0 }"
173 (click)="showMatcherModal()">
174 <i [ngClass]="[icons.add]"></i>
175 <ng-container i18n>Add matcher</ng-container>
176 </button>
177 </div>
178 </div>
494da23a 179 </div>
9f95a23c 180
494da23a 181 <div *ngIf="matchers.length && matcherMatch"
9f95a23c 182 class="cd-col-form-offset {{matcherMatch.cssClass}}"
494da23a 183 id="match-state">
9f95a23c 184 <span class="text-muted {{matcherMatch.cssClass}}">
494da23a
TL
185 {{ matcherMatch.status }}
186 </span>
187 </div>
188 </fieldset>
189 </div>
190
9f95a23c 191 <div class="card-footer">
f67539c2
TL
192 <div class="text-right">
193 <cd-form-button-panel (submitActionEvent)="submit()"
194 [form]="form"
195 [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
494da23a
TL
196 </div>
197 </div>
198 </div>
199 </form>
200</div>
f67539c2
TL
201
202<ng-template #popStart>
203 <cd-date-time-picker [control]="form.get('startsAt')"
204 [hasSeconds]="false"></cd-date-time-picker>
205</ng-template>
206
207
208<ng-template #popEnd>
209 <cd-date-time-picker [control]="form.get('endsAt')"
210 [hasSeconds]="false"></cd-date-time-picker>
211</ng-template>