@juice-js/observability 1.1.0-alpha.32 → 1.1.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{juice-js-observability-alert.page-BNlH9IdQ.mjs → juice-js-observability-alert.page-2kfKksIG.mjs} +46 -2
- package/fesm2022/juice-js-observability-alert.page-2kfKksIG.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-incident.page-C2ZK3MRh.mjs → juice-js-observability-incident.page-D2GvuIft.mjs} +38 -2
- package/fesm2022/juice-js-observability-incident.page-D2GvuIft.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-rules.page-CWaADAe4.mjs → juice-js-observability-rules.page-CARCWaw_.mjs} +8 -7
- package/fesm2022/juice-js-observability-rules.page-CARCWaw_.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-slo.page-DZGsui_P.mjs → juice-js-observability-slo.page-l7TOat-D.mjs} +47 -1
- package/fesm2022/juice-js-observability-slo.page-l7TOat-D.mjs.map +1 -0
- package/fesm2022/juice-js-observability-suggestions-eQK_z0Nd.mjs +367 -0
- package/fesm2022/juice-js-observability-suggestions-eQK_z0Nd.mjs.map +1 -0
- package/fesm2022/juice-js-observability.mjs +16 -4
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +1 -1
- package/types/juice-js-observability.d.ts +47 -0
- package/fesm2022/juice-js-observability-alert.page-BNlH9IdQ.mjs.map +0 -1
- package/fesm2022/juice-js-observability-incident.page-C2ZK3MRh.mjs.map +0 -1
- package/fesm2022/juice-js-observability-rules.page-CWaADAe4.mjs.map +0 -1
- package/fesm2022/juice-js-observability-slo.page-DZGsui_P.mjs.map +0 -1
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
|
|
2
|
+
import { o as problemText } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, inject, input, output, signal } from "@angular/core";
|
|
5
|
+
import { RouterLink } from "@angular/router";
|
|
6
|
+
import { DatePipe, DecimalPipe } from "@angular/common";
|
|
7
|
+
import * as i1 from "@angular/forms";
|
|
8
|
+
import { FormsModule } from "@angular/forms";
|
|
9
|
+
import * as i2 from "@angular/material/button";
|
|
10
|
+
import { MatButtonModule } from "@angular/material/button";
|
|
11
|
+
import { MatFormFieldModule } from "@angular/material/form-field";
|
|
12
|
+
import * as i4 from "@angular/material/input";
|
|
13
|
+
import { MatInputModule } from "@angular/material/input";
|
|
14
|
+
import * as i3 from "@angular/material/select";
|
|
15
|
+
var SuggestionsCard = class SuggestionsCard {
|
|
16
|
+
ctx = inject(ContextService);
|
|
17
|
+
api = inject(ApiService);
|
|
18
|
+
suggestions = input(...ngDevMode ? [void 0, { debugName: "suggestions" }] : /* istanbul ignore next */ []);
|
|
19
|
+
withAlert = input(false, ...ngDevMode ? [{ debugName: "withAlert" }] : /* istanbul ignore next */ []);
|
|
20
|
+
incident = input(null, ...ngDevMode ? [{ debugName: "incident" }] : /* istanbul ignore next */ []);
|
|
21
|
+
decided = output();
|
|
22
|
+
sending = signal(false, ...ngDevMode ? [{ debugName: "sending" }] : /* istanbul ignore next */ []);
|
|
23
|
+
error = signal("", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
24
|
+
dismissing = signal("", ...ngDevMode ? [{ debugName: "dismissing" }] : /* istanbul ignore next */ []);
|
|
25
|
+
reason = "";
|
|
26
|
+
key(x) {
|
|
27
|
+
return `${x.alert.id}:${x.other.id}`;
|
|
28
|
+
}
|
|
29
|
+
acceptLabel(x) {
|
|
30
|
+
if (!x.incidentId) return "Merge into a new incident";
|
|
31
|
+
return x.incidentId === this.incident() ? "Add to this incident" : "Add to its incident";
|
|
32
|
+
}
|
|
33
|
+
accept(x) {
|
|
34
|
+
this.run(this.api.acceptSuggestion(x.alert.id, x.other.id));
|
|
35
|
+
}
|
|
36
|
+
dismiss(x) {
|
|
37
|
+
this.run(this.api.dismissSuggestion(x.alert.id, x.other.id, this.reason.trim()));
|
|
38
|
+
}
|
|
39
|
+
run(request) {
|
|
40
|
+
this.sending.set(true);
|
|
41
|
+
this.error.set("");
|
|
42
|
+
request.subscribe({
|
|
43
|
+
next: (d) => {
|
|
44
|
+
this.sending.set(false);
|
|
45
|
+
this.dismissing.set("");
|
|
46
|
+
this.decided.emit(d);
|
|
47
|
+
},
|
|
48
|
+
error: (e) => {
|
|
49
|
+
const status = e.status;
|
|
50
|
+
this.sending.set(false);
|
|
51
|
+
this.error.set(status === 403 ? "Deciding needs the operator or admin role." : problemText(e));
|
|
52
|
+
if (status === 409) {
|
|
53
|
+
this.dismissing.set("");
|
|
54
|
+
this.decided.emit(null);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
60
|
+
minVersion: "12.0.0",
|
|
61
|
+
version: "22.2.4",
|
|
62
|
+
ngImport: i0,
|
|
63
|
+
type: SuggestionsCard,
|
|
64
|
+
deps: [],
|
|
65
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
66
|
+
});
|
|
67
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
68
|
+
minVersion: "17.0.0",
|
|
69
|
+
version: "22.2.4",
|
|
70
|
+
type: SuggestionsCard,
|
|
71
|
+
isStandalone: true,
|
|
72
|
+
selector: "jc-suggestions",
|
|
73
|
+
inputs: {
|
|
74
|
+
suggestions: {
|
|
75
|
+
classPropertyName: "suggestions",
|
|
76
|
+
publicName: "suggestions",
|
|
77
|
+
isSignal: true,
|
|
78
|
+
isRequired: false,
|
|
79
|
+
transformFunction: null
|
|
80
|
+
},
|
|
81
|
+
withAlert: {
|
|
82
|
+
classPropertyName: "withAlert",
|
|
83
|
+
publicName: "withAlert",
|
|
84
|
+
isSignal: true,
|
|
85
|
+
isRequired: false,
|
|
86
|
+
transformFunction: null
|
|
87
|
+
},
|
|
88
|
+
incident: {
|
|
89
|
+
classPropertyName: "incident",
|
|
90
|
+
publicName: "incident",
|
|
91
|
+
isSignal: true,
|
|
92
|
+
isRequired: false,
|
|
93
|
+
transformFunction: null
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
outputs: { decided: "decided" },
|
|
97
|
+
ngImport: i0,
|
|
98
|
+
template: `
|
|
99
|
+
@if (suggestions(); as s) {
|
|
100
|
+
<p class="jc-notice" data-testid="suggestions-note">{{ s.note }}</p>
|
|
101
|
+
<table class="jc-table"><tbody>
|
|
102
|
+
@for (x of s.items; track x.alert.id + x.other.id) {
|
|
103
|
+
<tr data-testid="suggestion">
|
|
104
|
+
<td>
|
|
105
|
+
<a [routerLink]="['alerts', x.other.id] | jcLink" [queryParams]="ctx.keep()"><strong>{{ x.other.rule }}</strong></a>
|
|
106
|
+
<div class="jc-small">{{ x.other.subjectKey }} · {{ x.other.severity }} · fired {{ x.other.firedAt | date: 'HH:mm:ss' }}</div>
|
|
107
|
+
@if (withAlert()) { <div class="jc-muted jc-small">with {{ x.alert.rule }} on {{ x.alert.subjectKey }}</div> }
|
|
108
|
+
</td>
|
|
109
|
+
<td class="jc-nowrap"><strong data-testid="suggestion-score">{{ x.score | number: '1.2-2' }}</strong></td>
|
|
110
|
+
<td class="jc-small"><ul class="jc-reasons">@for (e of x.evidence; track e.code) { <li>{{ e.text }} <span class="jc-muted">(+{{ e.weight | number: '1.2-2' }})</span></li> }</ul></td>
|
|
111
|
+
<td class="jc-row-actions">
|
|
112
|
+
@if (dismissing() === key(x)) {
|
|
113
|
+
<form class="jc-filter-form" (ngSubmit)="dismiss(x)">
|
|
114
|
+
<mat-form-field subscriptSizing="dynamic"><mat-label>Why not related</mat-label><input matInput name="reason" data-testid="suggestion-reason" [(ngModel)]="reason" maxlength="500" required></mat-form-field>
|
|
115
|
+
<button mat-stroked-button type="submit" data-testid="suggestion-dismiss-confirm" [disabled]="sending() || !reason.trim()">Dismiss</button>
|
|
116
|
+
<button mat-button type="button" (click)="dismissing.set('')">Cancel</button>
|
|
117
|
+
</form>
|
|
118
|
+
} @else {
|
|
119
|
+
<button mat-flat-button type="button" data-testid="suggestion-accept" [disabled]="sending()" (click)="accept(x)">{{ acceptLabel(x) }}</button>
|
|
120
|
+
<button mat-button type="button" data-testid="suggestion-dismiss" [disabled]="sending()" (click)="dismissing.set(key(x)); reason = ''">Dismiss</button>
|
|
121
|
+
}
|
|
122
|
+
</td>
|
|
123
|
+
</tr>
|
|
124
|
+
} @empty { <tr><td class="jc-muted">No alerts fired with this one closely enough, or with enough in common, to suggest (a score of {{ s.threshold | number: '1.1-1' }} or more).</td></tr> }
|
|
125
|
+
</tbody></table>
|
|
126
|
+
@if (error()) { <p class="jc-error" data-testid="suggestion-error">{{ error() }}</p> }
|
|
127
|
+
}`,
|
|
128
|
+
isInline: true,
|
|
129
|
+
dependencies: [
|
|
130
|
+
{
|
|
131
|
+
kind: "directive",
|
|
132
|
+
type: RouterLink,
|
|
133
|
+
selector: "[routerLink]",
|
|
134
|
+
inputs: [
|
|
135
|
+
"target",
|
|
136
|
+
"queryParams",
|
|
137
|
+
"fragment",
|
|
138
|
+
"queryParamsHandling",
|
|
139
|
+
"state",
|
|
140
|
+
"info",
|
|
141
|
+
"relativeTo",
|
|
142
|
+
"preserveFragment",
|
|
143
|
+
"skipLocationChange",
|
|
144
|
+
"replaceUrl",
|
|
145
|
+
"browserUrl",
|
|
146
|
+
"routerLink"
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
kind: "ngmodule",
|
|
151
|
+
type: FormsModule
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
kind: "directive",
|
|
155
|
+
type: i1.ɵNgNoValidate,
|
|
156
|
+
selector: "form:not([ngNoForm]):not([ngNativeValidate])"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
kind: "directive",
|
|
160
|
+
type: i1.DefaultValueAccessor,
|
|
161
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
kind: "directive",
|
|
165
|
+
type: i1.NgControlStatus,
|
|
166
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
kind: "directive",
|
|
170
|
+
type: i1.NgControlStatusGroup,
|
|
171
|
+
selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
kind: "directive",
|
|
175
|
+
type: i1.RequiredValidator,
|
|
176
|
+
selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]",
|
|
177
|
+
inputs: ["required"]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
kind: "directive",
|
|
181
|
+
type: i1.MaxLengthValidator,
|
|
182
|
+
selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
|
|
183
|
+
inputs: ["maxlength"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
kind: "directive",
|
|
187
|
+
type: i1.NgModel,
|
|
188
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
189
|
+
inputs: [
|
|
190
|
+
"name",
|
|
191
|
+
"disabled",
|
|
192
|
+
"ngModel",
|
|
193
|
+
"ngModelOptions"
|
|
194
|
+
],
|
|
195
|
+
outputs: ["ngModelChange"],
|
|
196
|
+
exportAs: ["ngModel"]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
kind: "directive",
|
|
200
|
+
type: i1.NgForm,
|
|
201
|
+
selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
|
|
202
|
+
inputs: ["ngFormOptions"],
|
|
203
|
+
outputs: ["ngSubmit"],
|
|
204
|
+
exportAs: ["ngForm"]
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
kind: "ngmodule",
|
|
208
|
+
type: MatButtonModule
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
kind: "component",
|
|
212
|
+
type: i2.MatButton,
|
|
213
|
+
selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
|
|
214
|
+
inputs: ["matButton"],
|
|
215
|
+
exportAs: ["matButton", "matAnchor"]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
kind: "ngmodule",
|
|
219
|
+
type: MatFormFieldModule
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
kind: "component",
|
|
223
|
+
type: i3.MatFormField,
|
|
224
|
+
selector: "mat-form-field",
|
|
225
|
+
inputs: [
|
|
226
|
+
"hideRequiredMarker",
|
|
227
|
+
"color",
|
|
228
|
+
"floatLabel",
|
|
229
|
+
"appearance",
|
|
230
|
+
"subscriptSizing",
|
|
231
|
+
"hintLabel"
|
|
232
|
+
],
|
|
233
|
+
exportAs: ["matFormField"]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
kind: "directive",
|
|
237
|
+
type: i3.MatLabel,
|
|
238
|
+
selector: "mat-label"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
kind: "ngmodule",
|
|
242
|
+
type: MatInputModule
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
kind: "directive",
|
|
246
|
+
type: i4.MatInput,
|
|
247
|
+
selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
|
|
248
|
+
inputs: [
|
|
249
|
+
"disabled",
|
|
250
|
+
"id",
|
|
251
|
+
"placeholder",
|
|
252
|
+
"name",
|
|
253
|
+
"required",
|
|
254
|
+
"type",
|
|
255
|
+
"errorStateMatcher",
|
|
256
|
+
"aria-describedby",
|
|
257
|
+
"value",
|
|
258
|
+
"readonly",
|
|
259
|
+
"disabledInteractive"
|
|
260
|
+
],
|
|
261
|
+
exportAs: ["matInput"]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
kind: "pipe",
|
|
265
|
+
type: LinkPipe,
|
|
266
|
+
name: "jcLink"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
kind: "pipe",
|
|
270
|
+
type: DatePipe,
|
|
271
|
+
name: "date"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
kind: "pipe",
|
|
275
|
+
type: DecimalPipe,
|
|
276
|
+
name: "number"
|
|
277
|
+
}
|
|
278
|
+
],
|
|
279
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
280
|
+
});
|
|
281
|
+
};
|
|
282
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
283
|
+
minVersion: "12.0.0",
|
|
284
|
+
version: "22.2.4",
|
|
285
|
+
ngImport: i0,
|
|
286
|
+
type: SuggestionsCard,
|
|
287
|
+
decorators: [{
|
|
288
|
+
type: Component,
|
|
289
|
+
args: [{
|
|
290
|
+
selector: "jc-suggestions",
|
|
291
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
292
|
+
imports: [
|
|
293
|
+
LinkPipe,
|
|
294
|
+
RouterLink,
|
|
295
|
+
DatePipe,
|
|
296
|
+
DecimalPipe,
|
|
297
|
+
FormsModule,
|
|
298
|
+
MatButtonModule,
|
|
299
|
+
MatFormFieldModule,
|
|
300
|
+
MatInputModule
|
|
301
|
+
],
|
|
302
|
+
template: `
|
|
303
|
+
@if (suggestions(); as s) {
|
|
304
|
+
<p class="jc-notice" data-testid="suggestions-note">{{ s.note }}</p>
|
|
305
|
+
<table class="jc-table"><tbody>
|
|
306
|
+
@for (x of s.items; track x.alert.id + x.other.id) {
|
|
307
|
+
<tr data-testid="suggestion">
|
|
308
|
+
<td>
|
|
309
|
+
<a [routerLink]="['alerts', x.other.id] | jcLink" [queryParams]="ctx.keep()"><strong>{{ x.other.rule }}</strong></a>
|
|
310
|
+
<div class="jc-small">{{ x.other.subjectKey }} · {{ x.other.severity }} · fired {{ x.other.firedAt | date: 'HH:mm:ss' }}</div>
|
|
311
|
+
@if (withAlert()) { <div class="jc-muted jc-small">with {{ x.alert.rule }} on {{ x.alert.subjectKey }}</div> }
|
|
312
|
+
</td>
|
|
313
|
+
<td class="jc-nowrap"><strong data-testid="suggestion-score">{{ x.score | number: '1.2-2' }}</strong></td>
|
|
314
|
+
<td class="jc-small"><ul class="jc-reasons">@for (e of x.evidence; track e.code) { <li>{{ e.text }} <span class="jc-muted">(+{{ e.weight | number: '1.2-2' }})</span></li> }</ul></td>
|
|
315
|
+
<td class="jc-row-actions">
|
|
316
|
+
@if (dismissing() === key(x)) {
|
|
317
|
+
<form class="jc-filter-form" (ngSubmit)="dismiss(x)">
|
|
318
|
+
<mat-form-field subscriptSizing="dynamic"><mat-label>Why not related</mat-label><input matInput name="reason" data-testid="suggestion-reason" [(ngModel)]="reason" maxlength="500" required></mat-form-field>
|
|
319
|
+
<button mat-stroked-button type="submit" data-testid="suggestion-dismiss-confirm" [disabled]="sending() || !reason.trim()">Dismiss</button>
|
|
320
|
+
<button mat-button type="button" (click)="dismissing.set('')">Cancel</button>
|
|
321
|
+
</form>
|
|
322
|
+
} @else {
|
|
323
|
+
<button mat-flat-button type="button" data-testid="suggestion-accept" [disabled]="sending()" (click)="accept(x)">{{ acceptLabel(x) }}</button>
|
|
324
|
+
<button mat-button type="button" data-testid="suggestion-dismiss" [disabled]="sending()" (click)="dismissing.set(key(x)); reason = ''">Dismiss</button>
|
|
325
|
+
}
|
|
326
|
+
</td>
|
|
327
|
+
</tr>
|
|
328
|
+
} @empty { <tr><td class="jc-muted">No alerts fired with this one closely enough, or with enough in common, to suggest (a score of {{ s.threshold | number: '1.1-1' }} or more).</td></tr> }
|
|
329
|
+
</tbody></table>
|
|
330
|
+
@if (error()) { <p class="jc-error" data-testid="suggestion-error">{{ error() }}</p> }
|
|
331
|
+
}`
|
|
332
|
+
}]
|
|
333
|
+
}],
|
|
334
|
+
propDecorators: {
|
|
335
|
+
suggestions: [{
|
|
336
|
+
type: i0.Input,
|
|
337
|
+
args: [{
|
|
338
|
+
isSignal: true,
|
|
339
|
+
alias: "suggestions",
|
|
340
|
+
required: false
|
|
341
|
+
}]
|
|
342
|
+
}],
|
|
343
|
+
withAlert: [{
|
|
344
|
+
type: i0.Input,
|
|
345
|
+
args: [{
|
|
346
|
+
isSignal: true,
|
|
347
|
+
alias: "withAlert",
|
|
348
|
+
required: false
|
|
349
|
+
}]
|
|
350
|
+
}],
|
|
351
|
+
incident: [{
|
|
352
|
+
type: i0.Input,
|
|
353
|
+
args: [{
|
|
354
|
+
isSignal: true,
|
|
355
|
+
alias: "incident",
|
|
356
|
+
required: false
|
|
357
|
+
}]
|
|
358
|
+
}],
|
|
359
|
+
decided: [{
|
|
360
|
+
type: i0.Output,
|
|
361
|
+
args: ["decided"]
|
|
362
|
+
}]
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
export { SuggestionsCard as t };
|
|
366
|
+
|
|
367
|
+
//# sourceMappingURL=juice-js-observability-suggestions-eQK_z0Nd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"juice-js-observability-suggestions-eQK_z0Nd.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/shared/suggestions.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, inject, input, output, signal } from '@angular/core';\nimport { DatePipe, DecimalPipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { CorrelationDecision, Suggestion, Suggestions } from '../core/models';\nimport { LinkPipe } from '../core/options';\nimport { problemText } from './telemetry';\n\n/**\n * Alerts suggested together (Phase 9, R9), on the alert and incident pages: each with its score and every piece of evidence and its weight,\n * labelled as correlation. An operator accepts (merge into one incident) or dismisses with a reason; nothing merges on its own.\n */\n@Component({\n selector: 'jc-suggestions',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, DecimalPipe, FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule],\n template: `\n @if (suggestions(); as s) {\n <p class=\"jc-notice\" data-testid=\"suggestions-note\">{{ s.note }}</p>\n <table class=\"jc-table\"><tbody>\n @for (x of s.items; track x.alert.id + x.other.id) {\n <tr data-testid=\"suggestion\">\n <td>\n <a [routerLink]=\"['alerts', x.other.id] | jcLink\" [queryParams]=\"ctx.keep()\"><strong>{{ x.other.rule }}</strong></a>\n <div class=\"jc-small\">{{ x.other.subjectKey }} · {{ x.other.severity }} · fired {{ x.other.firedAt | date: 'HH:mm:ss' }}</div>\n @if (withAlert()) { <div class=\"jc-muted jc-small\">with {{ x.alert.rule }} on {{ x.alert.subjectKey }}</div> }\n </td>\n <td class=\"jc-nowrap\"><strong data-testid=\"suggestion-score\">{{ x.score | number: '1.2-2' }}</strong></td>\n <td class=\"jc-small\"><ul class=\"jc-reasons\">@for (e of x.evidence; track e.code) { <li>{{ e.text }} <span class=\"jc-muted\">(+{{ e.weight | number: '1.2-2' }})</span></li> }</ul></td>\n <td class=\"jc-row-actions\">\n @if (dismissing() === key(x)) {\n <form class=\"jc-filter-form\" (ngSubmit)=\"dismiss(x)\">\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Why not related</mat-label><input matInput name=\"reason\" data-testid=\"suggestion-reason\" [(ngModel)]=\"reason\" maxlength=\"500\" required></mat-form-field>\n <button mat-stroked-button type=\"submit\" data-testid=\"suggestion-dismiss-confirm\" [disabled]=\"sending() || !reason.trim()\">Dismiss</button>\n <button mat-button type=\"button\" (click)=\"dismissing.set('')\">Cancel</button>\n </form>\n } @else {\n <button mat-flat-button type=\"button\" data-testid=\"suggestion-accept\" [disabled]=\"sending()\" (click)=\"accept(x)\">{{ acceptLabel(x) }}</button>\n <button mat-button type=\"button\" data-testid=\"suggestion-dismiss\" [disabled]=\"sending()\" (click)=\"dismissing.set(key(x)); reason = ''\">Dismiss</button>\n }\n </td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No alerts fired with this one closely enough, or with enough in common, to suggest (a score of {{ s.threshold | number: '1.1-1' }} or more).</td></tr> }\n </tbody></table>\n @if (error()) { <p class=\"jc-error\" data-testid=\"suggestion-error\">{{ error() }}</p> }\n }`,\n})\nexport class SuggestionsCard {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly suggestions = input<Suggestions | undefined>();\n /** On an incident page, the alert in the incident each suggestion goes with. */\n readonly withAlert = input(false);\n /** The incident the page shows, so accepting into it says \"this incident\". */\n readonly incident = input<string | null>(null);\n /** A decision made, or null when one was refused as stale (decided meanwhile, no longer suggested): the page reads the list again. */\n readonly decided = output<CorrelationDecision | null>();\n protected readonly sending = signal(false);\n protected readonly error = signal('');\n protected readonly dismissing = signal('');\n protected reason = '';\n\n protected key(x: Suggestion) { return `${x.alert.id}:${x.other.id}`; }\n\n protected acceptLabel(x: Suggestion) {\n if (!x.incidentId) return 'Merge into a new incident';\n return x.incidentId === this.incident() ? 'Add to this incident' : 'Add to its incident';\n }\n\n protected accept(x: Suggestion) { this.run(this.api.acceptSuggestion(x.alert.id, x.other.id)); }\n\n protected dismiss(x: Suggestion) { this.run(this.api.dismissSuggestion(x.alert.id, x.other.id, this.reason.trim())); }\n\n private run(request: ReturnType<ApiService['acceptSuggestion']>) {\n this.sending.set(true);\n this.error.set('');\n request.subscribe({\n next: d => { this.sending.set(false); this.dismissing.set(''); this.decided.emit(d); },\n error: e => {\n const status = (e as { status?: number }).status;\n this.sending.set(false);\n this.error.set(status === 403 ? 'Deciding needs the operator or admin role.' : problemText(e));\n // The row was stale: someone decided it, or it stopped being suggested. Show the list as it is now, keeping the reason why.\n if (status === 409) { this.dismissing.set(''); this.decided.emit(null); }\n },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAoDA,IAAa,kBAAb,MAAa,gBAAe;CACP,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,cAAc,MAAgC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CAE9C,YAAY,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAExB,WAAW,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAErC,UAAU,OAAM;CACN,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,QAAQ,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAClB,aAAa,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,SAAS;CAET,IAAI,GAAa;EAAI,OAAO,GAAG,EAAE,MAAM,GAAE,GAAI,EAAE,MAAM;CAAM;CAE3D,YAAY,GAAa;EACjC,IAAI,CAAC,EAAE,YAAY,OAAO;EAC1B,OAAO,EAAE,eAAe,KAAK,SAAQ,IAAK,yBAAyB;CACrE;CAEU,OAAO,GAAa;EAAI,KAAK,IAAI,KAAK,IAAI,iBAAiB,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,CAAC;CAAG;CAErF,QAAQ,GAAa;EAAI,KAAK,IAAI,KAAK,IAAI,kBAAkB,EAAE,MAAM,IAAI,EAAE,MAAM,IAAI,KAAK,OAAO,KAAI,CAAE,CA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AA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA7G;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAgC1C,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAnC3B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAa;IAAiB;IAAoB;GAAc;GACvH,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BX,CAAA"}
|
|
@@ -277,6 +277,18 @@ var ApiService = class ApiService {
|
|
|
277
277
|
relatedToAlert(id) {
|
|
278
278
|
return this.get(`/alerts/${id}/related`);
|
|
279
279
|
}
|
|
280
|
+
alertSuggestions(id) {
|
|
281
|
+
return this.get(`/alerts/${id}/suggestions`);
|
|
282
|
+
}
|
|
283
|
+
incidentSuggestions(id) {
|
|
284
|
+
return this.get(`/incidents/${id}/suggestions`);
|
|
285
|
+
}
|
|
286
|
+
acceptSuggestion(alertId, otherId) {
|
|
287
|
+
return this.once(`/alerts/${alertId}/suggestions/${otherId}/accept`, {});
|
|
288
|
+
}
|
|
289
|
+
dismissSuggestion(alertId, otherId, reason) {
|
|
290
|
+
return this.once(`/alerts/${alertId}/suggestions/${otherId}/dismiss`, { reason });
|
|
291
|
+
}
|
|
280
292
|
loadRuns(query) {
|
|
281
293
|
return this.get("/load-runs", query);
|
|
282
294
|
}
|
|
@@ -660,17 +672,17 @@ const OBSERVABILITY_ROUTES = [
|
|
|
660
672
|
page("resources", "Resources", () => import("./juice-js-observability-resources.page-B_AVPpes.mjs").then((m) => m.ResourcesPage)),
|
|
661
673
|
page("resources/:id", "Resource", () => import("./juice-js-observability-resource.page-O4GGdirR.mjs").then((m) => m.ResourcePage)),
|
|
662
674
|
page("alerts", "Alerts", () => import("./juice-js-observability-alerts.page-BNmez0Ak.mjs").then((m) => m.AlertsPage)),
|
|
663
|
-
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-
|
|
664
|
-
page("rules", "Rules", () => import("./juice-js-observability-rules.page-
|
|
675
|
+
page("alerts/:id", "Alert", () => import("./juice-js-observability-alert.page-2kfKksIG.mjs").then((m) => m.AlertPage)),
|
|
676
|
+
page("rules", "Rules", () => import("./juice-js-observability-rules.page-CARCWaw_.mjs").then((m) => m.RulesPage)),
|
|
665
677
|
page("notifications", "Notifications", () => import("./juice-js-observability-notifications.page-CtcV3Ei4.mjs").then((m) => m.NotificationsPage)),
|
|
666
678
|
page("silences", "Silences", () => import("./juice-js-observability-silences.page-CoTqfGxY.mjs").then((m) => m.SilencesPage)),
|
|
667
679
|
page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-DhC3BkBo.mjs").then((m) => m.IncidentsPage)),
|
|
668
|
-
page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-
|
|
680
|
+
page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-D2GvuIft.mjs").then((m) => m.IncidentPage)),
|
|
669
681
|
page("agents", "Agents", () => import("./juice-js-observability-agents.page-Ch-tBwQO.mjs").then((m) => m.AgentsPage)),
|
|
670
682
|
page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-Vb7LDThl.mjs").then((m) => m.AgentPage)),
|
|
671
683
|
page("approvals", "Approvals", () => import("./juice-js-observability-approvals.page-DBLw-vl1.mjs").then((m) => m.ApprovalsPage)),
|
|
672
684
|
page("slos", "SLOs", () => import("./juice-js-observability-slos.page-DNG6g6_R.mjs").then((m) => m.SlosPage)),
|
|
673
|
-
page("slos/:key", "SLO", () => import("./juice-js-observability-slo.page-
|
|
685
|
+
page("slos/:key", "SLO", () => import("./juice-js-observability-slo.page-l7TOat-D.mjs").then((m) => m.SloPage)),
|
|
674
686
|
page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-CFSigOgk.mjs").then((m) => m.TimelinePage)),
|
|
675
687
|
page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-DVuO4zFp.mjs").then((m) => m.LoadRunsPage))
|
|
676
688
|
];
|