@juice-js/observability 1.3.1-alpha.41 → 1.3.1-alpha.42

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.
Files changed (56) hide show
  1. package/fesm2022/{juice-js-observability-agent.page-Coq-V7gR.mjs → juice-js-observability-agent.page-BJ0R-pGG.mjs} +2 -2
  2. package/fesm2022/{juice-js-observability-agent.page-Coq-V7gR.mjs.map → juice-js-observability-agent.page-BJ0R-pGG.mjs.map} +1 -1
  3. package/fesm2022/{juice-js-observability-agents.page-BBYRMhUD.mjs → juice-js-observability-agents.page-D-z66p2m.mjs} +2 -2
  4. package/fesm2022/{juice-js-observability-agents.page-BBYRMhUD.mjs.map → juice-js-observability-agents.page-D-z66p2m.mjs.map} +1 -1
  5. package/fesm2022/{juice-js-observability-alert.page-BsnDaMDk.mjs → juice-js-observability-alert.page-DhcSGLH0.mjs} +3 -3
  6. package/fesm2022/{juice-js-observability-alert.page-BsnDaMDk.mjs.map → juice-js-observability-alert.page-DhcSGLH0.mjs.map} +1 -1
  7. package/fesm2022/{juice-js-observability-alerts.page-HFFiapGB.mjs → juice-js-observability-alerts.page-B0ZpGPk9.mjs} +2 -2
  8. package/fesm2022/{juice-js-observability-alerts.page-HFFiapGB.mjs.map → juice-js-observability-alerts.page-B0ZpGPk9.mjs.map} +1 -1
  9. package/fesm2022/{juice-js-observability-approvals.page-CU-EP0l4.mjs → juice-js-observability-approvals.page-l5mwxlcl.mjs} +2 -2
  10. package/fesm2022/{juice-js-observability-approvals.page-CU-EP0l4.mjs.map → juice-js-observability-approvals.page-l5mwxlcl.mjs.map} +1 -1
  11. package/fesm2022/{juice-js-observability-incident.page-D21BdwGq.mjs → juice-js-observability-incident.page-DyT-D0XB.mjs} +3 -3
  12. package/fesm2022/{juice-js-observability-incident.page-D21BdwGq.mjs.map → juice-js-observability-incident.page-DyT-D0XB.mjs.map} +1 -1
  13. package/fesm2022/{juice-js-observability-incidents.page-DHD3qgKI.mjs → juice-js-observability-incidents.page-AK09qCjN.mjs} +2 -2
  14. package/fesm2022/{juice-js-observability-incidents.page-DHD3qgKI.mjs.map → juice-js-observability-incidents.page-AK09qCjN.mjs.map} +1 -1
  15. package/fesm2022/{juice-js-observability-load-runs.page-BalwtIhB.mjs → juice-js-observability-load-runs.page-CGCfrsZj.mjs} +2 -2
  16. package/fesm2022/{juice-js-observability-load-runs.page-BalwtIhB.mjs.map → juice-js-observability-load-runs.page-CGCfrsZj.mjs.map} +1 -1
  17. package/fesm2022/{juice-js-observability-logs.page-CpgT6y_E.mjs → juice-js-observability-logs.page-DZiAYl0A.mjs} +2 -2
  18. package/fesm2022/{juice-js-observability-logs.page-CpgT6y_E.mjs.map → juice-js-observability-logs.page-DZiAYl0A.mjs.map} +1 -1
  19. package/fesm2022/{juice-js-observability-metrics.page-CBHK7a9l.mjs → juice-js-observability-metrics.page-DY8SFoxp.mjs} +2 -2
  20. package/fesm2022/{juice-js-observability-metrics.page-CBHK7a9l.mjs.map → juice-js-observability-metrics.page-DY8SFoxp.mjs.map} +1 -1
  21. package/fesm2022/{juice-js-observability-notifications.page-Diy63nji.mjs → juice-js-observability-notifications.page-COeOVY1T.mjs} +2 -2
  22. package/fesm2022/{juice-js-observability-notifications.page-Diy63nji.mjs.map → juice-js-observability-notifications.page-COeOVY1T.mjs.map} +1 -1
  23. package/fesm2022/{juice-js-observability-overview.page-vRttHzPw.mjs → juice-js-observability-overview.page-CUJFOlnm.mjs} +13 -12
  24. package/fesm2022/juice-js-observability-overview.page-CUJFOlnm.mjs.map +1 -0
  25. package/fesm2022/{juice-js-observability-resource.page-DZ7DT_3f.mjs → juice-js-observability-resource.page-BrLwpTXN.mjs} +2 -2
  26. package/fesm2022/{juice-js-observability-resource.page-DZ7DT_3f.mjs.map → juice-js-observability-resource.page-BrLwpTXN.mjs.map} +1 -1
  27. package/fesm2022/{juice-js-observability-resources.page-Bp9o-_QG.mjs → juice-js-observability-resources.page-Dyh7AjOW.mjs} +2 -2
  28. package/fesm2022/{juice-js-observability-resources.page-Bp9o-_QG.mjs.map → juice-js-observability-resources.page-Dyh7AjOW.mjs.map} +1 -1
  29. package/fesm2022/{juice-js-observability-rules.page-zvXo2xtw.mjs → juice-js-observability-rules.page-C_qiLXN_.mjs} +2 -2
  30. package/fesm2022/{juice-js-observability-rules.page-zvXo2xtw.mjs.map → juice-js-observability-rules.page-C_qiLXN_.mjs.map} +1 -1
  31. package/fesm2022/{juice-js-observability-service.page-Dx4p3DmT.mjs → juice-js-observability-service.page-AxzRoXqg.mjs} +2 -2
  32. package/fesm2022/{juice-js-observability-service.page-Dx4p3DmT.mjs.map → juice-js-observability-service.page-AxzRoXqg.mjs.map} +1 -1
  33. package/fesm2022/{juice-js-observability-services.page-C5-ohRLS.mjs → juice-js-observability-services.page-CpEdbC2L.mjs} +2 -2
  34. package/fesm2022/{juice-js-observability-services.page-C5-ohRLS.mjs.map → juice-js-observability-services.page-CpEdbC2L.mjs.map} +1 -1
  35. package/fesm2022/{juice-js-observability-silences.page-CR5LpnsR.mjs → juice-js-observability-silences.page-DI4q9Fx-.mjs} +2 -2
  36. package/fesm2022/{juice-js-observability-silences.page-CR5LpnsR.mjs.map → juice-js-observability-silences.page-DI4q9Fx-.mjs.map} +1 -1
  37. package/fesm2022/{juice-js-observability-slo.page-BvqkTyKS.mjs → juice-js-observability-slo.page-CAdDtj28.mjs} +3 -3
  38. package/fesm2022/{juice-js-observability-slo.page-BvqkTyKS.mjs.map → juice-js-observability-slo.page-CAdDtj28.mjs.map} +1 -1
  39. package/fesm2022/{juice-js-observability-slos.page-CiTI82Sq.mjs → juice-js-observability-slos.page-CQRX3Kmn.mjs} +2 -2
  40. package/fesm2022/{juice-js-observability-slos.page-CiTI82Sq.mjs.map → juice-js-observability-slos.page-CQRX3Kmn.mjs.map} +1 -1
  41. package/fesm2022/{juice-js-observability-suggestions-BNFraGRP.mjs → juice-js-observability-suggestions-CX_srxh1.mjs} +2 -2
  42. package/fesm2022/{juice-js-observability-suggestions-BNFraGRP.mjs.map → juice-js-observability-suggestions-CX_srxh1.mjs.map} +1 -1
  43. package/fesm2022/{juice-js-observability-telemetry-7uv9jeKI.mjs → juice-js-observability-telemetry-CwdIXE9m.mjs} +2 -2
  44. package/fesm2022/{juice-js-observability-telemetry-7uv9jeKI.mjs.map → juice-js-observability-telemetry-CwdIXE9m.mjs.map} +1 -1
  45. package/fesm2022/{juice-js-observability-timeline.page-BcMxG1eb.mjs → juice-js-observability-timeline.page-dH4NzP4l.mjs} +2 -2
  46. package/fesm2022/{juice-js-observability-timeline.page-BcMxG1eb.mjs.map → juice-js-observability-timeline.page-dH4NzP4l.mjs.map} +1 -1
  47. package/fesm2022/{juice-js-observability-topology.page-Blq_mVC2.mjs → juice-js-observability-topology.page-IJrW71aU.mjs} +2 -2
  48. package/fesm2022/{juice-js-observability-topology.page-Blq_mVC2.mjs.map → juice-js-observability-topology.page-IJrW71aU.mjs.map} +1 -1
  49. package/fesm2022/{juice-js-observability-trace.page-rr-T5b3i.mjs → juice-js-observability-trace.page-Bp8ZBzEh.mjs} +2 -2
  50. package/fesm2022/{juice-js-observability-trace.page-rr-T5b3i.mjs.map → juice-js-observability-trace.page-Bp8ZBzEh.mjs.map} +1 -1
  51. package/fesm2022/{juice-js-observability-traces.page-C2z6MUzK.mjs → juice-js-observability-traces.page-CPcODdxw.mjs} +2 -2
  52. package/fesm2022/{juice-js-observability-traces.page-C2z6MUzK.mjs.map → juice-js-observability-traces.page-CPcODdxw.mjs.map} +1 -1
  53. package/fesm2022/juice-js-observability.mjs +24 -24
  54. package/package.json +1 -1
  55. package/types/juice-js-observability.d.ts +2 -0
  56. package/fesm2022/juice-js-observability-overview.page-vRttHzPw.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-notifications.page-Diy63nji.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/notifications.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { Channel, EscalationPolicy, EscalationStep } from '../core/models';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\nconst list = (text: string) => text.split(',').map(s => s.trim()).filter(Boolean);\n\ninterface ChannelForm {\n id: string | null; key: string; kind: string; url: string; secretRef: string; recipients: string; ruleKeys: string; environments: string; minimumSeverity: string; groupWindowSeconds: number; firing: boolean; resolved: boolean; enabled: boolean;\n}\n\ninterface PolicyForm { editing: boolean; key: string; name: string; ruleKeys: string; environments: string; minimumSeverity: string; stopOnAcknowledge: boolean; enabled: boolean; steps: string; }\n\nconst NEW_CHANNEL: ChannelForm = { id: null, key: '', kind: 'Slack', url: '', secretRef: '', recipients: '', ruleKeys: '', environments: '', minimumSeverity: 'Info', groupWindowSeconds: 0, firing: true, resolved: true, enabled: true };\nconst NEW_POLICY: PolicyForm = { editing: false, key: '', name: '', ruleKeys: '', environments: '', minimumSeverity: 'Critical', stopOnAcknowledge: true, enabled: true, steps: '' };\n\n/**\n * Where notifications go: channels with their failures and history, the private destinations they may reach, and who is told as an alert stays open. Changing any of these\n * needs the admin role. A channel's address and secret are never shown: only the name of where the secret is, to admins.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar],\n template: `\n <jc-context-bar><h1>Notifications</h1></jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Channels <button mat-button type=\"button\" data-testid=\"channel-new\" (click)=\"channel.set(newChannel())\">New channel</button></h2>\n @if (channel(); as f) {\n <form class=\"jc-form\" data-testid=\"channel-form\" (ngSubmit)=\"saveChannel(f)\">\n @if (!f.id) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Kind</mat-label>\n <mat-select name=\"kind\" [(ngModel)]=\"f.kind\"><mat-option value=\"Slack\">Slack</mat-option><mat-option value=\"Teams\">Teams</mat-option><mat-option value=\"Email\">Email</mat-option><mat-option value=\"Webhook\">Signed webhook</mat-option></mat-select>\n </mat-form-field>\n }\n @if (f.kind === 'Webhook') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.id ? 'New URL (keeps the current one if empty)' : 'URL' }}</mat-label><input matInput name=\"url\" [(ngModel)]=\"f.url\"></mat-form-field> }\n @if (f.kind === 'Email') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Recipients, comma separated</mat-label><input matInput name=\"recipients\" [(ngModel)]=\"f.recipients\"></mat-form-field> }\n @else {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.kind === 'Webhook' ? 'Signing secret reference' : 'Reference to the channel URL' }}</mat-label><input matInput name=\"secretRef\" [(ngModel)]=\"f.secretRef\" placeholder=\"env:JUICE_WEBHOOK_OPS\"></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">{{ f.kind === 'Webhook' ? 'The name of where the signing secret is, set on the host.' : 'A Slack or Teams URL is itself a credential, so it stays on the host: this is the name of where it is.' }} Not the secret itself.</p>\n }\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Group for (s)</mat-label><input matInput type=\"number\" min=\"0\" max=\"3600\" name=\"group\" [(ngModel)]=\"f.groupWindowSeconds\"></mat-form-field>\n <mat-checkbox name=\"firing\" [(ngModel)]=\"f.firing\">Firing</mat-checkbox>\n <mat-checkbox name=\"resolved\" [(ngModel)]=\"f.resolved\">Resolved</mat-checkbox>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"channel-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"channel.set(null)\">Cancel</button>\n @if (channelError()) { <span class=\"jc-error\" data-testid=\"channel-error\">{{ channelError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"channels\">\n <thead><tr><th>Channel</th><th>Kind</th><th>Destination</th><th>Takes</th><th>Failed (24 h)</th><th>Waiting</th><th></th></tr></thead>\n <tbody>\n @for (c of channels(); track c.id) {\n <tr [class.jc-muted]=\"!c.enabled\">\n <td><strong>{{ c.key }}</strong><div class=\"jc-muted jc-small\">@if (!c.enabled) { disabled · }@if (c.managedBy === 'config') { from the webhooks file }</div></td>\n <td>{{ c.kind }}</td>\n <td>{{ c.destination }}</td>\n <td class=\"jc-small\">{{ c.minimumSeverity }} and above@if (c.environments.length) { · {{ c.environments.join(', ') }} }@if (c.ruleKeys.length) { · {{ c.ruleKeys.join(', ') }} }@if (c.groupWindowSeconds) { · grouped {{ c.groupWindowSeconds }} s }</td>\n <td [class.jc-bad]=\"c.recentFailures > 0\">{{ c.recentFailures }}</td>\n <td>{{ c.waiting }}</td>\n <td class=\"jc-row-actions\">\n <button mat-button type=\"button\" [attr.data-testid]=\"'channel-history-' + c.key\" (click)=\"history.set(history() === c.id ? null : c.id)\">History</button>\n <button mat-button type=\"button\" [attr.data-testid]=\"'channel-test-' + c.key\" [disabled]=\"testing() === c.id\" (click)=\"testChannel(c.id)\">Test</button>\n @if (c.managedBy !== 'config') { <button mat-button type=\"button\" [attr.data-testid]=\"'channel-edit-' + c.key\" (click)=\"editChannel(c)\">Change</button> }\n @if (tests()[c.id]; as t) { <div class=\"jc-small\" [class.jc-error]=\"!t.ok\" [attr.data-testid]=\"'channel-test-result-' + c.key\">{{ t.text }}</div> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"7\" class=\"jc-muted\">No channels: alerts fire, but nobody is told.</td></tr> }\n </tbody>\n </table>\n @if (history()) {\n <h3>Delivery history</h3>\n @if (deliveries.error()) { <p class=\"jc-error\">{{ deliveriesError() }}</p> }\n <table class=\"jc-table\" data-testid=\"channel-history\">\n <thead><tr><th>Created</th><th>Event</th><th>Status</th><th>Attempts</th><th>Last result</th><th></th></tr></thead>\n <tbody>\n @for (d of deliveries.value()?.items ?? []; track d.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ d.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td>{{ d.event }}@if (d.escalationStep) { step {{ d.escalationStep }} }</td>\n <td [class.jc-bad]=\"d.status === 'Failed'\">{{ d.status }}</td>\n <td>{{ d.attempts }}</td>\n <td class=\"jc-small\">{{ d.lastError ?? (d.lastStatusCode ? 'HTTP ' + d.lastStatusCode : '') }}</td>\n <td class=\"jc-row-actions\">@if (d.status === 'Failed') { <button mat-button type=\"button\" [attr.data-testid]=\"'delivery-retry-' + d.id\" [disabled]=\"saving()\" (click)=\"retry(d.id)\">Retry</button> }</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">Nothing sent yet.</td></tr> }\n </tbody>\n </table>\n @if (retryError()) { <p class=\"jc-error\" data-testid=\"delivery-retry-error\">{{ retryError() }}</p> }\n }\n </section>\n\n <section class=\"jc-card\">\n <h2>Escalation <button mat-button type=\"button\" data-testid=\"policy-new\" (click)=\"policy.set(newPolicy())\">New policy</button></h2>\n @if (policy(); as f) {\n <form class=\"jc-form\" data-testid=\"policy-form\" (ngSubmit)=\"savePolicy(f)\">\n @if (!f.editing) { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Steps, one a line</mat-label><textarea matInput name=\"steps\" rows=\"3\" [(ngModel)]=\"f.steps\" placeholder=\"5: oncall-slack&#10;15: pager, lead-email\"></textarea></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">Minutes after firing, then the channels to tell if the alert is still open.</p>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-checkbox name=\"stop\" [(ngModel)]=\"f.stopOnAcknowledge\">Stop when acknowledged</mat-checkbox>\n <mat-checkbox name=\"policyEnabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"policy-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"policy.set(null)\">Cancel</button>\n @if (policyError()) { <span class=\"jc-error\" data-testid=\"policy-error\">{{ policyError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"policies\">\n <thead><tr><th>Policy</th><th>Steps</th><th>Applies to</th><th>Stops when</th><th></th></tr></thead>\n <tbody>\n @for (p of policies(); track p.id) {\n <tr [class.jc-muted]=\"!p.enabled\">\n <td><strong>{{ p.name }}</strong><div class=\"jc-muted jc-small\">{{ p.key }}@if (!p.enabled) { · disabled }</div></td>\n <td class=\"jc-small\">@for (s of p.steps; track s.afterMinutes) { <div>{{ s.afterMinutes }} min: {{ s.endpointKeys.join(', ') }}</div> }</td>\n <td class=\"jc-small\">{{ p.minimumSeverity }} and above@if (p.environments.length) { · {{ p.environments.join(', ') }} }@if (p.ruleKeys.length) { · {{ p.ruleKeys.join(', ') }} }</td>\n <td class=\"jc-small\">{{ p.stopOnAcknowledge ? 'Acknowledged or resolved' : 'Resolved' }}</td>\n <td class=\"jc-row-actions\"><button mat-button type=\"button\" (click)=\"editPolicy(p)\">Change</button></td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">No policies: a firing alert notifies once.</td></tr> }\n </tbody>\n </table>\n </section>\n\n <section class=\"jc-card\">\n <h2>Private destinations</h2>\n <p class=\"jc-muted jc-small\">A channel may reach a private address only if it's listed here. Loopback, link-local and cloud metadata addresses are never reachable.</p>\n <form class=\"jc-form\" (ngSubmit)=\"addAllowed()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>CIDR or host name</mat-label><input matInput name=\"destination\" data-testid=\"allow-destination\" [(ngModel)]=\"destination\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Ports (443 if empty)</mat-label><input matInput name=\"ports\" data-testid=\"allow-ports\" [(ngModel)]=\"ports\"></mat-form-field>\n <button mat-stroked-button type=\"submit\" data-testid=\"allow-add\" [disabled]=\"saving()\">Allow</button>\n @if (allowError()) { <span class=\"jc-error\" data-testid=\"allow-error\">{{ allowError() }}</span> }\n </form>\n <table class=\"jc-table\" data-testid=\"allowlist\">\n <tbody>\n @for (a of allowed(); track a.destination) {\n <tr>\n <td><strong>{{ a.destination }}</strong> @if (a.managedBy === 'config') { <span class=\"jc-muted jc-small\">from the webhooks file</span> }</td>\n <td>{{ a.ports.length ? a.ports.join(', ') : '443' }}</td>\n <td class=\"jc-row-actions\">@if (a.managedBy !== 'config') { <button mat-button type=\"button\" (click)=\"removeAllowed(a.destination)\">Remove</button> }</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">None: channels reach public addresses only.</td></tr> }\n </tbody>\n </table>\n </section>`,\n})\nexport class NotificationsPage {\n private readonly api = inject(ApiService);\n protected readonly channel = signal<ChannelForm | null>(null);\n protected readonly policy = signal<PolicyForm | null>(null);\n protected readonly history = signal<string | null>(null);\n protected readonly saving = signal(false);\n protected readonly channelError = signal('');\n protected readonly policyError = signal('');\n protected readonly allowError = signal('');\n protected readonly retryError = signal('');\n protected readonly testing = signal<string | null>(null);\n protected readonly tests = signal<Record<string, { ok: boolean; text: string }>>({});\n protected destination = '';\n protected ports = '';\n\n protected readonly data = apiResource({\n stream: () => forkJoin({\n channels: this.api.channels().pipe(map(p => p.items)),\n policies: this.api.escalationPolicies().pipe(map(p => p.items)),\n allowlist: this.api.allowlist().pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly channels = computed(() => this.data.value()?.channels ?? []);\n protected readonly policies = computed(() => this.data.value()?.policies ?? []);\n protected readonly allowed = computed(() => this.data.value()?.allowlist ?? []);\n protected readonly deliveries = apiResource({ params: () => this.history() ?? undefined, stream: ({ params }) => this.api.deliveries(params) });\n protected readonly deliveriesError = computed(() => problemText(this.deliveries.error()));\n\n protected newChannel(): ChannelForm { this.channelError.set(''); return { ...NEW_CHANNEL }; }\n protected newPolicy(): PolicyForm { this.policyError.set(''); return { ...NEW_POLICY }; }\n\n protected editChannel(c: Channel) {\n this.channelError.set('');\n this.channel.set({\n id: c.id, key: c.key, kind: c.kind, url: '', secretRef: c.secretRef ?? '', recipients: (c.recipients ?? []).join(', '), ruleKeys: c.ruleKeys.join(', '), environments: c.environments.join(', '),\n minimumSeverity: c.minimumSeverity, groupWindowSeconds: c.groupWindowSeconds, firing: c.events.includes('alert.firing'), resolved: c.events.includes('alert.resolved'), enabled: c.enabled,\n });\n }\n\n private run<T>(request: Observable<T>, error: (message: string) => void, done: () => void) {\n this.saving.set(true);\n error('');\n request.subscribe({\n next: () => { this.saving.set(false); done(); this.data.reload(); },\n error: e => { this.saving.set(false); error((e as { status?: number }).status === 403 ? 'This needs the admin role.' : problemText(e)); },\n });\n }\n\n protected saveChannel(f: ChannelForm) {\n const events = [f.firing ? 'alert.firing' : '', f.resolved ? 'alert.resolved' : ''].filter(Boolean);\n const body = {\n key: f.key, kind: f.kind, url: f.kind === 'Webhook' && f.url.trim() ? f.url.trim() : undefined, secretRef: f.kind === 'Email' ? undefined : f.secretRef.trim(), recipients: f.kind === 'Email' ? list(f.recipients) : undefined,\n events, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity, groupWindowSeconds: f.groupWindowSeconds || 0, enabled: f.enabled,\n };\n this.run(f.id ? this.api.updateChannel(f.id, body) : this.api.createChannel(body), m => this.channelError.set(m), () => this.channel.set(null));\n }\n\n protected editPolicy(p: EscalationPolicy) {\n this.policyError.set('');\n this.policy.set({\n editing: true, key: p.key, name: p.name, ruleKeys: p.ruleKeys.join(', '), environments: p.environments.join(', '), minimumSeverity: p.minimumSeverity, stopOnAcknowledge: p.stopOnAcknowledge, enabled: p.enabled,\n steps: p.steps.map(s => `${s.afterMinutes}: ${s.endpointKeys.join(', ')}`).join('\\n'),\n });\n }\n\n /** `5: oncall, pager` per line. A line that doesn't read goes to the server as no channels, which says what's wrong. */\n private parseSteps(text: string): EscalationStep[] {\n return text.split('\\n').map(l => l.trim()).filter(Boolean).map(line => {\n const [minutes, ...rest] = line.split(':');\n return { afterMinutes: Number(minutes.trim()), endpointKeys: list(rest.join(':')) };\n });\n }\n\n protected savePolicy(f: PolicyForm) {\n const body = {\n key: f.key, name: f.name, enabled: f.enabled, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity,\n stopOnAcknowledge: f.stopOnAcknowledge, steps: this.parseSteps(f.steps),\n };\n this.run(f.editing ? this.api.updateEscalationPolicy(f.key, body) : this.api.createEscalationPolicy(body), m => this.policyError.set(m), () => this.policy.set(null));\n }\n\n protected addAllowed() {\n this.run(this.api.putAllowlist(this.destination.trim(), list(this.ports).map(Number)), m => this.allowError.set(m), () => { this.destination = ''; this.ports = ''; });\n }\n\n protected removeAllowed(destination: string) {\n this.run(this.api.removeAllowlist(destination), m => this.allowError.set(m), () => undefined);\n }\n\n /** Sends a test through the channel now and shows what happened beside it. Admins only; nothing is queued or retried. */\n protected testChannel(id: string) {\n this.testing.set(id);\n const show = (ok: boolean, text: string) => { this.testing.set(null); this.tests.update(t => ({ ...t, [id]: { ok, text } })); };\n this.api.testChannel(id).subscribe({\n next: r => show(r.delivered, r.delivered\n ? `Test delivered in ${r.durationMs} ms${r.statusCode ? ` (HTTP ${r.statusCode})` : ''}`\n : `Test failed: ${r.error ?? 'unknown'}${r.statusCode ? ` (HTTP ${r.statusCode})` : ''}`),\n error: e => show(false, (e as { status?: number }).status === 403 ? 'Testing a channel needs the admin role.' : problemText(e)),\n });\n }\n\n /** Sends a failed delivery once more; its history shows the new attempt. */\n protected retry(deliveryId: string) {\n const channel = this.history();\n if (!channel) return;\n this.run(this.api.retryDelivery(channel, deliveryId), m => this.retryError.set(m), () => this.deliveries.reload());\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAM,QAAQ,SAAiB,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAI,CAAE,CAAC,CAAC,OAAO,OAAO;AAQhF,MAAM,cAA2B;CAAE,IAAI;CAAM,KAAK;CAAI,MAAM;CAAS,KAAK;CAAI,WAAW;CAAI,YAAY;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAQ,oBAAoB;CAAG,QAAQ;CAAM,UAAU;CAAM,SAAS;AAAI;AACxO,MAAM,aAAyB;CAAE,SAAS;CAAO,KAAK;CAAI,MAAM;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAY,mBAAmB;CAAM,SAAS;CAAM,OAAO;AAAE;AAqJlL,IAAa,oBAAb,MAAa,kBAAiB;CACX,MAAM,OAAO,UAAU;CACrB,UAAU,OAA2B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC1C,SAAS,OAA0B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxC,UAAU,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,SAAS,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACtB,eAAe,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,cAAc,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,aAAa,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/pages/notifications.page.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { Channel, EscalationPolicy, EscalationStep } from '../core/models';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\nconst list = (text: string) => text.split(',').map(s => s.trim()).filter(Boolean);\n\ninterface ChannelForm {\n id: string | null; key: string; kind: string; url: string; secretRef: string; recipients: string; ruleKeys: string; environments: string; minimumSeverity: string; groupWindowSeconds: number; firing: boolean; resolved: boolean; enabled: boolean;\n}\n\ninterface PolicyForm { editing: boolean; key: string; name: string; ruleKeys: string; environments: string; minimumSeverity: string; stopOnAcknowledge: boolean; enabled: boolean; steps: string; }\n\nconst NEW_CHANNEL: ChannelForm = { id: null, key: '', kind: 'Slack', url: '', secretRef: '', recipients: '', ruleKeys: '', environments: '', minimumSeverity: 'Info', groupWindowSeconds: 0, firing: true, resolved: true, enabled: true };\nconst NEW_POLICY: PolicyForm = { editing: false, key: '', name: '', ruleKeys: '', environments: '', minimumSeverity: 'Critical', stopOnAcknowledge: true, enabled: true, steps: '' };\n\n/**\n * Where notifications go: channels with their failures and history, the private destinations they may reach, and who is told as an alert stays open. Changing any of these\n * needs the admin role. A channel's address and secret are never shown: only the name of where the secret is, to admins.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar],\n template: `\n <jc-context-bar><h1>Notifications</h1></jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Channels <button mat-button type=\"button\" data-testid=\"channel-new\" (click)=\"channel.set(newChannel())\">New channel</button></h2>\n @if (channel(); as f) {\n <form class=\"jc-form\" data-testid=\"channel-form\" (ngSubmit)=\"saveChannel(f)\">\n @if (!f.id) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Kind</mat-label>\n <mat-select name=\"kind\" [(ngModel)]=\"f.kind\"><mat-option value=\"Slack\">Slack</mat-option><mat-option value=\"Teams\">Teams</mat-option><mat-option value=\"Email\">Email</mat-option><mat-option value=\"Webhook\">Signed webhook</mat-option></mat-select>\n </mat-form-field>\n }\n @if (f.kind === 'Webhook') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.id ? 'New URL (keeps the current one if empty)' : 'URL' }}</mat-label><input matInput name=\"url\" [(ngModel)]=\"f.url\"></mat-form-field> }\n @if (f.kind === 'Email') { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Recipients, comma separated</mat-label><input matInput name=\"recipients\" [(ngModel)]=\"f.recipients\"></mat-form-field> }\n @else {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>{{ f.kind === 'Webhook' ? 'Signing secret reference' : 'Reference to the channel URL' }}</mat-label><input matInput name=\"secretRef\" [(ngModel)]=\"f.secretRef\" placeholder=\"env:JUICE_WEBHOOK_OPS\"></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">{{ f.kind === 'Webhook' ? 'The name of where the signing secret is, set on the host.' : 'A Slack or Teams URL is itself a credential, so it stays on the host: this is the name of where it is.' }} Not the secret itself.</p>\n }\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Group for (s)</mat-label><input matInput type=\"number\" min=\"0\" max=\"3600\" name=\"group\" [(ngModel)]=\"f.groupWindowSeconds\"></mat-form-field>\n <mat-checkbox name=\"firing\" [(ngModel)]=\"f.firing\">Firing</mat-checkbox>\n <mat-checkbox name=\"resolved\" [(ngModel)]=\"f.resolved\">Resolved</mat-checkbox>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"channel-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"channel.set(null)\">Cancel</button>\n @if (channelError()) { <span class=\"jc-error\" data-testid=\"channel-error\">{{ channelError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"channels\">\n <thead><tr><th>Channel</th><th>Kind</th><th>Destination</th><th>Takes</th><th>Failed (24 h)</th><th>Waiting</th><th></th></tr></thead>\n <tbody>\n @for (c of channels(); track c.id) {\n <tr [class.jc-muted]=\"!c.enabled\">\n <td><strong>{{ c.key }}</strong><div class=\"jc-muted jc-small\">@if (!c.enabled) { disabled · }@if (c.managedBy === 'config') { from the webhooks file }</div></td>\n <td>{{ c.kind }}</td>\n <td>{{ c.destination }}</td>\n <td class=\"jc-small\">{{ c.minimumSeverity }} and above@if (c.environments.length) { · {{ c.environments.join(', ') }} }@if (c.ruleKeys.length) { · {{ c.ruleKeys.join(', ') }} }@if (c.groupWindowSeconds) { · grouped {{ c.groupWindowSeconds }} s }</td>\n <td [class.jc-bad]=\"c.recentFailures > 0\">{{ c.recentFailures }}</td>\n <td>{{ c.waiting }}</td>\n <td class=\"jc-row-actions\">\n <button mat-button type=\"button\" [attr.data-testid]=\"'channel-history-' + c.key\" (click)=\"history.set(history() === c.id ? null : c.id)\">History</button>\n <button mat-button type=\"button\" [attr.data-testid]=\"'channel-test-' + c.key\" [disabled]=\"testing() === c.id\" (click)=\"testChannel(c.id)\">Test</button>\n @if (c.managedBy !== 'config') { <button mat-button type=\"button\" [attr.data-testid]=\"'channel-edit-' + c.key\" (click)=\"editChannel(c)\">Change</button> }\n @if (tests()[c.id]; as t) { <div class=\"jc-small\" [class.jc-error]=\"!t.ok\" [attr.data-testid]=\"'channel-test-result-' + c.key\">{{ t.text }}</div> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"7\" class=\"jc-muted\">No channels: alerts fire, but nobody is told.</td></tr> }\n </tbody>\n </table>\n @if (history()) {\n <h3>Delivery history</h3>\n @if (deliveries.error()) { <p class=\"jc-error\">{{ deliveriesError() }}</p> }\n <table class=\"jc-table\" data-testid=\"channel-history\">\n <thead><tr><th>Created</th><th>Event</th><th>Status</th><th>Attempts</th><th>Last result</th><th></th></tr></thead>\n <tbody>\n @for (d of deliveries.value()?.items ?? []; track d.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ d.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td>{{ d.event }}@if (d.escalationStep) { step {{ d.escalationStep }} }</td>\n <td [class.jc-bad]=\"d.status === 'Failed'\">{{ d.status }}</td>\n <td>{{ d.attempts }}</td>\n <td class=\"jc-small\">{{ d.lastError ?? (d.lastStatusCode ? 'HTTP ' + d.lastStatusCode : '') }}</td>\n <td class=\"jc-row-actions\">@if (d.status === 'Failed') { <button mat-button type=\"button\" [attr.data-testid]=\"'delivery-retry-' + d.id\" [disabled]=\"saving()\" (click)=\"retry(d.id)\">Retry</button> }</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">Nothing sent yet.</td></tr> }\n </tbody>\n </table>\n @if (retryError()) { <p class=\"jc-error\" data-testid=\"delivery-retry-error\">{{ retryError() }}</p> }\n }\n </section>\n\n <section class=\"jc-card\">\n <h2>Escalation <button mat-button type=\"button\" data-testid=\"policy-new\" (click)=\"policy.set(newPolicy())\">New policy</button></h2>\n @if (policy(); as f) {\n <form class=\"jc-form\" data-testid=\"policy-form\" (ngSubmit)=\"savePolicy(f)\">\n @if (!f.editing) { <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Steps, one a line</mat-label><textarea matInput name=\"steps\" rows=\"3\" [(ngModel)]=\"f.steps\" placeholder=\"5: oncall-slack&#10;15: pager, lead-email\"></textarea></mat-form-field>\n <p class=\"jc-muted jc-small jc-form-actions\">Minutes after firing, then the channels to tell if the alert is still open.</p>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these rules</mat-label><input matInput name=\"ruleKeys\" [(ngModel)]=\"f.ruleKeys\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Only these environments</mat-label><input matInput name=\"environments\" [(ngModel)]=\"f.environments\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity at least</mat-label>\n <mat-select name=\"minimumSeverity\" [(ngModel)]=\"f.minimumSeverity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n <mat-checkbox name=\"stop\" [(ngModel)]=\"f.stopOnAcknowledge\">Stop when acknowledged</mat-checkbox>\n <mat-checkbox name=\"policyEnabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"policy-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"policy.set(null)\">Cancel</button>\n @if (policyError()) { <span class=\"jc-error\" data-testid=\"policy-error\">{{ policyError() }}</span> }\n </div>\n </form>\n }\n <table class=\"jc-table\" data-testid=\"policies\">\n <thead><tr><th>Policy</th><th>Steps</th><th>Applies to</th><th>Stops when</th><th></th></tr></thead>\n <tbody>\n @for (p of policies(); track p.id) {\n <tr [class.jc-muted]=\"!p.enabled\">\n <td><strong>{{ p.name }}</strong><div class=\"jc-muted jc-small\">{{ p.key }}@if (!p.enabled) { · disabled }</div></td>\n <td class=\"jc-small\">@for (s of p.steps; track s.afterMinutes) { <div>{{ s.afterMinutes }} min: {{ s.endpointKeys.join(', ') }}</div> }</td>\n <td class=\"jc-small\">{{ p.minimumSeverity }} and above@if (p.environments.length) { · {{ p.environments.join(', ') }} }@if (p.ruleKeys.length) { · {{ p.ruleKeys.join(', ') }} }</td>\n <td class=\"jc-small\">{{ p.stopOnAcknowledge ? 'Acknowledged or resolved' : 'Resolved' }}</td>\n <td class=\"jc-row-actions\"><button mat-button type=\"button\" (click)=\"editPolicy(p)\">Change</button></td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">No policies: a firing alert notifies once.</td></tr> }\n </tbody>\n </table>\n </section>\n\n <section class=\"jc-card\">\n <h2>Private destinations</h2>\n <p class=\"jc-muted jc-small\">A channel may reach a private address only if it's listed here. Loopback, link-local and cloud metadata addresses are never reachable.</p>\n <form class=\"jc-form\" (ngSubmit)=\"addAllowed()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>CIDR or host name</mat-label><input matInput name=\"destination\" data-testid=\"allow-destination\" [(ngModel)]=\"destination\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Ports (443 if empty)</mat-label><input matInput name=\"ports\" data-testid=\"allow-ports\" [(ngModel)]=\"ports\"></mat-form-field>\n <button mat-stroked-button type=\"submit\" data-testid=\"allow-add\" [disabled]=\"saving()\">Allow</button>\n @if (allowError()) { <span class=\"jc-error\" data-testid=\"allow-error\">{{ allowError() }}</span> }\n </form>\n <table class=\"jc-table\" data-testid=\"allowlist\">\n <tbody>\n @for (a of allowed(); track a.destination) {\n <tr>\n <td><strong>{{ a.destination }}</strong> @if (a.managedBy === 'config') { <span class=\"jc-muted jc-small\">from the webhooks file</span> }</td>\n <td>{{ a.ports.length ? a.ports.join(', ') : '443' }}</td>\n <td class=\"jc-row-actions\">@if (a.managedBy !== 'config') { <button mat-button type=\"button\" (click)=\"removeAllowed(a.destination)\">Remove</button> }</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">None: channels reach public addresses only.</td></tr> }\n </tbody>\n </table>\n </section>`,\n})\nexport class NotificationsPage {\n private readonly api = inject(ApiService);\n protected readonly channel = signal<ChannelForm | null>(null);\n protected readonly policy = signal<PolicyForm | null>(null);\n protected readonly history = signal<string | null>(null);\n protected readonly saving = signal(false);\n protected readonly channelError = signal('');\n protected readonly policyError = signal('');\n protected readonly allowError = signal('');\n protected readonly retryError = signal('');\n protected readonly testing = signal<string | null>(null);\n protected readonly tests = signal<Record<string, { ok: boolean; text: string }>>({});\n protected destination = '';\n protected ports = '';\n\n protected readonly data = apiResource({\n stream: () => forkJoin({\n channels: this.api.channels().pipe(map(p => p.items)),\n policies: this.api.escalationPolicies().pipe(map(p => p.items)),\n allowlist: this.api.allowlist().pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly channels = computed(() => this.data.value()?.channels ?? []);\n protected readonly policies = computed(() => this.data.value()?.policies ?? []);\n protected readonly allowed = computed(() => this.data.value()?.allowlist ?? []);\n protected readonly deliveries = apiResource({ params: () => this.history() ?? undefined, stream: ({ params }) => this.api.deliveries(params) });\n protected readonly deliveriesError = computed(() => problemText(this.deliveries.error()));\n\n protected newChannel(): ChannelForm { this.channelError.set(''); return { ...NEW_CHANNEL }; }\n protected newPolicy(): PolicyForm { this.policyError.set(''); return { ...NEW_POLICY }; }\n\n protected editChannel(c: Channel) {\n this.channelError.set('');\n this.channel.set({\n id: c.id, key: c.key, kind: c.kind, url: '', secretRef: c.secretRef ?? '', recipients: (c.recipients ?? []).join(', '), ruleKeys: c.ruleKeys.join(', '), environments: c.environments.join(', '),\n minimumSeverity: c.minimumSeverity, groupWindowSeconds: c.groupWindowSeconds, firing: c.events.includes('alert.firing'), resolved: c.events.includes('alert.resolved'), enabled: c.enabled,\n });\n }\n\n private run<T>(request: Observable<T>, error: (message: string) => void, done: () => void) {\n this.saving.set(true);\n error('');\n request.subscribe({\n next: () => { this.saving.set(false); done(); this.data.reload(); },\n error: e => { this.saving.set(false); error((e as { status?: number }).status === 403 ? 'This needs the admin role.' : problemText(e)); },\n });\n }\n\n protected saveChannel(f: ChannelForm) {\n const events = [f.firing ? 'alert.firing' : '', f.resolved ? 'alert.resolved' : ''].filter(Boolean);\n const body = {\n key: f.key, kind: f.kind, url: f.kind === 'Webhook' && f.url.trim() ? f.url.trim() : undefined, secretRef: f.kind === 'Email' ? undefined : f.secretRef.trim(), recipients: f.kind === 'Email' ? list(f.recipients) : undefined,\n events, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity, groupWindowSeconds: f.groupWindowSeconds || 0, enabled: f.enabled,\n };\n this.run(f.id ? this.api.updateChannel(f.id, body) : this.api.createChannel(body), m => this.channelError.set(m), () => this.channel.set(null));\n }\n\n protected editPolicy(p: EscalationPolicy) {\n this.policyError.set('');\n this.policy.set({\n editing: true, key: p.key, name: p.name, ruleKeys: p.ruleKeys.join(', '), environments: p.environments.join(', '), minimumSeverity: p.minimumSeverity, stopOnAcknowledge: p.stopOnAcknowledge, enabled: p.enabled,\n steps: p.steps.map(s => `${s.afterMinutes}: ${s.endpointKeys.join(', ')}`).join('\\n'),\n });\n }\n\n /** `5: oncall, pager` per line. A line that doesn't read goes to the server as no channels, which says what's wrong. */\n private parseSteps(text: string): EscalationStep[] {\n return text.split('\\n').map(l => l.trim()).filter(Boolean).map(line => {\n const [minutes, ...rest] = line.split(':');\n return { afterMinutes: Number(minutes.trim()), endpointKeys: list(rest.join(':')) };\n });\n }\n\n protected savePolicy(f: PolicyForm) {\n const body = {\n key: f.key, name: f.name, enabled: f.enabled, ruleKeys: list(f.ruleKeys), environments: list(f.environments).map(e => e.toLowerCase()), minimumSeverity: f.minimumSeverity,\n stopOnAcknowledge: f.stopOnAcknowledge, steps: this.parseSteps(f.steps),\n };\n this.run(f.editing ? this.api.updateEscalationPolicy(f.key, body) : this.api.createEscalationPolicy(body), m => this.policyError.set(m), () => this.policy.set(null));\n }\n\n protected addAllowed() {\n this.run(this.api.putAllowlist(this.destination.trim(), list(this.ports).map(Number)), m => this.allowError.set(m), () => { this.destination = ''; this.ports = ''; });\n }\n\n protected removeAllowed(destination: string) {\n this.run(this.api.removeAllowlist(destination), m => this.allowError.set(m), () => undefined);\n }\n\n /** Sends a test through the channel now and shows what happened beside it. Admins only; nothing is queued or retried. */\n protected testChannel(id: string) {\n this.testing.set(id);\n const show = (ok: boolean, text: string) => { this.testing.set(null); this.tests.update(t => ({ ...t, [id]: { ok, text } })); };\n this.api.testChannel(id).subscribe({\n next: r => show(r.delivered, r.delivered\n ? `Test delivered in ${r.durationMs} ms${r.statusCode ? ` (HTTP ${r.statusCode})` : ''}`\n : `Test failed: ${r.error ?? 'unknown'}${r.statusCode ? ` (HTTP ${r.statusCode})` : ''}`),\n error: e => show(false, (e as { status?: number }).status === 403 ? 'Testing a channel needs the admin role.' : problemText(e)),\n });\n }\n\n /** Sends a failed delivery once more; its history shows the new attempt. */\n protected retry(deliveryId: string) {\n const channel = this.history();\n if (!channel) return;\n this.run(this.api.retryDelivery(channel, deliveryId), m => this.retryError.set(m), () => this.deliveries.reload());\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAM,QAAQ,SAAiB,KAAK,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAI,CAAE,CAAC,CAAC,OAAO,OAAO;AAQhF,MAAM,cAA2B;CAAE,IAAI;CAAM,KAAK;CAAI,MAAM;CAAS,KAAK;CAAI,WAAW;CAAI,YAAY;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAQ,oBAAoB;CAAG,QAAQ;CAAM,UAAU;CAAM,SAAS;AAAI;AACxO,MAAM,aAAyB;CAAE,SAAS;CAAO,KAAK;CAAI,MAAM;CAAI,UAAU;CAAI,cAAc;CAAI,iBAAiB;CAAY,mBAAmB;CAAM,SAAS;CAAM,OAAO;AAAE;AAqJlL,IAAa,oBAAb,MAAa,kBAAiB;CACX,MAAM,OAAO,UAAU;CACrB,UAAU,OAA2B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC1C,SAAS,OAA0B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxC,UAAU,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,SAAS,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACtB,eAAe,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,cAAc,OAAO,IAAG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9 +1,9 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { C as formatPercent, S as formatDuration, c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, x as formatBytes, y as ReasonPipe } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
2
+ import { C as formatDuration, S as formatBytes, c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, w as formatPercent, x as formatAgo, y as ReasonPipe } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, signal } from "@angular/core";
5
5
  import { RouterLink } from "@angular/router";
6
- import { EMPTY, catchError, map, switchMap, takeWhile, tap, timer } from "rxjs";
6
+ import { EMPTY, catchError, interval, map, switchMap, takeWhile, tap, timer } from "rxjs";
7
7
  import { toSignal } from "@angular/core/rxjs-interop";
8
8
  import { DecimalPipe } from "@angular/common";
9
9
  import * as i1 from "@angular/material/progress-bar";
@@ -39,6 +39,11 @@ var PlatformPanel = class PlatformPanel {
39
39
  canOperate = toSignal(this.api.tenant$.pipe(map((t) => !!t.canOperate)), { initialValue: false });
40
40
  hidden = computed(() => !this.canOperate() || this.failed()?.status === 403, ...ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []);
41
41
  error = computed(() => this.failed() && !this.hidden() ? problemText(this.failed()) : "", ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
42
+ tick = toSignal(interval(1e3), { initialValue: 0 });
43
+ ago(iso) {
44
+ this.tick();
45
+ return formatAgo(iso);
46
+ }
42
47
  cls(level) {
43
48
  return `jc-badge ${LEVEL_CLASS[level]}`;
44
49
  }
@@ -88,7 +93,7 @@ var PlatformPanel = class PlatformPanel {
88
93
  <h2 id="jc-platform-title">Platform</h2>
89
94
  @if (o(); as o) {
90
95
  <span class="jc-badge" [class]="cls(o.status === 'ok' ? 'ok' : 'bad')">{{ o.status }}</span>
91
- <span class="jc-muted">sampled {{ o.at | ago }}</span>
96
+ <span class="jc-muted" title="When this replica last sampled the Collector, ClickHouse and PostgreSQL (every 15 s)">{{ o.sampledAt ? 'sampled ' + ago(o.sampledAt) : 'not sampled yet' }}</span>
92
97
  }
93
98
  </div>
94
99
  @if (error()) { <p class="jc-error">{{ error() }}</p> }
@@ -101,7 +106,7 @@ var PlatformPanel = class PlatformPanel {
101
106
  <span class="jc-badge" [class]="cls(w.level)">{{ w.state }}</span>
102
107
  <strong>{{ w.name }}</strong>
103
108
  @if (w.utilisation !== null) { <span title="Its recent passes against its interval">{{ pct(w.utilisation) }} busy</span> }
104
- @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ w.lastPassEndedAt | ago }}</span> }
109
+ @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ ago(w.lastPassEndedAt) }}</span> }
105
110
  </div>
106
111
  }
107
112
  @for (b of o.backlogs; track b.name) {
@@ -204,10 +209,6 @@ var PlatformPanel = class PlatformPanel {
204
209
  }`,
205
210
  isInline: true,
206
211
  dependencies: [{
207
- kind: "pipe",
208
- type: AgoPipe,
209
- name: "ago"
210
- }, {
211
212
  kind: "pipe",
212
213
  type: DecimalPipe,
213
214
  name: "number"
@@ -225,7 +226,7 @@ i0.ɵɵngDeclareClassMetadata({
225
226
  args: [{
226
227
  selector: "jc-platform-panel",
227
228
  changeDetection: ChangeDetectionStrategy.OnPush,
228
- imports: [AgoPipe, DecimalPipe],
229
+ imports: [DecimalPipe],
229
230
  template: `
230
231
  @if (!hidden()) {
231
232
  <section class="jc-card jc-platform" aria-labelledby="jc-platform-title">
@@ -233,7 +234,7 @@ i0.ɵɵngDeclareClassMetadata({
233
234
  <h2 id="jc-platform-title">Platform</h2>
234
235
  @if (o(); as o) {
235
236
  <span class="jc-badge" [class]="cls(o.status === 'ok' ? 'ok' : 'bad')">{{ o.status }}</span>
236
- <span class="jc-muted">sampled {{ o.at | ago }}</span>
237
+ <span class="jc-muted" title="When this replica last sampled the Collector, ClickHouse and PostgreSQL (every 15 s)">{{ o.sampledAt ? 'sampled ' + ago(o.sampledAt) : 'not sampled yet' }}</span>
237
238
  }
238
239
  </div>
239
240
  @if (error()) { <p class="jc-error">{{ error() }}</p> }
@@ -246,7 +247,7 @@ i0.ɵɵngDeclareClassMetadata({
246
247
  <span class="jc-badge" [class]="cls(w.level)">{{ w.state }}</span>
247
248
  <strong>{{ w.name }}</strong>
248
249
  @if (w.utilisation !== null) { <span title="Its recent passes against its interval">{{ pct(w.utilisation) }} busy</span> }
249
- @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ w.lastPassEndedAt | ago }}</span> }
250
+ @if (w.lastPassEndedAt) { <span class="jc-muted">last pass {{ ago(w.lastPassEndedAt) }}</span> }
250
251
  </div>
251
252
  }
252
253
  @for (b of o.backlogs; track b.name) {
@@ -600,4 +601,4 @@ i0.ɵɵngDeclareClassMetadata({
600
601
  });
601
602
  export { OverviewPage };
602
603
 
603
- //# sourceMappingURL=juice-js-observability-overview.page-vRttHzPw.mjs.map
604
+ //# sourceMappingURL=juice-js-observability-overview.page-CUJFOlnm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-overview.page-CUJFOlnm.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/shared/platform-panel.ts","../../../../projects/juice-js/observability/src/lib/pages/overview.page.ts"],"sourcesContent":["import { DecimalPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { EMPTY, catchError, interval, map, switchMap, takeWhile, tap, timer } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { PlatformLevel } from '../core/models';\nimport { formatAgo, formatBytes, formatDuration, formatPercent } from './format';\nimport { apiResource } from './resource';\nimport { problemText } from './telemetry';\n\n/** How often the panel reads again: the platform samples every 15 s, so faster shows nothing new. */\nconst REFRESH_MS = 15_000;\n\nconst LEVEL_CLASS: Record<PlatformLevel, string> = {\n ok: 'jc-health-healthy', warn: 'jc-health-degraded', bad: 'jc-health-unhealthy', unknown: 'jc-health-unknown',\n};\n\nconst RESOURCE_NAMES: Record<string, string> = {\n 'clickhouse.cpu': 'ClickHouse CPU', 'clickhouse.inserts_in_flight': 'Collector inserts in flight', 'collector.queue': 'Export queue',\n};\n\nexport function formatRate(perSecond: number | null | undefined): string {\n if (perSecond === null || perSecond === undefined) return '—';\n return perSecond >= 1000 ? `${(perSecond / 1000).toFixed(perSecond >= 100_000 ? 0 : 1)}k/s` : `${perSecond.toFixed(perSecond >= 10 ? 0 : 1)}/s`;\n}\n\n/** A resource's figure in its own unit: cores and inserts as numbers, shares as percentages. */\nexport function formatMeasure(value: number | null | undefined, unit: string): string {\n if (value === null || value === undefined) return '—';\n return unit === 'cores' || unit === 'inserts' ? value.toFixed(value >= 10 ? 0 : 1) : formatPercent(value);\n}\n\n/**\n * The Overview's \"Platform\" panel (Phase 11 R8) and the capacity view (R9), for operators: the workers, ingestion, ClickHouse and disk, each\n * green, amber or red against the scale steps' lines, and what the platform held at in the steps it is calibrated on. A viewer doesn't see it.\n */\n@Component({\n selector: 'jc-platform-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [DecimalPipe],\n template: `\n @if (!hidden()) {\n <section class=\"jc-card jc-platform\" aria-labelledby=\"jc-platform-title\">\n <div class=\"jc-row\">\n <h2 id=\"jc-platform-title\">Platform</h2>\n @if (o(); as o) {\n <span class=\"jc-badge\" [class]=\"cls(o.status === 'ok' ? 'ok' : 'bad')\">{{ o.status }}</span>\n <span class=\"jc-muted\" title=\"When this replica last sampled the Collector, ClickHouse and PostgreSQL (every 15 s)\">{{ o.sampledAt ? 'sampled ' + ago(o.sampledAt) : 'not sampled yet' }}</span>\n }\n </div>\n @if (error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (o(); as o) {\n <div class=\"jc-grid-2\">\n <div>\n <h3>Workers</h3>\n @for (w of o.workers; track w.name) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(w.level)\">{{ w.state }}</span>\n <strong>{{ w.name }}</strong>\n @if (w.utilisation !== null) { <span title=\"Its recent passes against its interval\">{{ pct(w.utilisation) }} busy</span> }\n @if (w.lastPassEndedAt) { <span class=\"jc-muted\">last pass {{ ago(w.lastPassEndedAt) }}</span> }\n </div>\n }\n @for (b of o.backlogs; track b.name) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(b.level)\">{{ b.state }}</span>\n <strong>{{ b.name }} backlog</strong>\n <span class=\"jc-muted\">{{ b.ageSeconds === null ? '—' : seconds(b.ageSeconds) }} of {{ seconds(b.lineSeconds) }}</span>\n </div>\n }\n </div>\n <div>\n <h3>Ingestion</h3>\n @if (o.ingestion; as i) {\n @for (s of i.signals; track s.name) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(s.level)\">{{ s.name }}</span>\n <span>{{ rate(s.acceptedPerSecond) }} received</span>\n <span [class.jc-muted]=\"!s.refusedPerSecond\">{{ rate(s.refusedPerSecond) }} refused</span>\n <span [class.jc-muted]=\"!s.droppedPerSecond\">{{ rate(s.droppedPerSecond) }} dropped</span>\n </div>\n }\n @for (q of i.queues; track q.exporter) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(q.level)\">{{ pct(q.fill) }}</span>\n <span>{{ q.exporter }} queue</span>\n <span class=\"jc-muted\">{{ q.size | number }} of {{ q.capacity | number }}</span>\n </div>\n }\n } @else { <p class=\"jc-muted\">No figures: the Collector's metrics page isn't read (Telemetry:CollectorMetricsUrl), or the last sample is old.</p> }\n\n <h3>ClickHouse</h3>\n @if (o.clickHouse; as c) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(c.cpuLevel)\">CPU</span>\n <span>{{ c.cores === null ? '—' : c.cores.toFixed(1) }} of {{ c.coresAvailable ?? '—' }} cores</span>\n <span class=\"jc-muted\">{{ c.runningQueries }} queries running</span>\n </div>\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(c.insertLevel)\">inserts</span>\n <span>p95 {{ ms(c.insertP95Seconds) }}</span>\n <span class=\"jc-muted\">{{ c.insertsInFlight === null ? '—' : c.insertsInFlight.toFixed(1) }} in flight</span>\n </div>\n @for (r of c.reads.slice(0, 6); track r.name) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(r.level)\">p95 {{ ms(r.p95Seconds) }}</span>\n <span>{{ r.name }}</span><span class=\"jc-muted\">{{ r.count }} in the last minute</span>\n </div>\n }\n } @else { <p class=\"jc-muted\">No figures: ClickHouse isn't sampled (ClickHouse:MonitorConnectionString), or didn't answer.</p> }\n\n <h3>Disk</h3>\n @if (o.disk; as d) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class]=\"cls(d.level)\">{{ d.daysUntilFull !== null ? days(d.daysUntilFull) + ' until full' : d.bytesPerDay === null ? 'no estimate yet' : d.bytesPerDay > 0 ? 'fits at retention' : 'not growing' }}</span>\n <span>{{ bytes(d.used) }} used, {{ bytes(d.free) }} free</span>\n </div>\n <div class=\"jc-list-row\">\n <span>{{ bytes(d.bytesPerDay) }} a day@if (d.estimated) { <span class=\"jc-muted\"> (estimated from today)</span> }</span>\n <span class=\"jc-muted\">at retention: {{ bytes(d.needAtRetention) }} of {{ bytes(d.total) }}</span>\n </div>\n } @else { <p class=\"jc-muted\">No figures.</p> }\n </div>\n </div>\n\n <h3>Capacity</h3>\n <p class=\"jc-muted\">{{ o.capacity.label }}</p>\n <div class=\"jc-list-row\">\n @for (l of o.capacity.load; track l.signal) {\n <span>{{ l.signal }} <strong>{{ l.multiple === null ? '—' : l.multiple.toFixed(1) + '×' }}</strong>\n <span class=\"jc-muted\">({{ rate(l.perSecond) }} of {{ rate(l.reference) }} at 1×)</span></span>\n }\n </div>\n @if (o.capacity.calibrated) {\n <p>Held every line to <strong>{{ o.capacity.heldTo }}×</strong>; crossed one by {{ o.capacity.crossedAt }}×\n @if (o.capacity.crossed.length) { <span class=\"jc-muted\">({{ o.capacity.crossed.join('; ') }})</span> }.\n @if (o.capacity.headroom !== null) { Today's load is {{ (1 / o.capacity.headroom * 100).toFixed(0) }} % of what held. }\n <span class=\"jc-muted\">What held is a measurement, not a plan: a step meets only a few bursts, so plan a step under it.</span></p>\n }\n <div class=\"jc-list-row jc-muted\">\n Now: {{ o.capacity.mix.rules ?? '—' }} rules, {{ o.capacity.mix.slos ?? '—' }} SLOs, {{ o.capacity.mix.services ?? '—' }} services\n @if (o.capacity.mix.calibratedRules !== null) {\n · calibrated with {{ o.capacity.mix.calibratedRules }} rules, {{ o.capacity.mix.calibratedSlos }} SLOs, {{ o.capacity.mix.calibratedServices }} services\n and {{ o.capacity.mix.calibratedSearchesPerSecond }} searches a second\n }\n </div>\n <table class=\"jc-table\">\n <thead><tr><th>Resource</th><th>Now</th>@if (o.capacity.calibrated) { <th>Where every line held ({{ o.capacity.heldTo }}×)</th><th>Where one crossed ({{ o.capacity.crossedAt }}×)</th> }</tr></thead>\n <tbody>\n @for (r of o.capacity.resources; track r.name) {\n <tr>\n <td>{{ resource(r.name) }}</td>\n <td><span class=\"jc-badge\" [class]=\"cls(r.level)\">{{ measure(r.now, r.unit) }}</span></td>\n @if (o.capacity.calibrated) { <td>{{ measure(r.atHeld, r.unit) }}</td><td>{{ measure(r.atCrossed, r.unit) }}</td> }\n </tr>\n }\n </tbody>\n </table>\n }\n </section>\n }`,\n})\nexport class PlatformPanel {\n private readonly api = inject(ApiService);\n\n /** The last read's failure, cleared by the next that succeeds: a failed read keeps the last figures and the 15 s reads going. */\n private readonly failed = signal<unknown>(undefined);\n protected readonly overview = apiResource({\n // Only for operators and admins (the tenant says so): a viewer never asks, so never gets the 403.\n // A new tenant answer starts afresh: a 403 before it doesn't stop the reads it allows.\n stream: () => this.api.tenant$.pipe(tap(() => this.failed.set(undefined)), switchMap(t => t.canOperate\n ? timer(0, REFRESH_MS).pipe(\n // Refused (a role taken away since sign-in): stop asking, rather than be refused every 15 s.\n takeWhile(() => (this.failed() as { status?: number } | undefined)?.status !== 403),\n switchMap(() => this.api.platformOverview().pipe(\n tap(() => this.failed.set(undefined)),\n catchError(e => { this.failed.set(e); return EMPTY; }))))\n : EMPTY)),\n });\n protected readonly o = computed(() => this.overview.value());\n /** Whether the user is an operator or admin, from the tenant (false until it is known). */\n private readonly canOperate = toSignal(this.api.tenant$.pipe(map(t => !!t.canOperate)), { initialValue: false });\n /** A viewer isn't an operator: no panel (and a 403 from a role changed since sign-in hides it too, without an error). */\n protected readonly hidden = computed(() => !this.canOperate() || (this.failed() as { status?: number } | undefined)?.status === 403);\n protected readonly error = computed(() => this.failed() && !this.hidden() ? problemText(this.failed()) : '');\n\n /** A tick a second, so \"sampled … ago\" counts up between the 15 s reads instead of standing at the read's figure. */\n private readonly tick = toSignal(interval(1000), { initialValue: 0 });\n protected ago(iso: string): string { this.tick(); return formatAgo(iso); }\n\n protected cls(level: PlatformLevel): string { return `jc-badge ${LEVEL_CLASS[level]}`; }\n protected pct(share: number): string { return formatPercent(share); }\n protected rate(perSecond: number | null): string { return formatRate(perSecond); }\n protected bytes(bytes: number | null): string { return formatBytes(bytes); }\n protected measure(value: number | null, unit: string): string { return formatMeasure(value, unit); }\n protected ms(seconds: number | null): string { return formatDuration(seconds === null ? null : seconds * 1000); }\n protected seconds(s: number): string { return s >= 120 ? `${Math.round(s / 60)} min` : `${Math.round(s)} s`; }\n protected days(d: number): string { return d >= 365 ? 'over a year' : `${Math.round(d)} days`; }\n protected resource(name: string): string { return RESOURCE_NAMES[name] ?? (name.startsWith('worker.') ? `Worker ${name.slice(7)}` : name); }\n}\n","import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { HealthState } from '../core/models';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { PlatformPanel } from '../shared/platform-panel';\n\nconst ORDER: HealthState[] = ['Critical', 'Unhealthy', 'Degraded', 'Offline', 'Unknown', 'Healthy'];\n\n/** How many rows each list shows: the overview orients, the alerts and services pages list everything. */\nconst SHOWN = 10;\n\n/**\n * Where an investigation starts (Console requirements §4, §21 step 1): what is firing and which services are not\n * healthy, each one click from its service page. Orientation, not a dashboard.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatProgressBarModule, ContextBar, HealthBadge, AgoPipe, PlatformPanel],\n template: `\n <jc-context-bar><h1>Overview</h1></jc-context-bar>\n @if (health.isLoading() || alerts.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (health.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <div class=\"jc-tiles\">\n @for (s of order; track s) {\n <a class=\"jc-card jc-tile\" [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep({ state: s })\">\n <jc-health [state]=\"s\" /><strong>{{ counts()[s] ?? 0 }}</strong><span class=\"jc-muted\">services</span>\n </a>\n }\n </div>\n\n <section class=\"jc-card\">\n <div class=\"jc-row\">\n <h2>Firing alerts @if (firing().length) { <span class=\"jc-muted\">({{ firing().length }}@if (criticalCount()) { · {{ criticalCount() }} critical})</span> }</h2>\n @if (firing().length) { <a [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep({ state: 'firing' })\">All firing alerts</a> }\n </div>\n @for (a of firingShown(); track a.id) {\n <div class=\"jc-list-row\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"a.severity === 'Critical'\" [class.jc-health-degraded]=\"a.severity !== 'Critical'\">{{ a.severity }}</span>\n <a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.rule }}</a>\n <span>{{ a.subjectKey }}</span>\n <span class=\"jc-muted\">fired {{ a.firedAt | ago }}@if (a.acknowledgedBy) { · acknowledged by {{ a.acknowledgedBy }} }</span>\n </div>\n } @empty { <p class=\"jc-muted\">Nothing firing.</p> }\n @if (firing().length > shown) {\n <p class=\"jc-more\"><span class=\"jc-muted\">Critical first, then the newest; {{ firing().length - shown }} more.</span>\n <a [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep({ state: 'firing' })\">See all {{ firing().length }}</a></p>\n }\n </section>\n\n <section class=\"jc-card\">\n <h2>Services needing attention @if (attention().length) { <span class=\"jc-muted\">({{ attention().length }})</span> }</h2>\n @for (h of attention().slice(0, shown); track h.subjectId + h.environment) {\n <div class=\"jc-list-row\">\n <jc-health [state]=\"h.state\" [stale]=\"h.stale\" />\n <a [routerLink]=\"['services', h.subjectId] | jcLink\" [queryParams]=\"ctx.keep({ env: h.environment })\">{{ h.subjectName }}</a>\n <span class=\"jc-muted\">{{ h.environment }}</span>\n <span>{{ h.reasons.slice(0, 3).map(reason).join(' · ') }}</span>\n <span class=\"jc-muted\">since {{ h.since | ago }}</span>\n </div>\n } @empty { <p class=\"jc-muted\">Every evaluated service is healthy.</p> }\n @if (attention().length > shown) {\n <p class=\"jc-more\"><span class=\"jc-muted\">The worst first; {{ attention().length - shown }} more. The counts above open each state's list:</span>\n @for (s of order; track s) { @if (s !== 'Healthy' && counts()[s]) {\n <a [routerLink]=\"['services'] | jcLink\" [queryParams]=\"ctx.keep({ state: s })\">{{ counts()[s] }} {{ s.toLowerCase() }}</a>\n } }</p>\n }\n </section>\n\n <jc-platform-panel />`,\n})\nexport class OverviewPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly order = ORDER;\n protected readonly shown = SHOWN;\n private readonly reasonPipe = new ReasonPipe();\n protected readonly reason = (r: string) => this.reasonPipe.transform(r);\n\n protected readonly health = apiResource({\n params: () => this.ctx.environment(),\n stream: ({ params }) => this.api.health({ subjectType: 'service', environment: params }).pipe(map(p => p.items)),\n });\n protected readonly alerts = apiResource({\n params: () => this.ctx.environment(),\n stream: ({ params }) => this.api.allAlerts({ state: 'firing', environment: params }).pipe(map(p => p.items)),\n });\n protected readonly error = computed(() => problemText(this.health.error()));\n /** Critical first, then the newest. */\n protected readonly firing = computed(() => [...(this.alerts.value() ?? [])].sort((a, b) =>\n Number(b.severity === 'Critical') - Number(a.severity === 'Critical')\n || (b.firedAt ?? '').localeCompare(a.firedAt ?? '')));\n protected readonly firingShown = computed(() => this.firing().slice(0, SHOWN));\n protected readonly criticalCount = computed(() => this.firing().filter(a => a.severity === 'Critical').length);\n protected readonly counts = computed(() => {\n const counts: Partial<Record<HealthState, number>> = {};\n for (const h of this.health.value() ?? []) counts[h.state] = (counts[h.state] ?? 0) + 1;\n return counts;\n });\n protected readonly attention = computed(() => (this.health.value() ?? [])\n .filter(h => h.state !== 'Healthy')\n .sort((a, b) => ORDER.indexOf(a.state) - ORDER.indexOf(b.state)));\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAM,aAAa;AAEnB,MAAM,cAA6C;CACjD,IAAI;CAAqB,MAAM;CAAsB,KAAK;CAAuB,SAAS;AAC3F;AAED,MAAM,iBAAyC;CAC7C,kBAAkB;CAAkB,gCAAgC;CAA+B,mBAAmB;AACvH;AAED,SAAgB,WAAW,WAAoC;CAC7D,IAAI,cAAc,QAAQ,cAAc,QAAW,OAAO;CAC1D,OAAO,aAAa,MAAO,IAAI,YAAY,IAAA,CAAM,QAAQ,aAAa,MAAU,IAAI,CAAC,EAAC,OAAQ,GAAG,UAAU,QAAQ,aAAa,KAAK,IAAI,CAAC,EAAC;AAC7I;AAGA,SAAgB,cAAc,OAAkC,MAAY;CAC1E,IAAI,UAAU,QAAQ,UAAU,QAAW,OAAO;CAClD,OAAO,SAAS,WAAW,SAAS,YAAY,MAAM,QAAQ,SAAS,KAAK,IAAI,CAAC,IAAI,cAAc,KAAK;AAC1G;AAoIA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A;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAoB;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;IAAA,UAAA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA,CAAA,SAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAW;IAAa,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA3F;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA6D;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAsD3E,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAxDxB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAsB;IAAY;IAAa;IAAS;GAAa;GACrG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDX,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { a as TraceTable, c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, n as LogTable, o as problemText, r as MetricExplorer, s as ConfidenceBadge, u as KeyValueTable, y as ReasonPipe } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
2
+ import { a as TraceTable, c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, n as LogTable, o as problemText, r as MetricExplorer, s as ConfidenceBadge, u as KeyValueTable, y as ReasonPipe } from "./juice-js-observability-telemetry-CwdIXE9m.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";
@@ -271,4 +271,4 @@ i0.ɵɵngDeclareClassMetadata({
271
271
  });
272
272
  export { ResourcePage };
273
273
 
274
- //# sourceMappingURL=juice-js-observability-resource.page-DZ7DT_3f.mjs.map
274
+ //# sourceMappingURL=juice-js-observability-resource.page-BrLwpTXN.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-resource.page-DZ7DT_3f.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/resource.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { apiResource } from '../shared/resource';\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 { ConfidenceBadge, ContextBar, HealthBadge, KeyValueTable } from '../shared/ui';\nimport { LogTable, MetricExplorer, TraceTable, problemText } from '../shared/telemetry';\n\n/**\n * A host, container, pod, database or destination (Console requirements §11): what runs on it or who uses it, its\n * health, and its telemetry. A database or destination has traces (the calls to it) but no logs or metrics of its own.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatProgressBarModule, ContextBar, HealthBadge, ConfidenceBadge, KeyValueTable, TraceTable, LogTable,\n MetricExplorer, AgoPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['resources'] | jcLink\" [queryParams]=\"ctx.keep({ type: resource.value()?.type })\" class=\"jc-crumb\">Resources</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1>{{ resource.value()?.displayName ?? '…' }}</h1>\n <span class=\"jc-muted\">{{ resource.value()?.type }}</span>\n </jc-context-bar>\n @if (resource.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (resource.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (resource.value(); as r) {\n <div class=\"jc-grid-2\">\n <section class=\"jc-card\">\n <h2>Identity</h2>\n <jc-kv [values]=\"{ key: r.key, 'first seen': r.firstSeen, 'last seen': r.lastSeen }\" />\n <jc-kv [values]=\"r.attributes\" empty=\"\" />\n @for (h of r.health; track h.subjectId) {\n <p><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /> {{ h.reasons.map(reason).join(' · ') }}</p>\n }\n </section>\n <section class=\"jc-card\">\n @if (isInfrastructure()) {\n <h2>Instances running here</h2>\n @for (i of r.instances; track i.id) {\n <div class=\"jc-list-row\"><jc-health [state]=\"i.health\" /><span>{{ i.instanceKey }}</span>\n <span class=\"jc-muted\">{{ i.environment }}</span><span class=\"jc-muted\">{{ i.lastSeen | ago }}</span></div>\n } @empty { <p class=\"jc-muted\">No service instances seen on it.</p> }\n } @else {\n <h2>Used by</h2>\n @for (e of users(); track e.id) {\n <div class=\"jc-list-row\"><a [routerLink]=\"['services', e.source] | jcLink\" [queryParams]=\"ctx.keep()\">{{ name(e.source) }}</a>\n <span>{{ e.relation }}</span><jc-confidence [confidence]=\"e.confidence\" />\n <a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: e.id })\">evidence</a></div>\n } @empty { <p class=\"jc-muted\">No users seen{{ ctx.environment() ? ' in ' + ctx.environment() : '' }}.</p> }\n }\n </section>\n </div>\n @if (isInfrastructure()) {\n <h2>Metrics</h2>\n <jc-metric-explorer [scope]=\"{ resourceId: id() }\" />\n <h2>Logs</h2>\n <jc-log-table [query]=\"{ resourceId: id() }\" />\n } @else {\n <h2>Traces that reach it</h2>\n <jc-trace-table [query]=\"{ resourceId: id() }\" />\n }\n }`,\n})\nexport class ResourcePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly id = input.required<string>();\n\n protected readonly resource = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.resource(params) });\n protected readonly topology = apiResource({ params: () => this.ctx.environment(), stream: ({ params }) => this.api.topology(params || null) });\n protected readonly error = computed(() => problemText(this.resource.error()));\n protected readonly isInfrastructure = computed(() => ['host', 'container', 'k8s-pod'].includes(this.resource.value()?.type ?? ''));\n protected readonly users = computed(() => (this.topology.value()?.edges ?? []).filter(e => e.target === this.id()));\n private readonly reasonPipe = new ReasonPipe();\n protected readonly reason = (r: string) => this.reasonPipe.transform(r);\n\n name(id: string) { return this.topology.value()?.nodes.find(n => n.id === id)?.displayName ?? id; }\n}\n"],"mappings":";;;;;;;AAkEA,IAAa,eAAb,MAAa,aAAY;CACJ,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,KAAK,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAEnB,WAAW,YAAY;EAAE,cAAc,KAAK,GAAE;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,SAAS,MAAM;CAAC,CAAE;CACrG,WAAW,YAAY;EAAE,cAAc,KAAK,IAAI,YAAW;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,SAAS,UAAU,IAAI;CAAC,CAAE;CAC1H,QAAQ,eAAe,YAAY,KAAK,SAAS,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC1D,mBAAmB,eAAe;EAAC;EAAQ;EAAa;CAAS,CAAC,CAAC,SAAS,KAAK,SAAS,MAAK,CAAE,EAAE,QAAQ,EAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;CAC/G,QAAQ,gBAAgB,KAAK,SAAS,MAAK,CAAE,EAAE,SAAS,CAAA,EAAA,CAAI,QAAO,MAAK,EAAE,WAAW,KAAK,GAAE,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAA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AA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAQ,UAAA;IAAA,QAAA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACjI;IAAc,UAAA;IAAA,QAAA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MADN;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACA;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAgDd,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAnDxB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAsB;IAAY;IAAa;IAAiB;IAAe;IAAY;IACzH;IAAgB;GAAO;GACzB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-resource.page-BrLwpTXN.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/resource.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { apiResource } from '../shared/resource';\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 { ConfidenceBadge, ContextBar, HealthBadge, KeyValueTable } from '../shared/ui';\nimport { LogTable, MetricExplorer, TraceTable, problemText } from '../shared/telemetry';\n\n/**\n * A host, container, pod, database or destination (Console requirements §11): what runs on it or who uses it, its\n * health, and its telemetry. A database or destination has traces (the calls to it) but no logs or metrics of its own.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatProgressBarModule, ContextBar, HealthBadge, ConfidenceBadge, KeyValueTable, TraceTable, LogTable,\n MetricExplorer, AgoPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['resources'] | jcLink\" [queryParams]=\"ctx.keep({ type: resource.value()?.type })\" class=\"jc-crumb\">Resources</a>\n <span class=\"jc-crumb-sep\">›</span>\n <h1>{{ resource.value()?.displayName ?? '…' }}</h1>\n <span class=\"jc-muted\">{{ resource.value()?.type }}</span>\n </jc-context-bar>\n @if (resource.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (resource.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (resource.value(); as r) {\n <div class=\"jc-grid-2\">\n <section class=\"jc-card\">\n <h2>Identity</h2>\n <jc-kv [values]=\"{ key: r.key, 'first seen': r.firstSeen, 'last seen': r.lastSeen }\" />\n <jc-kv [values]=\"r.attributes\" empty=\"\" />\n @for (h of r.health; track h.subjectId) {\n <p><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /> {{ h.reasons.map(reason).join(' · ') }}</p>\n }\n </section>\n <section class=\"jc-card\">\n @if (isInfrastructure()) {\n <h2>Instances running here</h2>\n @for (i of r.instances; track i.id) {\n <div class=\"jc-list-row\"><jc-health [state]=\"i.health\" /><span>{{ i.instanceKey }}</span>\n <span class=\"jc-muted\">{{ i.environment }}</span><span class=\"jc-muted\">{{ i.lastSeen | ago }}</span></div>\n } @empty { <p class=\"jc-muted\">No service instances seen on it.</p> }\n } @else {\n <h2>Used by</h2>\n @for (e of users(); track e.id) {\n <div class=\"jc-list-row\"><a [routerLink]=\"['services', e.source] | jcLink\" [queryParams]=\"ctx.keep()\">{{ name(e.source) }}</a>\n <span>{{ e.relation }}</span><jc-confidence [confidence]=\"e.confidence\" />\n <a [routerLink]=\"['topology'] | jcLink\" [queryParams]=\"ctx.keep({ edge: e.id })\">evidence</a></div>\n } @empty { <p class=\"jc-muted\">No users seen{{ ctx.environment() ? ' in ' + ctx.environment() : '' }}.</p> }\n }\n </section>\n </div>\n @if (isInfrastructure()) {\n <h2>Metrics</h2>\n <jc-metric-explorer [scope]=\"{ resourceId: id() }\" />\n <h2>Logs</h2>\n <jc-log-table [query]=\"{ resourceId: id() }\" />\n } @else {\n <h2>Traces that reach it</h2>\n <jc-trace-table [query]=\"{ resourceId: id() }\" />\n }\n }`,\n})\nexport class ResourcePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly id = input.required<string>();\n\n protected readonly resource = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.resource(params) });\n protected readonly topology = apiResource({ params: () => this.ctx.environment(), stream: ({ params }) => this.api.topology(params || null) });\n protected readonly error = computed(() => problemText(this.resource.error()));\n protected readonly isInfrastructure = computed(() => ['host', 'container', 'k8s-pod'].includes(this.resource.value()?.type ?? ''));\n protected readonly users = computed(() => (this.topology.value()?.edges ?? []).filter(e => e.target === this.id()));\n private readonly reasonPipe = new ReasonPipe();\n protected readonly reason = (r: string) => this.reasonPipe.transform(r);\n\n name(id: string) { return this.topology.value()?.nodes.find(n => n.id === id)?.displayName ?? id; }\n}\n"],"mappings":";;;;;;;AAkEA,IAAa,eAAb,MAAa,aAAY;CACJ,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,KAAK,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAEnB,WAAW,YAAY;EAAE,cAAc,KAAK,GAAE;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,SAAS,MAAM;CAAC,CAAE;CACrG,WAAW,YAAY;EAAE,cAAc,KAAK,IAAI,YAAW;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,SAAS,UAAU,IAAI;CAAC,CAAE;CAC1H,QAAQ,eAAe,YAAY,KAAK,SAAS,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,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AA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;IAAA,UAAA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA,CAAA,SAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAe,UAAA;IAAA,QAAA,CAAA,YAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAa,UAAA;IAAA,QAAA,CAAA,UAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAQ,UAAA;IAAA,QAAA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACjI;IAAc,UAAA;IAAA,QAAA,CAAA,SAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MADN;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MACA;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAgDd,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAY,YAAA,CAAA;EAnDxB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAsB;IAAY;IAAa;IAAiB;IAAe;IAAY;IACzH;IAAgB;GAAO;GACzB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8CX,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { c as ContextBar, g as AgoPipe, h as apiResource, m as screenPages, o as problemText } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
2
+ import { c as ContextBar, g as AgoPipe, h as apiResource, m as screenPages, o as problemText } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from "@angular/core";
5
5
  import { RouterLink } from "@angular/router";
@@ -206,4 +206,4 @@ i0.ɵɵngDeclareClassMetadata({
206
206
  });
207
207
  export { ResourcesPage };
208
208
 
209
- //# sourceMappingURL=juice-js-observability-resources.page-Bp9o-_QG.mjs.map
209
+ //# sourceMappingURL=juice-js-observability-resources.page-Dyh7AjOW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-resources.page-Bp9o-_QG.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/resources.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { SearchablePage } from '@juice-js/layout';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { screenPages } from '../shared/paging';\n\nconst TYPES = ['host', 'container', 'k8s-pod', 'database', 'messaging-destination'];\n\n/**\n * Where services run and what they use (Console requirements §11): hosts, containers, pods, databases and\n * destinations, as discovery reconciled them. Never deleted automatically; renames come only from configured aliases.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatPaginatorModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Resources</h1>\n @for (t of types; track t) {\n <a class=\"jc-chip\" [class.jc-selected]=\"t === (type() ?? 'host')\" [routerLink]=\"['resources'] | jcLink\" [queryParams]=\"ctx.keep({ type: t })\">{{ t }}</a>\n }\n </jc-context-bar>\n @if (resources.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (resources.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (capped()) { <p class=\"jc-notice\">Showing the first 5,000 only. Narrow the list with the search box or a filter.</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Name</th><th>Key</th><th>First seen</th><th>Last seen</th></tr></thead>\n <tbody>\n @for (r of pages.visible(); track r.id) {\n <tr><td><a [routerLink]=\"['resources', r.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ r.displayName }}</a></td>\n <td class=\"jc-mono jc-small\">{{ r.key }}</td><td>{{ r.firstSeen | ago }}</td><td>{{ r.lastSeen | ago }}</td></tr>\n } @empty { <tr><td colspan=\"4\" class=\"jc-muted\">None seen.</td></tr> }\n </tbody>\n </table>\n @if (pages.needed()) {\n <mat-paginator [length]=\"rows().length\" [pageSize]=\"pages.size()\" [pageIndex]=\"pages.index()\" [pageSizeOptions]=\"pages.sizes\"\n (page)=\"pages.change($event)\" aria-label=\"Pages\" />\n }`,\n})\nexport class ResourcesPage implements SearchablePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly types = TYPES;\n readonly type = input<string>();\n private readonly filter = signal('');\n\n protected readonly resources = apiResource({\n params: () => this.type() ?? 'host',\n stream: ({ params }) => this.api.resources(params),\n });\n protected readonly error = computed(() => problemText(this.resources.error()));\n protected readonly capped = computed(() => (this.resources.value()?.nextCursor ?? null) !== null);\n protected readonly rows = computed(() => (this.resources.value()?.items ?? [])\n .filter(r => !this.filter() || `${r.displayName} ${r.key}`.toLowerCase().includes(this.filter().toLowerCase())));\n\n protected readonly pages = screenPages(this.rows);\n\n onSearch(query: string) { this.filter.set(query); }\n}\n"],"mappings":";;;;;;;;;AAcA,MAAM,QAAQ;CAAC;CAAQ;CAAa;CAAW;CAAY;AAAuB;AAgClF,IAAa,gBAAb,MAAa,cAAa;CACL,MAAM,OAAO,cAAc;CAC7B,MAAM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mBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UAvBd;;;;;;;;;;;;;;;;;;;;;;EAqBN,UAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MAtBgB;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAkB;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,MAAA;IAAA,UAAA,CAAA,cAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAoB;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;IAAA,UAAA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA1E;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAoE;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAwBlF,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EA1BzB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAoB;IAAsB;IAAY;GAAO;GAC7F,UAAU;;;;;;;;;;;;;;;;;;;;;;EAsBX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-resources.page-Dyh7AjOW.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/resources.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { MatPaginatorModule } from '@angular/material/paginator';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { SearchablePage } from '@juice-js/layout';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { screenPages } from '../shared/paging';\n\nconst TYPES = ['host', 'container', 'k8s-pod', 'database', 'messaging-destination'];\n\n/**\n * Where services run and what they use (Console requirements §11): hosts, containers, pods, databases and\n * destinations, as discovery reconciled them. Never deleted automatically; renames come only from configured aliases.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatPaginatorModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Resources</h1>\n @for (t of types; track t) {\n <a class=\"jc-chip\" [class.jc-selected]=\"t === (type() ?? 'host')\" [routerLink]=\"['resources'] | jcLink\" [queryParams]=\"ctx.keep({ type: t })\">{{ t }}</a>\n }\n </jc-context-bar>\n @if (resources.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (resources.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (capped()) { <p class=\"jc-notice\">Showing the first 5,000 only. Narrow the list with the search box or a filter.</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Name</th><th>Key</th><th>First seen</th><th>Last seen</th></tr></thead>\n <tbody>\n @for (r of pages.visible(); track r.id) {\n <tr><td><a [routerLink]=\"['resources', r.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ r.displayName }}</a></td>\n <td class=\"jc-mono jc-small\">{{ r.key }}</td><td>{{ r.firstSeen | ago }}</td><td>{{ r.lastSeen | ago }}</td></tr>\n } @empty { <tr><td colspan=\"4\" class=\"jc-muted\">None seen.</td></tr> }\n </tbody>\n </table>\n @if (pages.needed()) {\n <mat-paginator [length]=\"rows().length\" [pageSize]=\"pages.size()\" [pageIndex]=\"pages.index()\" [pageSizeOptions]=\"pages.sizes\"\n (page)=\"pages.change($event)\" aria-label=\"Pages\" />\n }`,\n})\nexport class ResourcesPage implements SearchablePage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly types = TYPES;\n readonly type = input<string>();\n private readonly filter = signal('');\n\n protected readonly resources = apiResource({\n params: () => this.type() ?? 'host',\n stream: ({ params }) => this.api.resources(params),\n });\n protected readonly error = computed(() => problemText(this.resources.error()));\n protected readonly capped = computed(() => (this.resources.value()?.nextCursor ?? null) !== null);\n protected readonly rows = computed(() => (this.resources.value()?.items ?? [])\n .filter(r => !this.filter() || `${r.displayName} ${r.key}`.toLowerCase().includes(this.filter().toLowerCase())));\n\n protected readonly pages = screenPages(this.rows);\n\n onSearch(query: string) { this.filter.set(query); }\n}\n"],"mappings":";;;;;;;;;AAcA,MAAM,QAAQ;CAAC;CAAQ;CAAa;CAAW;CAAY;AAAuB;AAgClF,IAAa,gBAAb,MAAa,cAAa;CACL,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,QAAQ;CAClB,OAAO,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACd,SAAS,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAEjB,YAAY,YAAY;EACzC,cAAc,KAAK,KAAI,KAAM;EAC7B,SAAS,EAAE,aAAa,KAAK,IAAI,UAAU,MAAM;CAClD,CAAA;CACkB,QAAQ,eAAe,YAAY,KAAK,UAAU,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC3D,SAAS,gBAAgB,KAAK,UAAU,MAAK,CAAE,EAAE,cAAc,UAAU,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,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AA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,cAAA;IAAA,UAAA,CAAA,gBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA1E;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAoE;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAwBlF,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EA1BzB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAoB;IAAsB;IAAY;GAAO;GAC7F,UAAU;;;;;;;;;;;;;;;;;;;;;;EAsBX,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
2
+ import { c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, signal } from "@angular/core";
5
5
  import { RouterLink } from "@angular/router";
@@ -578,4 +578,4 @@ i0.ɵɵngDeclareClassMetadata({
578
578
  });
579
579
  export { RulesPage };
580
580
 
581
- //# sourceMappingURL=juice-js-observability-rules.page-zvXo2xtw.mjs.map
581
+ //# sourceMappingURL=juice-js-observability-rules.page-C_qiLXN_.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-rules.page-zvXo2xtw.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/rules.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { apiResource } from '../shared/resource';\nimport { RouterLink } from '@angular/router';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Rule } from '../core/models';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\n\nconst TEMPLATES: Record<string, string> = {\n ErrorRate: 'Ratio of failed requests, 0 to 1. Fires above the threshold.',\n LatencyP95: 'Milliseconds at the 95th percentile. Fires above the threshold.',\n ThroughputAbsent: 'Requests in the window, for a service that had traffic. Fires at or below the threshold.',\n DeliveryFailureRate: 'Ratio of failed deliveries, 0 to 1. Fires above the threshold.',\n HostMemory: 'Ratio of host memory used, 0 to 1. Fires above the threshold.',\n MediatorErrors: 'Mediator errors in the window. Fires above the threshold.',\n ConsumerFailures: 'Failed consumer messages in the window. Fires above the threshold.',\n SloBurn: \"An SLO's burn rate over a long and a short window. Fires when both reach the rate; one alert per SLO.\",\n};\n\n/** A TimeSpan as the API writes it (`1.02:03:04`) in seconds. */\nfunction seconds(value: unknown): number {\n const match = /^(?:(\\d+)\\.)?(\\d+):(\\d+):(\\d+)/.exec(String(value ?? ''));\n return match ? (+(match[1] ?? 0)) * 86400 + +match[2] * 3600 + +match[3] * 60 + +match[4] : 0;\n}\n\nfunction span(total: number): string {\n const s = Math.max(0, Math.round(total || 0));\n const pad = (n: number) => String(n).padStart(2, '0');\n const days = Math.floor(s / 86400);\n return `${days ? `${days}.` : ''}${pad(Math.floor(s / 3600) % 24)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}`;\n}\n\ninterface RuleForm {\n key: string; name: string; template: string; severity: string; service: string; environment: string; host: string; threshold: number | null; recoveryThreshold: number | null;\n minimumSamples: number; scheduleSeconds: number; windowSeconds: number; forSeconds: number; recoverySeconds: number; cooldownSeconds: number; enabled: boolean;\n}\n\nconst NEW_RULE: RuleForm = {\n key: '', name: '', template: 'ErrorRate', severity: 'Warning', service: '', environment: '', host: '', threshold: null, recoveryThreshold: null,\n minimumSamples: 10, scheduleSeconds: 60, windowSeconds: 300, forSeconds: 120, recoverySeconds: 120, cooldownSeconds: 600, enabled: true,\n};\n\n/**\n * Rules and their current state (Console requirements §14), and changing them for admins. They stay typed templates (D5): this page never takes a query.\n * A rule in the deployment's file is shown but changed there. Disabling one, or changing what it watches, closes its open alerts, which the form says first.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Rules</h1>\n <span class=\"jc-spacer\"></span>\n <button mat-flat-button type=\"button\" data-testid=\"rule-new\" (click)=\"startNew()\">New rule</button>\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (form(); as f) {\n <section class=\"jc-card\" data-testid=\"rule-form\">\n <h2>{{ editing() ? 'Change ' + editing()!.key : 'New rule' }}</h2>\n <form class=\"jc-form\" (ngSubmit)=\"save(f)\">\n @if (!editing()) { <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Template</mat-label>\n <mat-select name=\"template\" [(ngModel)]=\"f.template\">@for (t of templates; track t) { <mat-option [value]=\"t\">{{ t }}</mat-option> }</mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity</mat-label>\n <mat-select name=\"severity\" [(ngModel)]=\"f.severity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n @if (f.template === 'HostMemory') {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Host (all if empty)</mat-label><input matInput name=\"host\" [(ngModel)]=\"f.host\"></mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Service (all if empty)</mat-label><input matInput name=\"service\" [(ngModel)]=\"f.service\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Environment (all if empty)</mat-label><input matInput name=\"environment\" [(ngModel)]=\"f.environment\"></mat-form-field>\n }\n <p class=\"jc-muted jc-small jc-form-actions\">{{ hint(f.template) }}</p>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"threshold\" [(ngModel)]=\"f.threshold\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recovery threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"recoveryThreshold\" [(ngModel)]=\"f.recoveryThreshold\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Minimum samples</mat-label><input matInput type=\"number\" name=\"minimumSamples\" [(ngModel)]=\"f.minimumSamples\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Every (s)</mat-label><input matInput type=\"number\" name=\"schedule\" [(ngModel)]=\"f.scheduleSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Window (s)</mat-label><input matInput type=\"number\" name=\"window\" [(ngModel)]=\"f.windowSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Fire after (s)</mat-label><input matInput type=\"number\" name=\"for\" [(ngModel)]=\"f.forSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recover after (s)</mat-label><input matInput type=\"number\" name=\"recovery\" [(ngModel)]=\"f.recoverySeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Cooldown (s)</mat-label><input matInput type=\"number\" name=\"cooldown\" [(ngModel)]=\"f.cooldownSeconds\"></mat-form-field>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n @if (editing()) { <p class=\"jc-muted jc-small jc-form-actions\">Disabling this rule, or changing its template or scope, resolves its open alerts: nothing would be watching them any more.</p> }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"rule-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"form.set(null)\">Cancel</button>\n @if (saveError()) { <span class=\"jc-error\" data-testid=\"rule-error\">{{ saveError() }}</span> }\n </div>\n </form>\n </section>\n }\n <table class=\"jc-table\" data-testid=\"rules\">\n <thead><tr><th>Rule</th><th>Template</th><th>Severity</th><th>Threshold</th><th>Recovery</th><th>Wait</th><th>Open alerts</th><th>Last evaluation</th><th></th></tr></thead>\n <tbody>\n @for (r of rows(); track r.key) {\n <tr [class.jc-muted]=\"!r.enabled\">\n <td><strong>{{ r.name }}</strong><div class=\"jc-muted jc-small\">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div></td>\n <td>{{ r.template }}</td>\n <td>{{ r.severity }}</td>\n <td>{{ r.definition['threshold'] ?? '—' }}</td>\n <td>{{ r.definition['recoveryThreshold'] ?? '—' }}</td>\n <td>{{ r.definition['forDuration'] ?? '—' }}</td>\n <td>\n @for (a of r.open; track a.id) {\n <div><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.state }}</a> {{ a.subjectKey }} = {{ a.lastValue ?? 'no data' }}</div>\n } @empty { <span class=\"jc-muted\">none</span> }\n </td>\n <td>{{ r.lastEvaluatedAt | ago }}</td>\n <td class=\"jc-row-actions\">@if (r.managedBy === 'api') { <button mat-button type=\"button\" [attr.data-testid]=\"'rule-edit-' + r.key\" (click)=\"edit(r)\">Change</button> }</td>\n </tr>\n }\n </tbody>\n </table>`,\n})\nexport class RulesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n /** What a rule can be made from: SloBurn is described, but its rules are the platform's own, made for SLOs. */\n protected readonly templates = Object.keys(TEMPLATES).filter(t => t !== 'SloBurn');\n protected readonly form = signal<RuleForm | null>(null);\n protected readonly editing = signal<Rule | null>(null);\n protected readonly saving = signal(false);\n protected readonly saveError = signal('');\n protected readonly data = apiResource({\n stream: () => forkJoin({\n rules: this.api.rules().pipe(map(p => p.items)),\n firing: this.api.allAlerts({ state: 'firing' }).pipe(map(p => p.items)),\n pending: this.api.allAlerts({ state: 'pending' }).pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly rows = computed(() => {\n const d = this.data.value();\n if (!d) return [];\n const open = [...d.firing, ...d.pending];\n return d.rules.map(r => {\n const mine = open.filter(a => a.rule === r.key);\n const last = mine.map(a => a.lastEvaluatedAt).sort().at(-1) ?? null;\n return { ...r, open: mine, lastEvaluatedAt: last };\n });\n });\n\n protected hint(template: string): string { return TEMPLATES[template] ?? ''; }\n\n protected startNew() { this.editing.set(null); this.saveError.set(''); this.form.set({ ...NEW_RULE }); }\n\n protected edit(rule: Rule) {\n const d = rule.definition;\n this.editing.set(rule);\n this.saveError.set('');\n this.form.set({\n key: rule.key, name: rule.name, template: rule.template, severity: rule.severity, service: String(d['service'] ?? ''), environment: String(d['environment'] ?? ''), host: String(d['host'] ?? ''),\n threshold: d['threshold'] as number, recoveryThreshold: (d['recoveryThreshold'] as number | null) ?? null, minimumSamples: d['minimumSamples'] as number, scheduleSeconds: seconds(d['schedule']), windowSeconds: seconds(d['window']),\n forSeconds: seconds(d['forDuration']), recoverySeconds: seconds(d['recoveryDuration']), cooldownSeconds: seconds(d['cooldown']), enabled: rule.enabled,\n });\n }\n\n protected save(f: RuleForm) {\n const host = f.template === 'HostMemory';\n const body = {\n key: f.key, name: f.name, template: f.template, severity: f.severity, service: host ? '' : f.service.trim(), environment: host ? '' : f.environment.trim().toLowerCase(), host: host ? f.host.trim() : '',\n threshold: f.threshold, recoveryThreshold: f.recoveryThreshold, minimumSamples: f.minimumSamples, schedule: span(f.scheduleSeconds), window: span(f.windowSeconds), forDuration: span(f.forSeconds),\n recoveryDuration: span(f.recoverySeconds), cooldown: span(f.cooldownSeconds), enabled: f.enabled,\n };\n const editing = this.editing();\n const request: Observable<Rule> = editing ? this.api.updateRule(editing.key, body, editing.etag) : this.api.createRule(body);\n this.saving.set(true);\n this.saveError.set('');\n request.subscribe({\n next: () => { this.saving.set(false); this.form.set(null); this.data.reload(); },\n error: e => { this.saving.set(false); this.saveError.set(problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAoC;CACxC,WAAW;CACX,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,YAAY;CACZ,gBAAgB;CAChB,kBAAkB;CAClB,SAAS;AACV;AAGD,SAAS,QAAQ,OAAc;CAC7B,MAAM,QAAQ,iCAAiC,KAAK,OAAO,SAAS,EAAE,CAAC;CACvE,OAAO,QAAS,EAAE,MAAM,MAAM,KAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,KAAK;AAC9F;AAEA,SAAS,KAAK,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A;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,UAAA,CAAA,WAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,mBAAA;IAAA,UAAA,CAAA,WAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA5J;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAsJ;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAqEpK,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAvErB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;GAAO;GAC/K,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-rules.page-C_qiLXN_.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/rules.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { apiResource } from '../shared/resource';\nimport { RouterLink } from '@angular/router';\nimport { Observable, forkJoin, map } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Rule } from '../core/models';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\n\nconst TEMPLATES: Record<string, string> = {\n ErrorRate: 'Ratio of failed requests, 0 to 1. Fires above the threshold.',\n LatencyP95: 'Milliseconds at the 95th percentile. Fires above the threshold.',\n ThroughputAbsent: 'Requests in the window, for a service that had traffic. Fires at or below the threshold.',\n DeliveryFailureRate: 'Ratio of failed deliveries, 0 to 1. Fires above the threshold.',\n HostMemory: 'Ratio of host memory used, 0 to 1. Fires above the threshold.',\n MediatorErrors: 'Mediator errors in the window. Fires above the threshold.',\n ConsumerFailures: 'Failed consumer messages in the window. Fires above the threshold.',\n SloBurn: \"An SLO's burn rate over a long and a short window. Fires when both reach the rate; one alert per SLO.\",\n};\n\n/** A TimeSpan as the API writes it (`1.02:03:04`) in seconds. */\nfunction seconds(value: unknown): number {\n const match = /^(?:(\\d+)\\.)?(\\d+):(\\d+):(\\d+)/.exec(String(value ?? ''));\n return match ? (+(match[1] ?? 0)) * 86400 + +match[2] * 3600 + +match[3] * 60 + +match[4] : 0;\n}\n\nfunction span(total: number): string {\n const s = Math.max(0, Math.round(total || 0));\n const pad = (n: number) => String(n).padStart(2, '0');\n const days = Math.floor(s / 86400);\n return `${days ? `${days}.` : ''}${pad(Math.floor(s / 3600) % 24)}:${pad(Math.floor(s / 60) % 60)}:${pad(s % 60)}`;\n}\n\ninterface RuleForm {\n key: string; name: string; template: string; severity: string; service: string; environment: string; host: string; threshold: number | null; recoveryThreshold: number | null;\n minimumSamples: number; scheduleSeconds: number; windowSeconds: number; forSeconds: number; recoverySeconds: number; cooldownSeconds: number; enabled: boolean;\n}\n\nconst NEW_RULE: RuleForm = {\n key: '', name: '', template: 'ErrorRate', severity: 'Warning', service: '', environment: '', host: '', threshold: null, recoveryThreshold: null,\n minimumSamples: 10, scheduleSeconds: 60, windowSeconds: 300, forSeconds: 120, recoverySeconds: 120, cooldownSeconds: 600, enabled: true,\n};\n\n/**\n * Rules and their current state (Console requirements §14), and changing them for admins. They stay typed templates (D5): this page never takes a query.\n * A rule in the deployment's file is shown but changed there. Disabling one, or changing what it watches, closes its open alerts, which the form says first.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Rules</h1>\n <span class=\"jc-spacer\"></span>\n <button mat-flat-button type=\"button\" data-testid=\"rule-new\" (click)=\"startNew()\">New rule</button>\n </jc-context-bar>\n @if (data.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (data.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (form(); as f) {\n <section class=\"jc-card\" data-testid=\"rule-form\">\n <h2>{{ editing() ? 'Change ' + editing()!.key : 'New rule' }}</h2>\n <form class=\"jc-form\" (ngSubmit)=\"save(f)\">\n @if (!editing()) { <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Key</mat-label><input matInput name=\"key\" [(ngModel)]=\"f.key\" required></mat-form-field> }\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Name</mat-label><input matInput name=\"name\" [(ngModel)]=\"f.name\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Template</mat-label>\n <mat-select name=\"template\" [(ngModel)]=\"f.template\">@for (t of templates; track t) { <mat-option [value]=\"t\">{{ t }}</mat-option> }</mat-select>\n </mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Severity</mat-label>\n <mat-select name=\"severity\" [(ngModel)]=\"f.severity\"><mat-option value=\"Info\">Info</mat-option><mat-option value=\"Warning\">Warning</mat-option><mat-option value=\"Critical\">Critical</mat-option></mat-select>\n </mat-form-field>\n @if (f.template === 'HostMemory') {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Host (all if empty)</mat-label><input matInput name=\"host\" [(ngModel)]=\"f.host\"></mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Service (all if empty)</mat-label><input matInput name=\"service\" [(ngModel)]=\"f.service\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\"><mat-label>Environment (all if empty)</mat-label><input matInput name=\"environment\" [(ngModel)]=\"f.environment\"></mat-form-field>\n }\n <p class=\"jc-muted jc-small jc-form-actions\">{{ hint(f.template) }}</p>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"threshold\" [(ngModel)]=\"f.threshold\" required></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recovery threshold</mat-label><input matInput type=\"number\" step=\"any\" name=\"recoveryThreshold\" [(ngModel)]=\"f.recoveryThreshold\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Minimum samples</mat-label><input matInput type=\"number\" name=\"minimumSamples\" [(ngModel)]=\"f.minimumSamples\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Every (s)</mat-label><input matInput type=\"number\" name=\"schedule\" [(ngModel)]=\"f.scheduleSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Window (s)</mat-label><input matInput type=\"number\" name=\"window\" [(ngModel)]=\"f.windowSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Fire after (s)</mat-label><input matInput type=\"number\" name=\"for\" [(ngModel)]=\"f.forSeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Recover after (s)</mat-label><input matInput type=\"number\" name=\"recovery\" [(ngModel)]=\"f.recoverySeconds\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Cooldown (s)</mat-label><input matInput type=\"number\" name=\"cooldown\" [(ngModel)]=\"f.cooldownSeconds\"></mat-form-field>\n <mat-checkbox name=\"enabled\" [(ngModel)]=\"f.enabled\">Enabled</mat-checkbox>\n @if (editing()) { <p class=\"jc-muted jc-small jc-form-actions\">Disabling this rule, or changing its template or scope, resolves its open alerts: nothing would be watching them any more.</p> }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"rule-save\" [disabled]=\"saving()\">Save</button>\n <button mat-button type=\"button\" (click)=\"form.set(null)\">Cancel</button>\n @if (saveError()) { <span class=\"jc-error\" data-testid=\"rule-error\">{{ saveError() }}</span> }\n </div>\n </form>\n </section>\n }\n <table class=\"jc-table\" data-testid=\"rules\">\n <thead><tr><th>Rule</th><th>Template</th><th>Severity</th><th>Threshold</th><th>Recovery</th><th>Wait</th><th>Open alerts</th><th>Last evaluation</th><th></th></tr></thead>\n <tbody>\n @for (r of rows(); track r.key) {\n <tr [class.jc-muted]=\"!r.enabled\">\n <td><strong>{{ r.name }}</strong><div class=\"jc-muted jc-small\">{{ r.key }}@if (!r.enabled) { · disabled }@if (r.managedBy === 'config') { · from the rules file }@if (r.managedBy === 'platform') { · the platform's, for SLOs }</div></td>\n <td>{{ r.template }}</td>\n <td>{{ r.severity }}</td>\n <td>{{ r.definition['threshold'] ?? '—' }}</td>\n <td>{{ r.definition['recoveryThreshold'] ?? '—' }}</td>\n <td>{{ r.definition['forDuration'] ?? '—' }}</td>\n <td>\n @for (a of r.open; track a.id) {\n <div><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.state }}</a> {{ a.subjectKey }} = {{ a.lastValue ?? 'no data' }}</div>\n } @empty { <span class=\"jc-muted\">none</span> }\n </td>\n <td>{{ r.lastEvaluatedAt | ago }}</td>\n <td class=\"jc-row-actions\">@if (r.managedBy === 'api') { <button mat-button type=\"button\" [attr.data-testid]=\"'rule-edit-' + r.key\" (click)=\"edit(r)\">Change</button> }</td>\n </tr>\n }\n </tbody>\n </table>`,\n})\nexport class RulesPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n /** What a rule can be made from: SloBurn is described, but its rules are the platform's own, made for SLOs. */\n protected readonly templates = Object.keys(TEMPLATES).filter(t => t !== 'SloBurn');\n protected readonly form = signal<RuleForm | null>(null);\n protected readonly editing = signal<Rule | null>(null);\n protected readonly saving = signal(false);\n protected readonly saveError = signal('');\n protected readonly data = apiResource({\n stream: () => forkJoin({\n rules: this.api.rules().pipe(map(p => p.items)),\n firing: this.api.allAlerts({ state: 'firing' }).pipe(map(p => p.items)),\n pending: this.api.allAlerts({ state: 'pending' }).pipe(map(p => p.items)),\n }),\n });\n protected readonly error = computed(() => problemText(this.data.error()));\n protected readonly rows = computed(() => {\n const d = this.data.value();\n if (!d) return [];\n const open = [...d.firing, ...d.pending];\n return d.rules.map(r => {\n const mine = open.filter(a => a.rule === r.key);\n const last = mine.map(a => a.lastEvaluatedAt).sort().at(-1) ?? null;\n return { ...r, open: mine, lastEvaluatedAt: last };\n });\n });\n\n protected hint(template: string): string { return TEMPLATES[template] ?? ''; }\n\n protected startNew() { this.editing.set(null); this.saveError.set(''); this.form.set({ ...NEW_RULE }); }\n\n protected edit(rule: Rule) {\n const d = rule.definition;\n this.editing.set(rule);\n this.saveError.set('');\n this.form.set({\n key: rule.key, name: rule.name, template: rule.template, severity: rule.severity, service: String(d['service'] ?? ''), environment: String(d['environment'] ?? ''), host: String(d['host'] ?? ''),\n threshold: d['threshold'] as number, recoveryThreshold: (d['recoveryThreshold'] as number | null) ?? null, minimumSamples: d['minimumSamples'] as number, scheduleSeconds: seconds(d['schedule']), windowSeconds: seconds(d['window']),\n forSeconds: seconds(d['forDuration']), recoverySeconds: seconds(d['recoveryDuration']), cooldownSeconds: seconds(d['cooldown']), enabled: rule.enabled,\n });\n }\n\n protected save(f: RuleForm) {\n const host = f.template === 'HostMemory';\n const body = {\n key: f.key, name: f.name, template: f.template, severity: f.severity, service: host ? '' : f.service.trim(), environment: host ? '' : f.environment.trim().toLowerCase(), host: host ? f.host.trim() : '',\n threshold: f.threshold, recoveryThreshold: f.recoveryThreshold, minimumSamples: f.minimumSamples, schedule: span(f.scheduleSeconds), window: span(f.windowSeconds), forDuration: span(f.forSeconds),\n recoveryDuration: span(f.recoverySeconds), cooldown: span(f.cooldownSeconds), enabled: f.enabled,\n };\n const editing = this.editing();\n const request: Observable<Rule> = editing ? this.api.updateRule(editing.key, body, editing.etag) : this.api.createRule(body);\n this.saving.set(true);\n this.saveError.set('');\n request.subscribe({\n next: () => { this.saving.set(false); this.form.set(null); this.data.reload(); },\n error: e => { this.saving.set(false); this.saveError.set(problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAM,YAAoC;CACxC,WAAW;CACX,YAAY;CACZ,kBAAkB;CAClB,qBAAqB;CACrB,YAAY;CACZ,gBAAgB;CAChB,kBAAkB;CAClB,SAAS;AACV;AAGD,SAAS,QAAQ,OAAc;CAC7B,MAAM,QAAQ,iCAAiC,KAAK,OAAO,SAAS,EAAE,CAAC;CACvE,OAAO,QAAS,EAAE,MAAM,MAAM,KAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,KAAK;AAC9F;AAEA,SAAS,KAAK,OAAa;CACzB,MAAM,IAAI,KAAK,IAAI,GAAG,KAAK,MAAM,SAAS,CAAC,CAAC;CAC5C,MAAM,OAAO,MAAc,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG;CACpD,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK;CACjC,OAAO,GAAG,OAAO,GAAG,KAAI,KAAM,KAAK,IAAI,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,EAAC,GAAI,IAAI,KAAK,MAAM,IAAI,EAAE,IAAI,EAAE,E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AA,MAAsJ;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAqEpK,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAvErB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;GAAO;GAC/K,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEX,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ApiService, ContextService, LinkPipe, ObservabilityLinks } from "./juice-js-observability.mjs";
2
- import { _ as DurationPipe, a as TraceTable, c as ContextBar, g as AgoPipe, h as apiResource, i as ServiceStatsCharts, l as HealthBadge, n as LogTable, o as problemText, r as MetricExplorer, s as ConfidenceBadge, v as PercentPipe, y as ReasonPipe } from "./juice-js-observability-telemetry-7uv9jeKI.mjs";
2
+ import { _ as DurationPipe, a as TraceTable, c as ContextBar, g as AgoPipe, h as apiResource, i as ServiceStatsCharts, l as HealthBadge, n as LogTable, o as problemText, r as MetricExplorer, s as ConfidenceBadge, v as PercentPipe, y as ReasonPipe } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, input, linkedSignal, signal } from "@angular/core";
5
5
  import { Router, RouterLink } from "@angular/router";
@@ -1254,4 +1254,4 @@ i0.ɵɵngDeclareClassMetadata({
1254
1254
  });
1255
1255
  export { ServicePage };
1256
1256
 
1257
- //# sourceMappingURL=juice-js-observability-service.page-Dx4p3DmT.mjs.map
1257
+ //# sourceMappingURL=juice-js-observability-service.page-AxzRoXqg.mjs.map