@juice-js/observability 1.1.0 → 1.2.0-alpha.37
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/README.md +4 -2
- package/fesm2022/juice-js-observability-agent.page-Vb7LDThl.mjs +1144 -0
- package/fesm2022/juice-js-observability-agent.page-Vb7LDThl.mjs.map +1 -0
- package/fesm2022/juice-js-observability-agents.page-Ch-tBwQO.mjs +413 -0
- package/fesm2022/juice-js-observability-agents.page-Ch-tBwQO.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-alert.page-nEy5Gc6j.mjs → juice-js-observability-alert.page-2kfKksIG.mjs} +200 -4
- package/fesm2022/juice-js-observability-alert.page-2kfKksIG.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-alerts.page-DUXXBanH.mjs → juice-js-observability-alerts.page-BNmez0Ak.mjs} +2 -2
- package/fesm2022/{juice-js-observability-alerts.page-DUXXBanH.mjs.map → juice-js-observability-alerts.page-BNmez0Ak.mjs.map} +1 -1
- package/fesm2022/juice-js-observability-approvals.page-DBLw-vl1.mjs +387 -0
- package/fesm2022/juice-js-observability-approvals.page-DBLw-vl1.mjs.map +1 -0
- package/fesm2022/juice-js-observability-incident.page-D2GvuIft.mjs +436 -0
- package/fesm2022/juice-js-observability-incident.page-D2GvuIft.mjs.map +1 -0
- package/fesm2022/juice-js-observability-incidents.page-DhC3BkBo.mjs +438 -0
- package/fesm2022/juice-js-observability-incidents.page-DhC3BkBo.mjs.map +1 -0
- package/fesm2022/juice-js-observability-load-runs.page-DVuO4zFp.mjs +349 -0
- package/fesm2022/juice-js-observability-load-runs.page-DVuO4zFp.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-logs.page-i76xbJLH.mjs → juice-js-observability-logs.page-PXWQMcvL.mjs} +3 -3
- package/fesm2022/{juice-js-observability-logs.page-i76xbJLH.mjs.map → juice-js-observability-logs.page-PXWQMcvL.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-metrics.page-Cq5S0yGJ.mjs → juice-js-observability-metrics.page-Ctm_EEFb.mjs} +3 -3
- package/fesm2022/{juice-js-observability-metrics.page-Cq5S0yGJ.mjs.map → juice-js-observability-metrics.page-Ctm_EEFb.mjs.map} +1 -1
- package/fesm2022/juice-js-observability-notifications.page-CtcV3Ei4.mjs +758 -0
- package/fesm2022/juice-js-observability-notifications.page-CtcV3Ei4.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-overview.page-DXZl_fUh.mjs → juice-js-observability-overview.page-BRGpTOyc.mjs} +3 -3
- package/fesm2022/{juice-js-observability-overview.page-DXZl_fUh.mjs.map → juice-js-observability-overview.page-BRGpTOyc.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resource.page-CauDE6kK.mjs → juice-js-observability-resource.page-O4GGdirR.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resource.page-CauDE6kK.mjs.map → juice-js-observability-resource.page-O4GGdirR.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resources.page-CukW8vVc.mjs → juice-js-observability-resources.page-B_AVPpes.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resources.page-CukW8vVc.mjs.map → juice-js-observability-resources.page-B_AVPpes.mjs.map} +1 -1
- package/fesm2022/juice-js-observability-rules.page-CARCWaw_.mjs +581 -0
- package/fesm2022/juice-js-observability-rules.page-CARCWaw_.mjs.map +1 -0
- package/fesm2022/juice-js-observability-service.page-DRj1GO0Q.mjs +1257 -0
- package/fesm2022/juice-js-observability-service.page-DRj1GO0Q.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-services.page-B1huLe_a.mjs → juice-js-observability-services.page-BbFbbvyH.mjs} +3 -3
- package/fesm2022/{juice-js-observability-services.page-B1huLe_a.mjs.map → juice-js-observability-services.page-BbFbbvyH.mjs.map} +1 -1
- package/fesm2022/juice-js-observability-silences.page-CoTqfGxY.mjs +523 -0
- package/fesm2022/juice-js-observability-silences.page-CoTqfGxY.mjs.map +1 -0
- package/fesm2022/juice-js-observability-slo.page-l7TOat-D.mjs +414 -0
- package/fesm2022/juice-js-observability-slo.page-l7TOat-D.mjs.map +1 -0
- package/fesm2022/juice-js-observability-slos.page-DNG6g6_R.mjs +267 -0
- package/fesm2022/juice-js-observability-slos.page-DNG6g6_R.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-telemetry-BftWSOaQ.mjs → juice-js-observability-telemetry-DVwUTHSz.mjs} +101 -91
- package/fesm2022/juice-js-observability-telemetry-DVwUTHSz.mjs.map +1 -0
- package/fesm2022/juice-js-observability-timeline.page-CFSigOgk.mjs +213 -0
- package/fesm2022/juice-js-observability-timeline.page-CFSigOgk.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-topology.page-aMWEXyMB.mjs → juice-js-observability-topology.page-BDfNpiql.mjs} +56 -4
- package/fesm2022/juice-js-observability-topology.page-BDfNpiql.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-trace.page-DUCWnZL5.mjs → juice-js-observability-trace.page-CdW09ADY.mjs} +10 -8
- package/fesm2022/juice-js-observability-trace.page-CdW09ADY.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-traces.page-DXSDdeTH.mjs → juice-js-observability-traces.page-CMuItN_m.mjs} +3 -3
- package/fesm2022/{juice-js-observability-traces.page-DXSDdeTH.mjs.map → juice-js-observability-traces.page-CMuItN_m.mjs.map} +1 -1
- package/fesm2022/juice-js-observability.mjs +507 -110
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/_observability.scss +26 -3
- package/types/juice-js-observability.d.ts +623 -1
- package/fesm2022/juice-js-observability-alert.page-nEy5Gc6j.mjs.map +0 -1
- package/fesm2022/juice-js-observability-rules.page-Crb07uWm.mjs +0 -175
- package/fesm2022/juice-js-observability-rules.page-Crb07uWm.mjs.map +0 -1
- package/fesm2022/juice-js-observability-service.page-Dt8bN2Ry.mjs +0 -726
- package/fesm2022/juice-js-observability-service.page-Dt8bN2Ry.mjs.map +0 -1
- package/fesm2022/juice-js-observability-telemetry-BftWSOaQ.mjs.map +0 -1
- package/fesm2022/juice-js-observability-topology.page-aMWEXyMB.mjs.map +0 -1
- package/fesm2022/juice-js-observability-trace.page-DUCWnZL5.mjs.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, u as KeyValueTable, y as ReasonPipe } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
|
|
3
|
+
import { t as SuggestionsCard } from "./juice-js-observability-suggestions-eQK_z0Nd.mjs";
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from "@angular/core";
|
|
5
6
|
import { RouterLink } from "@angular/router";
|
|
6
|
-
import { DatePipe } from "@angular/common";
|
|
7
|
+
import { DatePipe, LowerCasePipe } from "@angular/common";
|
|
7
8
|
import * as i1 from "@angular/forms";
|
|
8
9
|
import { FormsModule } from "@angular/forms";
|
|
9
10
|
import * as i2 from "@angular/material/button";
|
|
@@ -26,6 +27,56 @@ var AlertPage = class AlertPage {
|
|
|
26
27
|
stream: ({ params }) => this.api.alert(params)
|
|
27
28
|
});
|
|
28
29
|
error = computed(() => problemText(this.detail.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
30
|
+
related = apiResource({
|
|
31
|
+
params: () => this.id(),
|
|
32
|
+
stream: ({ params }) => this.api.relatedToAlert(params)
|
|
33
|
+
});
|
|
34
|
+
relatedError = computed(() => problemText(this.related.error()), ...ngDevMode ? [{ debugName: "relatedError" }] : /* istanbul ignore next */ []);
|
|
35
|
+
notifications = apiResource({
|
|
36
|
+
params: () => this.id(),
|
|
37
|
+
stream: ({ params }) => this.api.alertNotifications(params)
|
|
38
|
+
});
|
|
39
|
+
notificationsError = computed(() => problemText(this.notifications.error()), ...ngDevMode ? [{ debugName: "notificationsError" }] : /* istanbul ignore next */ []);
|
|
40
|
+
suggestions = apiResource({
|
|
41
|
+
params: () => this.detail.value()?.alert.state === "Firing" ? this.id() : void 0,
|
|
42
|
+
stream: ({ params }) => this.api.alertSuggestions(params)
|
|
43
|
+
});
|
|
44
|
+
suggestionsError = computed(() => problemText(this.suggestions.error()), ...ngDevMode ? [{ debugName: "suggestionsError" }] : /* istanbul ignore next */ []);
|
|
45
|
+
mergedInto = signal(null, ...ngDevMode ? [{ debugName: "mergedInto" }] : /* istanbul ignore next */ []);
|
|
46
|
+
merged = computed(() => this.mergedInto()?.alert === this.id() ? this.mergedInto().incident : null, ...ngDevMode ? [{ debugName: "merged" }] : /* istanbul ignore next */ []);
|
|
47
|
+
decided(d) {
|
|
48
|
+
if (d?.incidentId) this.mergedInto.set({
|
|
49
|
+
alert: this.id(),
|
|
50
|
+
incident: d.incidentId
|
|
51
|
+
});
|
|
52
|
+
this.suggestions.reload();
|
|
53
|
+
this.notifications.reload();
|
|
54
|
+
}
|
|
55
|
+
incidentLink(alert, rule, subject) {
|
|
56
|
+
return this.ctx.keep({
|
|
57
|
+
alert,
|
|
58
|
+
title: `${rule} on ${subject}`
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
silenceLink(subject, environment, type) {
|
|
62
|
+
const name = type === "service" ? subject.replace(/^service:/, "").replace(/@[^@]*$/, "") : null;
|
|
63
|
+
const host = type === "host" ? subject.replace(/^host:/, "") : null;
|
|
64
|
+
return this.ctx.keep({
|
|
65
|
+
service: name,
|
|
66
|
+
environment,
|
|
67
|
+
host
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
timelineLink(service, environment, breach) {
|
|
71
|
+
const at = new Date(breach).getTime();
|
|
72
|
+
return this.ctx.keep({
|
|
73
|
+
service,
|
|
74
|
+
env: environment,
|
|
75
|
+
range: null,
|
|
76
|
+
from: (/* @__PURE__ */ new Date(at - 72e5)).toISOString(),
|
|
77
|
+
to: new Date(at + 36e5).toISOString()
|
|
78
|
+
});
|
|
79
|
+
}
|
|
29
80
|
investigate(environment, extra = {}) {
|
|
30
81
|
const alert = this.detail.value()?.alert;
|
|
31
82
|
const start = alert?.breachStartedAt ? new Date(alert.breachStartedAt).getTime() - 9e5 : null;
|
|
@@ -48,6 +99,7 @@ var AlertPage = class AlertPage {
|
|
|
48
99
|
next: () => {
|
|
49
100
|
this.sending.set(false);
|
|
50
101
|
this.detail.reload();
|
|
102
|
+
this.notifications.reload();
|
|
51
103
|
},
|
|
52
104
|
error: (e) => {
|
|
53
105
|
this.sending.set(false);
|
|
@@ -95,7 +147,19 @@ var AlertPage = class AlertPage {
|
|
|
95
147
|
<a mat-stroked-button [routerLink]="['services', d.alert.subjectId] | jcLink" [queryParams]="investigate(d.alert.environment, { tab: 'traces', status: 'error' })">Error traces</a>
|
|
96
148
|
}
|
|
97
149
|
@for (l of d.links; track l.url) { <a mat-button [href]="l.url" target="_blank" rel="noopener">{{ l.title }} ↗</a> }
|
|
150
|
+
@if (d.alert.state !== 'Resolved') {
|
|
151
|
+
<a mat-stroked-button data-testid="alert-open-incident" [routerLink]="['incidents'] | jcLink" [queryParams]="incidentLink(d.alert.id, d.alert.rule, d.alert.subjectKey)">Open an incident</a>
|
|
152
|
+
<a mat-stroked-button data-testid="alert-silence" [routerLink]="['silences'] | jcLink" [queryParams]="silenceLink(d.alert.subjectKey, d.alert.environment, d.alert.subjectType)">Silence this</a>
|
|
153
|
+
}
|
|
98
154
|
</div>
|
|
155
|
+
@if (notifications.value(); as n) {
|
|
156
|
+
@for (s of n.silences; track s.id) {
|
|
157
|
+
<p class="jc-notice" data-testid="alert-silenced">Notifications are held until {{ s.endsAt | date: 'MMM d, HH:mm' }}: “{{ s.comment }}” ({{ s.createdBy }}). The alert itself still fires and resolves.</p>
|
|
158
|
+
}
|
|
159
|
+
@for (i of n.incidents; track i.id) {
|
|
160
|
+
<p>In incident <a [routerLink]="['incidents', i.id] | jcLink" [queryParams]="ctx.keep()">{{ i.title }}</a> ({{ i.state }})</p>
|
|
161
|
+
}
|
|
162
|
+
}
|
|
99
163
|
<div class="jc-grid-2">
|
|
100
164
|
<section class="jc-card"><h2>Evidence</h2><jc-kv [values]="d.evidence" /></section>
|
|
101
165
|
<section class="jc-card">
|
|
@@ -106,6 +170,57 @@ var AlertPage = class AlertPage {
|
|
|
106
170
|
} @empty { <p class="jc-muted">No health for this subject.</p> }
|
|
107
171
|
</section>
|
|
108
172
|
</div>
|
|
173
|
+
<section class="jc-card" data-testid="alert-related">
|
|
174
|
+
<h2>Around this alert</h2>
|
|
175
|
+
@if (related.value(); as r) {
|
|
176
|
+
<p class="jc-notice" data-testid="alert-related-note">{{ r.note }}</p>
|
|
177
|
+
<table class="jc-table"><tbody>
|
|
178
|
+
@for (i of r.items; track i.type + i.id) {
|
|
179
|
+
<tr>
|
|
180
|
+
<td class="jc-nowrap">{{ i.at | date: 'MMM d, HH:mm:ss' }}</td>
|
|
181
|
+
<td><strong>{{ i.title }}</strong>@if (i.detail) { <div class="jc-muted jc-small">{{ i.detail }}</div> }</td>
|
|
182
|
+
<td class="jc-small"><ul class="jc-reasons">@for (x of i.reasons; track x.code) { <li>{{ x.text }} <span class="jc-muted">(+{{ x.points }})</span></li> }</ul></td>
|
|
183
|
+
</tr>
|
|
184
|
+
} @empty { <tr><td class="jc-muted">No changes or dependency health changes in the 2 hours before this alert.</td></tr> }
|
|
185
|
+
</tbody></table>
|
|
186
|
+
@if (d.alert.subjectId && d.alert.subjectType === 'service') {
|
|
187
|
+
<a mat-stroked-button [routerLink]="['timeline'] | jcLink" [queryParams]="timelineLink(d.alert.subjectId, d.alert.environment, r.breachStartedAt)">Open the timeline</a>
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
@if (related.error()) { <p class="jc-error">{{ relatedError() }}</p> }
|
|
191
|
+
</section>
|
|
192
|
+
@if (d.alert.state === 'Firing' || merged()) {
|
|
193
|
+
<section class="jc-card" data-testid="alert-suggestions">
|
|
194
|
+
<h2>Suggested with this alert</h2>
|
|
195
|
+
@if (merged(); as m) { <p data-testid="alert-suggestion-merged">Merged into <a [routerLink]="['incidents', m] | jcLink" [queryParams]="ctx.keep()">the incident</a>.</p> }
|
|
196
|
+
<jc-suggestions [suggestions]="suggestions.value()" (decided)="decided($event)" />
|
|
197
|
+
@if (suggestions.error()) { <p class="jc-error">{{ suggestionsError() }}</p> }
|
|
198
|
+
</section>
|
|
199
|
+
}
|
|
200
|
+
<section class="jc-card" data-testid="alert-notifications">
|
|
201
|
+
<h2>Notifications</h2>
|
|
202
|
+
@if (notifications.value(); as n) {
|
|
203
|
+
@for (e of n.escalations; track e.policy) {
|
|
204
|
+
<p>Escalation <strong>{{ e.name }}</strong>: {{ e.stepsSent }} of {{ e.steps }} steps sent, {{ e.state | lowercase }}@if (e.stopReason) { ({{ e.stopReason | reason }}) }@if (e.nextAt) {, next at {{ e.nextAt | date: 'HH:mm:ss' }} }</p>
|
|
205
|
+
}
|
|
206
|
+
<table class="jc-table">
|
|
207
|
+
<thead><tr><th>To</th><th>Event</th><th>Status</th><th>Attempts</th><th>Detail</th><th>When</th></tr></thead>
|
|
208
|
+
<tbody>
|
|
209
|
+
@for (x of n.deliveries; track x.delivery.id) {
|
|
210
|
+
<tr>
|
|
211
|
+
<td>{{ x.endpointKey }} <span class="jc-muted jc-small">{{ x.kind }}</span></td>
|
|
212
|
+
<td>{{ x.delivery.event }}@if (x.delivery.escalationStep) { step {{ x.delivery.escalationStep }} }</td>
|
|
213
|
+
<td [class.jc-bad]="x.delivery.status === 'Failed'">{{ x.delivery.status }}</td>
|
|
214
|
+
<td>{{ x.delivery.attempts }}</td>
|
|
215
|
+
<td class="jc-small">{{ x.delivery.lastError }}@if (x.delivery.nextAttemptAt && x.delivery.status === 'Retrying') { · next {{ x.delivery.nextAttemptAt | date: 'HH:mm:ss' }} }</td>
|
|
216
|
+
<td class="jc-nowrap">{{ x.delivery.createdAt | date: 'MMM d, HH:mm:ss' }}</td>
|
|
217
|
+
</tr>
|
|
218
|
+
} @empty { <tr><td colspan="6" class="jc-muted">Nothing sent about this alert: no channel takes it.</td></tr> }
|
|
219
|
+
</tbody>
|
|
220
|
+
</table>
|
|
221
|
+
}
|
|
222
|
+
@if (notifications.error()) { <p class="jc-error">{{ notificationsError() }}</p> }
|
|
223
|
+
</section>
|
|
109
224
|
<section class="jc-card">
|
|
110
225
|
<h2>History</h2>
|
|
111
226
|
<table class="jc-table"><tbody>
|
|
@@ -290,6 +405,17 @@ var AlertPage = class AlertPage {
|
|
|
290
405
|
selector: "jc-kv",
|
|
291
406
|
inputs: ["values", "empty"]
|
|
292
407
|
},
|
|
408
|
+
{
|
|
409
|
+
kind: "component",
|
|
410
|
+
type: SuggestionsCard,
|
|
411
|
+
selector: "jc-suggestions",
|
|
412
|
+
inputs: [
|
|
413
|
+
"suggestions",
|
|
414
|
+
"withAlert",
|
|
415
|
+
"incident"
|
|
416
|
+
],
|
|
417
|
+
outputs: ["decided"]
|
|
418
|
+
},
|
|
293
419
|
{
|
|
294
420
|
kind: "pipe",
|
|
295
421
|
type: LinkPipe,
|
|
@@ -300,6 +426,11 @@ var AlertPage = class AlertPage {
|
|
|
300
426
|
type: DatePipe,
|
|
301
427
|
name: "date"
|
|
302
428
|
},
|
|
429
|
+
{
|
|
430
|
+
kind: "pipe",
|
|
431
|
+
type: LowerCasePipe,
|
|
432
|
+
name: "lowercase"
|
|
433
|
+
},
|
|
303
434
|
{
|
|
304
435
|
kind: "pipe",
|
|
305
436
|
type: AgoPipe,
|
|
@@ -327,6 +458,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
327
458
|
LinkPipe,
|
|
328
459
|
RouterLink,
|
|
329
460
|
DatePipe,
|
|
461
|
+
LowerCasePipe,
|
|
330
462
|
FormsModule,
|
|
331
463
|
MatButtonModule,
|
|
332
464
|
MatFormFieldModule,
|
|
@@ -336,7 +468,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
336
468
|
HealthBadge,
|
|
337
469
|
KeyValueTable,
|
|
338
470
|
AgoPipe,
|
|
339
|
-
ReasonPipe
|
|
471
|
+
ReasonPipe,
|
|
472
|
+
SuggestionsCard
|
|
340
473
|
],
|
|
341
474
|
template: `
|
|
342
475
|
<jc-context-bar>
|
|
@@ -356,7 +489,19 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
356
489
|
<a mat-stroked-button [routerLink]="['services', d.alert.subjectId] | jcLink" [queryParams]="investigate(d.alert.environment, { tab: 'traces', status: 'error' })">Error traces</a>
|
|
357
490
|
}
|
|
358
491
|
@for (l of d.links; track l.url) { <a mat-button [href]="l.url" target="_blank" rel="noopener">{{ l.title }} ↗</a> }
|
|
492
|
+
@if (d.alert.state !== 'Resolved') {
|
|
493
|
+
<a mat-stroked-button data-testid="alert-open-incident" [routerLink]="['incidents'] | jcLink" [queryParams]="incidentLink(d.alert.id, d.alert.rule, d.alert.subjectKey)">Open an incident</a>
|
|
494
|
+
<a mat-stroked-button data-testid="alert-silence" [routerLink]="['silences'] | jcLink" [queryParams]="silenceLink(d.alert.subjectKey, d.alert.environment, d.alert.subjectType)">Silence this</a>
|
|
495
|
+
}
|
|
359
496
|
</div>
|
|
497
|
+
@if (notifications.value(); as n) {
|
|
498
|
+
@for (s of n.silences; track s.id) {
|
|
499
|
+
<p class="jc-notice" data-testid="alert-silenced">Notifications are held until {{ s.endsAt | date: 'MMM d, HH:mm' }}: “{{ s.comment }}” ({{ s.createdBy }}). The alert itself still fires and resolves.</p>
|
|
500
|
+
}
|
|
501
|
+
@for (i of n.incidents; track i.id) {
|
|
502
|
+
<p>In incident <a [routerLink]="['incidents', i.id] | jcLink" [queryParams]="ctx.keep()">{{ i.title }}</a> ({{ i.state }})</p>
|
|
503
|
+
}
|
|
504
|
+
}
|
|
360
505
|
<div class="jc-grid-2">
|
|
361
506
|
<section class="jc-card"><h2>Evidence</h2><jc-kv [values]="d.evidence" /></section>
|
|
362
507
|
<section class="jc-card">
|
|
@@ -367,6 +512,57 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
367
512
|
} @empty { <p class="jc-muted">No health for this subject.</p> }
|
|
368
513
|
</section>
|
|
369
514
|
</div>
|
|
515
|
+
<section class="jc-card" data-testid="alert-related">
|
|
516
|
+
<h2>Around this alert</h2>
|
|
517
|
+
@if (related.value(); as r) {
|
|
518
|
+
<p class="jc-notice" data-testid="alert-related-note">{{ r.note }}</p>
|
|
519
|
+
<table class="jc-table"><tbody>
|
|
520
|
+
@for (i of r.items; track i.type + i.id) {
|
|
521
|
+
<tr>
|
|
522
|
+
<td class="jc-nowrap">{{ i.at | date: 'MMM d, HH:mm:ss' }}</td>
|
|
523
|
+
<td><strong>{{ i.title }}</strong>@if (i.detail) { <div class="jc-muted jc-small">{{ i.detail }}</div> }</td>
|
|
524
|
+
<td class="jc-small"><ul class="jc-reasons">@for (x of i.reasons; track x.code) { <li>{{ x.text }} <span class="jc-muted">(+{{ x.points }})</span></li> }</ul></td>
|
|
525
|
+
</tr>
|
|
526
|
+
} @empty { <tr><td class="jc-muted">No changes or dependency health changes in the 2 hours before this alert.</td></tr> }
|
|
527
|
+
</tbody></table>
|
|
528
|
+
@if (d.alert.subjectId && d.alert.subjectType === 'service') {
|
|
529
|
+
<a mat-stroked-button [routerLink]="['timeline'] | jcLink" [queryParams]="timelineLink(d.alert.subjectId, d.alert.environment, r.breachStartedAt)">Open the timeline</a>
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
@if (related.error()) { <p class="jc-error">{{ relatedError() }}</p> }
|
|
533
|
+
</section>
|
|
534
|
+
@if (d.alert.state === 'Firing' || merged()) {
|
|
535
|
+
<section class="jc-card" data-testid="alert-suggestions">
|
|
536
|
+
<h2>Suggested with this alert</h2>
|
|
537
|
+
@if (merged(); as m) { <p data-testid="alert-suggestion-merged">Merged into <a [routerLink]="['incidents', m] | jcLink" [queryParams]="ctx.keep()">the incident</a>.</p> }
|
|
538
|
+
<jc-suggestions [suggestions]="suggestions.value()" (decided)="decided($event)" />
|
|
539
|
+
@if (suggestions.error()) { <p class="jc-error">{{ suggestionsError() }}</p> }
|
|
540
|
+
</section>
|
|
541
|
+
}
|
|
542
|
+
<section class="jc-card" data-testid="alert-notifications">
|
|
543
|
+
<h2>Notifications</h2>
|
|
544
|
+
@if (notifications.value(); as n) {
|
|
545
|
+
@for (e of n.escalations; track e.policy) {
|
|
546
|
+
<p>Escalation <strong>{{ e.name }}</strong>: {{ e.stepsSent }} of {{ e.steps }} steps sent, {{ e.state | lowercase }}@if (e.stopReason) { ({{ e.stopReason | reason }}) }@if (e.nextAt) {, next at {{ e.nextAt | date: 'HH:mm:ss' }} }</p>
|
|
547
|
+
}
|
|
548
|
+
<table class="jc-table">
|
|
549
|
+
<thead><tr><th>To</th><th>Event</th><th>Status</th><th>Attempts</th><th>Detail</th><th>When</th></tr></thead>
|
|
550
|
+
<tbody>
|
|
551
|
+
@for (x of n.deliveries; track x.delivery.id) {
|
|
552
|
+
<tr>
|
|
553
|
+
<td>{{ x.endpointKey }} <span class="jc-muted jc-small">{{ x.kind }}</span></td>
|
|
554
|
+
<td>{{ x.delivery.event }}@if (x.delivery.escalationStep) { step {{ x.delivery.escalationStep }} }</td>
|
|
555
|
+
<td [class.jc-bad]="x.delivery.status === 'Failed'">{{ x.delivery.status }}</td>
|
|
556
|
+
<td>{{ x.delivery.attempts }}</td>
|
|
557
|
+
<td class="jc-small">{{ x.delivery.lastError }}@if (x.delivery.nextAttemptAt && x.delivery.status === 'Retrying') { · next {{ x.delivery.nextAttemptAt | date: 'HH:mm:ss' }} }</td>
|
|
558
|
+
<td class="jc-nowrap">{{ x.delivery.createdAt | date: 'MMM d, HH:mm:ss' }}</td>
|
|
559
|
+
</tr>
|
|
560
|
+
} @empty { <tr><td colspan="6" class="jc-muted">Nothing sent about this alert: no channel takes it.</td></tr> }
|
|
561
|
+
</tbody>
|
|
562
|
+
</table>
|
|
563
|
+
}
|
|
564
|
+
@if (notifications.error()) { <p class="jc-error">{{ notificationsError() }}</p> }
|
|
565
|
+
</section>
|
|
370
566
|
<section class="jc-card">
|
|
371
567
|
<h2>History</h2>
|
|
372
568
|
<table class="jc-table"><tbody>
|
|
@@ -401,4 +597,4 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
401
597
|
});
|
|
402
598
|
export { AlertPage };
|
|
403
599
|
|
|
404
|
-
//# sourceMappingURL=juice-js-observability-alert.page-
|
|
600
|
+
//# sourceMappingURL=juice-js-observability-alert.page-2kfKksIG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"juice-js-observability-alert.page-2kfKksIG.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alert.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { DatePipe, LowerCasePipe } 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 { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge, KeyValueTable } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { SuggestionsCard } from '../shared/suggestions';\nimport { CorrelationDecision } from '../core/models';\n\n/**\n * One alert (Console requirements §14): evidence, lifecycle history, the subject's health and reasons, the way into\n * the investigation, and acknowledgement for operators.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, LowerCasePipe, FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatProgressBarModule,\n ContextBar, HealthBadge, KeyValueTable, AgoPipe, ReasonPipe, SuggestionsCard],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Alerts</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ detail.value()?.alert?.rule ?? '…' }}</h1>\n </jc-context-bar>\n @if (detail.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (detail.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (detail.value(); as d) {\n <div class=\"jc-summary\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"d.alert.severity === 'Critical'\" [class.jc-health-degraded]=\"d.alert.severity === 'Warning'\">{{ d.alert.severity }}</span>\n <strong>{{ d.alert.state }}</strong>\n <span>{{ d.alert.subjectKey }}</span>\n @if (d.alert.noData) { <span class=\"jc-muted\">no data at the last evaluation: state kept</span> }\n @if (d.alert.subjectType === 'service' && d.alert.subjectId) {\n <a mat-flat-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment)\">Investigate</a>\n <a mat-stroked-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment, { tab: 'traces', status: 'error' })\">Error traces</a>\n }\n @for (l of d.links; track l.url) { <a mat-button [href]=\"l.url\" target=\"_blank\" rel=\"noopener\">{{ l.title }} ↗</a> }\n @if (d.alert.state !== 'Resolved') {\n <a mat-stroked-button data-testid=\"alert-open-incident\" [routerLink]=\"['incidents'] | jcLink\" [queryParams]=\"incidentLink(d.alert.id, d.alert.rule, d.alert.subjectKey)\">Open an incident</a>\n <a mat-stroked-button data-testid=\"alert-silence\" [routerLink]=\"['silences'] | jcLink\" [queryParams]=\"silenceLink(d.alert.subjectKey, d.alert.environment, d.alert.subjectType)\">Silence this</a>\n }\n </div>\n @if (notifications.value(); as n) {\n @for (s of n.silences; track s.id) {\n <p class=\"jc-notice\" data-testid=\"alert-silenced\">Notifications are held until {{ s.endsAt | date: 'MMM d, HH:mm' }}: “{{ s.comment }}” ({{ s.createdBy }}). The alert itself still fires and resolves.</p>\n }\n @for (i of n.incidents; track i.id) {\n <p>In incident <a [routerLink]=\"['incidents', i.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ i.title }}</a> ({{ i.state }})</p>\n }\n }\n <div class=\"jc-grid-2\">\n <section class=\"jc-card\"><h2>Evidence</h2><jc-kv [values]=\"d.evidence\" /></section>\n <section class=\"jc-card\">\n <h2>Subject health</h2>\n @for (h of d.subjectHealth; track h.subjectId + h.environment) {\n <p><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /> {{ h.environment }}</p>\n <ul class=\"jc-reasons\">@for (r of h.reasons; track r) { <li>{{ r | reason }}</li> }</ul>\n } @empty { <p class=\"jc-muted\">No health for this subject.</p> }\n </section>\n </div>\n <section class=\"jc-card\" data-testid=\"alert-related\">\n <h2>Around this alert</h2>\n @if (related.value(); as r) {\n <p class=\"jc-notice\" data-testid=\"alert-related-note\">{{ r.note }}</p>\n <table class=\"jc-table\"><tbody>\n @for (i of r.items; track i.type + i.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ i.at | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ i.title }}</strong>@if (i.detail) { <div class=\"jc-muted jc-small\">{{ i.detail }}</div> }</td>\n <td class=\"jc-small\"><ul class=\"jc-reasons\">@for (x of i.reasons; track x.code) { <li>{{ x.text }} <span class=\"jc-muted\">(+{{ x.points }})</span></li> }</ul></td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No changes or dependency health changes in the 2 hours before this alert.</td></tr> }\n </tbody></table>\n @if (d.alert.subjectId && d.alert.subjectType === 'service') {\n <a mat-stroked-button [routerLink]=\"['timeline'] | jcLink\" [queryParams]=\"timelineLink(d.alert.subjectId, d.alert.environment, r.breachStartedAt)\">Open the timeline</a>\n }\n }\n @if (related.error()) { <p class=\"jc-error\">{{ relatedError() }}</p> }\n </section>\n @if (d.alert.state === 'Firing' || merged()) {\n <section class=\"jc-card\" data-testid=\"alert-suggestions\">\n <h2>Suggested with this alert</h2>\n @if (merged(); as m) { <p data-testid=\"alert-suggestion-merged\">Merged into <a [routerLink]=\"['incidents', m] | jcLink\" [queryParams]=\"ctx.keep()\">the incident</a>.</p> }\n <jc-suggestions [suggestions]=\"suggestions.value()\" (decided)=\"decided($event)\" />\n @if (suggestions.error()) { <p class=\"jc-error\">{{ suggestionsError() }}</p> }\n </section>\n }\n <section class=\"jc-card\" data-testid=\"alert-notifications\">\n <h2>Notifications</h2>\n @if (notifications.value(); as n) {\n @for (e of n.escalations; track e.policy) {\n <p>Escalation <strong>{{ e.name }}</strong>: {{ e.stepsSent }} of {{ e.steps }} steps sent, {{ e.state | lowercase }}@if (e.stopReason) { ({{ e.stopReason | reason }}) }@if (e.nextAt) {, next at {{ e.nextAt | date: 'HH:mm:ss' }} }</p>\n }\n <table class=\"jc-table\">\n <thead><tr><th>To</th><th>Event</th><th>Status</th><th>Attempts</th><th>Detail</th><th>When</th></tr></thead>\n <tbody>\n @for (x of n.deliveries; track x.delivery.id) {\n <tr>\n <td>{{ x.endpointKey }} <span class=\"jc-muted jc-small\">{{ x.kind }}</span></td>\n <td>{{ x.delivery.event }}@if (x.delivery.escalationStep) { step {{ x.delivery.escalationStep }} }</td>\n <td [class.jc-bad]=\"x.delivery.status === 'Failed'\">{{ x.delivery.status }}</td>\n <td>{{ x.delivery.attempts }}</td>\n <td class=\"jc-small\">{{ x.delivery.lastError }}@if (x.delivery.nextAttemptAt && x.delivery.status === 'Retrying') { · next {{ x.delivery.nextAttemptAt | date: 'HH:mm:ss' }} }</td>\n <td class=\"jc-nowrap\">{{ x.delivery.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">Nothing sent about this alert: no channel takes it.</td></tr> }\n </tbody>\n </table>\n }\n @if (notifications.error()) { <p class=\"jc-error\">{{ notificationsError() }}</p> }\n </section>\n <section class=\"jc-card\">\n <h2>History</h2>\n <table class=\"jc-table\"><tbody>\n @for (t of d.history; track t.at + t.to) {\n <tr><td>{{ t.at | date: 'MMM d, HH:mm:ss' }}</td><td>{{ t.from ?? '—' }} → <strong>{{ t.to }}</strong></td><td>{{ t.reason | reason }}</td><td>{{ t.value ?? '—' }}</td></tr>\n }\n </tbody></table>\n </section>\n <section class=\"jc-card\">\n <h2>Acknowledgement</h2>\n @if (d.alert.acknowledgedAt) {\n <p>By <strong>{{ d.alert.acknowledgedBy }}</strong> {{ d.alert.acknowledgedAt | ago }}@if (d.acknowledgeComment) {: “{{ d.acknowledgeComment }}”}</p>\n } @else if (d.alert.state !== 'Resolved') {\n <form (ngSubmit)=\"acknowledge()\" class=\"jc-filter-form\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Comment</mat-label><input matInput name=\"comment\" [(ngModel)]=\"comment\" maxlength=\"1000\"></mat-form-field>\n <button mat-flat-button type=\"submit\" [disabled]=\"sending()\">Acknowledge</button>\n </form>\n @if (ackError()) { <p class=\"jc-error\">{{ ackError() }}</p> }\n } @else { <p class=\"jc-muted\">Resolved without acknowledgement.</p> }\n </section>\n }`,\n})\nexport class AlertPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly id = input.required<string>();\n protected comment = '';\n protected readonly sending = signal(false);\n protected readonly ackError = signal('');\n\n protected readonly detail = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alert(params) });\n protected readonly error = computed(() => problemText(this.detail.error()));\n protected readonly related = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.relatedToAlert(params) });\n protected readonly relatedError = computed(() => problemText(this.related.error()));\n protected readonly notifications = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alertNotifications(params) });\n protected readonly notificationsError = computed(() => problemText(this.notifications.error()));\n /** Only a firing alert is suggested with others, so only its page asks. */\n protected readonly suggestions = apiResource({\n params: () => (this.detail.value()?.alert.state === 'Firing' ? this.id() : undefined),\n stream: ({ params }) => this.api.alertSuggestions(params),\n });\n protected readonly suggestionsError = computed(() => problemText(this.suggestions.error()));\n /** The incident a suggestion on this page was merged into. Keyed by alert: the page is reused when a suggestion's link opens another alert. */\n private readonly mergedInto = signal<{ alert: string; incident: string } | null>(null);\n protected readonly merged = computed(() => (this.mergedInto()?.alert === this.id() ? this.mergedInto()!.incident : null));\n\n /** A decision, or null when one was refused because the list was stale: either way, read it again. */\n protected decided(d: CorrelationDecision | null) {\n if (d?.incidentId) this.mergedInto.set({ alert: this.id(), incident: d.incidentId });\n this.suggestions.reload();\n this.notifications.reload();\n }\n\n incidentLink(alert: string, rule: string, subject: string) { return this.ctx.keep({ alert, title: `${rule} on ${subject}` }); }\n\n /** The new-silence form, filled in for this alert's subject. */\n silenceLink(subject: string, environment: string | null, type: string) {\n const name = type === 'service' ? subject.replace(/^service:/, '').replace(/@[^@]*$/, '') : null;\n const host = type === 'host' ? subject.replace(/^host:/, '') : null;\n return this.ctx.keep({ service: name, environment, host });\n }\n\n /** The service page over the alert's environment, from shortly before the breach. */\n /** The service's timeline from 2 hours before the breach to 1 hour after. */\n timelineLink(service: string, environment: string | null, breach: string) {\n const at = new Date(breach).getTime();\n return this.ctx.keep({ service, env: environment, range: null, from: new Date(at - 2 * 3_600_000).toISOString(), to: new Date(at + 3_600_000).toISOString() });\n }\n\n investigate(environment: string | null, extra: Record<string, string> = {}) {\n const alert = this.detail.value()?.alert;\n const start = alert?.breachStartedAt ? new Date(alert.breachStartedAt).getTime() - 15 * 60_000 : null;\n const end = alert?.resolvedAt ? new Date(alert.resolvedAt).getTime() + 5 * 60_000 : Date.now();\n const window = start && end - start <= 24 * 3_600_000\n ? { from: new Date(start).toISOString(), to: new Date(end).toISOString(), range: null } : {};\n return this.ctx.keep({ env: environment, ...window, ...extra });\n }\n\n acknowledge() {\n this.sending.set(true);\n this.ackError.set('');\n this.api.acknowledge(this.id(), this.comment).subscribe({\n next: () => { this.sending.set(false); this.detail.reload(); this.notifications.reload(); },\n error: e => {\n this.sending.set(false);\n this.ackError.set((e as { status?: number }).status === 403 ? 'Acknowledging needs the operator or admin role.' : problemText(e));\n },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4IA,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,KAAK,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC5B,UAAU;CACD,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,WAAW,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAErB,SAAS,YAAY;EAAE,cAAc,KAAK,GAAE;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,MAAM,MAAM;CAAC,CAAE;CAChG,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,UAAU,YAAY;EAAE,cAAc,KAAK,GAAE;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,eAAe,MAAM;CAAC,CAAE;CAC1G,eAAe,eAAe,YAAY,KAAK,QAAQ,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAChE,gBAAgB,YAAY;EAAE,cAAc,KAAK,GAAE;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,mBAAmB,MAAM;CAAC,CAAE;CACpH,qBAAqB,eAAe,YAAY,KAAK,cAAc,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,qBAAA,CAAA,+BAAA,CAAA,CAAA;CAE5E,cAAc,YAAY;EAC3C,cAAe,KAAK,OAAO,MAAK,CAAE,EAAE,MAAM,UAAU,WAAW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iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAe;IAAa;IAAiB;IAAoB;IAAgB;IACzH;IAAY;IAAa;IAAe;IAAS;IAAY;GAAe;GAC9E,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiHX,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { c as ContextBar, g as AgoPipe, o as problemText, p as cursorList } from "./juice-js-observability-telemetry-DVwUTHSz.mjs";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
import { ChangeDetectionStrategy, Component, computed, inject, input } from "@angular/core";
|
|
5
5
|
import { RouterLink } from "@angular/router";
|
|
@@ -208,4 +208,4 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
208
208
|
});
|
|
209
209
|
export { AlertsPage };
|
|
210
210
|
|
|
211
|
-
//# sourceMappingURL=juice-js-observability-alerts.page-
|
|
211
|
+
//# sourceMappingURL=juice-js-observability-alerts.page-BNmez0Ak.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"juice-js-observability-alerts.page-
|
|
1
|
+
{"version":3,"file":"juice-js-observability-alerts.page-BNmez0Ak.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alerts.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { cursorList } from '../shared/paging';\nimport { problemText } from '../shared/telemetry';\n\n/** Alerts, newest first (Console requirements §14), filtered by state; 100 at a time, with the next on request. */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatButtonModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Alerts</h1>\n @for (s of states; track s) {\n <a class=\"jc-chip\" [class.jc-selected]=\"s === (state() ?? 'firing')\" [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep({ state: s })\">{{ s }}</a>\n }\n </jc-context-bar>\n @if (alerts.first.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (alerts.first.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Severity</th><th>Rule</th><th>Subject</th><th>State</th><th>Value</th><th>Fired</th><th>Acknowledged</th></tr></thead>\n <tbody>\n @for (a of alerts.items(); track a.id) {\n <tr>\n <td><span class=\"jc-badge\" [class.jc-health-unhealthy]=\"a.severity === 'Critical'\" [class.jc-health-degraded]=\"a.severity === 'Warning'\">{{ a.severity }}</span></td>\n <td><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.rule }}</a></td>\n <td>{{ a.subjectKey }}</td>\n <td>{{ a.state }}@if (a.noData) { <span class=\"jc-muted\" title=\"The last evaluation had too few samples; the state is kept\"> · no data</span> }</td>\n <td>{{ a.lastValue ?? '—' }}</td>\n <td>{{ a.firedAt | ago }}</td>\n <td>{{ a.acknowledgedBy ?? '—' }}</td>\n </tr>\n } @empty { @if (alerts.first.hasValue()) { <tr><td colspan=\"7\" class=\"jc-muted\">No {{ state() ?? 'firing' }} alerts.</td></tr> } }\n </tbody>\n </table>\n @if (alerts.items().length > 0) {\n <div class=\"jc-more\">\n <span class=\"jc-muted\">{{ alerts.items().length }} {{ state() ?? 'firing' }} alert{{ alerts.items().length === 1 ? '' : 's' }}{{ alerts.hasMore() ? ', newest first' : '' }}</span>\n @if (alerts.hasMore()) {\n <button mat-button (click)=\"alerts.more()\" [disabled]=\"alerts.loadingMore()\">{{ alerts.loadingMore() ? 'Loading…' : 'Load more' }}</button>\n }\n @if (alerts.moreError()) { <span class=\"jc-error\">{{ moreError() }}</span> }\n </div>\n }`,\n})\nexport class AlertsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly states = ['firing', 'pending', 'resolved'];\n readonly state = input<string>();\n protected readonly alerts = cursorList(\n () => ({ state: this.state() ?? 'firing', environment: this.ctx.environment() }), params => params, q => this.api.alerts(q));\n protected readonly error = computed(() => problemText(this.alerts.first.error()));\n protected readonly moreError = computed(() => problemText(this.alerts.moreError()));\n}\n"],"mappings":";;;;;;;;;AAkDA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,SAAS;EAAC;EAAU;EAAW;CAAU;CACnD,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACb,SAAS,kBACnB;EAAE,OAAO,KAAK,MAAK,KAAM;EAAU,aAAa,KAAK,IAAI,YAAW;CAAE,KAAK,WAAU,SAAQ,MAAK,KAAK,IAAI,OAAO,CAAC,CAAC;CAC1G,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAM,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC9D,YAAY,eAAe,YAAY,KAAK,OAAO,UAAS,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CARxE,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,qBAAA;EAA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