@juice-js/observability 1.3.1-alpha.42 → 1.4.0-alpha.44

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 (57) hide show
  1. package/README.md +10 -0
  2. package/fesm2022/{juice-js-observability-agent.page-BJ0R-pGG.mjs → juice-js-observability-agent.page-DE84_XZr.mjs} +3 -3
  3. package/fesm2022/{juice-js-observability-agent.page-BJ0R-pGG.mjs.map → juice-js-observability-agent.page-DE84_XZr.mjs.map} +1 -1
  4. package/fesm2022/{juice-js-observability-agents.page-D-z66p2m.mjs → juice-js-observability-agents.page-C-o-OXai.mjs} +3 -3
  5. package/fesm2022/{juice-js-observability-agents.page-D-z66p2m.mjs.map → juice-js-observability-agents.page-C-o-OXai.mjs.map} +1 -1
  6. package/fesm2022/{juice-js-observability-alert.page-DhcSGLH0.mjs → juice-js-observability-alert.page-KyakwaUL.mjs} +4 -4
  7. package/fesm2022/{juice-js-observability-alert.page-DhcSGLH0.mjs.map → juice-js-observability-alert.page-KyakwaUL.mjs.map} +1 -1
  8. package/fesm2022/{juice-js-observability-alerts.page-B0ZpGPk9.mjs → juice-js-observability-alerts.page-up57Y8fX.mjs} +2 -2
  9. package/fesm2022/{juice-js-observability-alerts.page-B0ZpGPk9.mjs.map → juice-js-observability-alerts.page-up57Y8fX.mjs.map} +1 -1
  10. package/fesm2022/{juice-js-observability-approvals.page-l5mwxlcl.mjs → juice-js-observability-approvals.page-BgHDUGd4.mjs} +3 -3
  11. package/fesm2022/{juice-js-observability-approvals.page-l5mwxlcl.mjs.map → juice-js-observability-approvals.page-BgHDUGd4.mjs.map} +1 -1
  12. package/fesm2022/{juice-js-observability-incident.page-DyT-D0XB.mjs → juice-js-observability-incident.page-BryX9L8h.mjs} +4 -4
  13. package/fesm2022/{juice-js-observability-incident.page-DyT-D0XB.mjs.map → juice-js-observability-incident.page-BryX9L8h.mjs.map} +1 -1
  14. package/fesm2022/{juice-js-observability-incidents.page-AK09qCjN.mjs → juice-js-observability-incidents.page-B4DbQAWr.mjs} +3 -3
  15. package/fesm2022/{juice-js-observability-incidents.page-AK09qCjN.mjs.map → juice-js-observability-incidents.page-B4DbQAWr.mjs.map} +1 -1
  16. package/fesm2022/{juice-js-observability-load-runs.page-CGCfrsZj.mjs → juice-js-observability-load-runs.page-UPQFzG3h.mjs} +2 -2
  17. package/fesm2022/{juice-js-observability-load-runs.page-CGCfrsZj.mjs.map → juice-js-observability-load-runs.page-UPQFzG3h.mjs.map} +1 -1
  18. package/fesm2022/{juice-js-observability-logs.page-DZiAYl0A.mjs → juice-js-observability-logs.page-DtCoZuZg.mjs} +2 -2
  19. package/fesm2022/{juice-js-observability-logs.page-DZiAYl0A.mjs.map → juice-js-observability-logs.page-DtCoZuZg.mjs.map} +1 -1
  20. package/fesm2022/{juice-js-observability-metrics.page-DY8SFoxp.mjs → juice-js-observability-metrics.page-By3pnaJz.mjs} +2 -2
  21. package/fesm2022/{juice-js-observability-metrics.page-DY8SFoxp.mjs.map → juice-js-observability-metrics.page-By3pnaJz.mjs.map} +1 -1
  22. package/fesm2022/{juice-js-observability-notifications.page-COeOVY1T.mjs → juice-js-observability-notifications.page-DIXE52Rt.mjs} +3 -3
  23. package/fesm2022/{juice-js-observability-notifications.page-COeOVY1T.mjs.map → juice-js-observability-notifications.page-DIXE52Rt.mjs.map} +1 -1
  24. package/fesm2022/{juice-js-observability-overview.page-CUJFOlnm.mjs → juice-js-observability-overview.page-CdSUNH6a.mjs} +3 -3
  25. package/fesm2022/{juice-js-observability-overview.page-CUJFOlnm.mjs.map → juice-js-observability-overview.page-CdSUNH6a.mjs.map} +1 -1
  26. package/fesm2022/{juice-js-observability-resource.page-BrLwpTXN.mjs → juice-js-observability-resource.page-CIY0hWSX.mjs} +2 -2
  27. package/fesm2022/{juice-js-observability-resource.page-BrLwpTXN.mjs.map → juice-js-observability-resource.page-CIY0hWSX.mjs.map} +1 -1
  28. package/fesm2022/{juice-js-observability-resources.page-Dyh7AjOW.mjs → juice-js-observability-resources.page-Ch6GVPyx.mjs} +2 -2
  29. package/fesm2022/{juice-js-observability-resources.page-Dyh7AjOW.mjs.map → juice-js-observability-resources.page-Ch6GVPyx.mjs.map} +1 -1
  30. package/fesm2022/{juice-js-observability-rules.page-C_qiLXN_.mjs → juice-js-observability-rules.page-AbY-0A8n.mjs} +2 -2
  31. package/fesm2022/{juice-js-observability-rules.page-C_qiLXN_.mjs.map → juice-js-observability-rules.page-AbY-0A8n.mjs.map} +1 -1
  32. package/fesm2022/{juice-js-observability-service.page-AxzRoXqg.mjs → juice-js-observability-service.page-BAUPza0x.mjs} +2 -2
  33. package/fesm2022/{juice-js-observability-service.page-AxzRoXqg.mjs.map → juice-js-observability-service.page-BAUPza0x.mjs.map} +1 -1
  34. package/fesm2022/{juice-js-observability-services.page-CpEdbC2L.mjs → juice-js-observability-services.page-CBtxLm0R.mjs} +2 -2
  35. package/fesm2022/{juice-js-observability-services.page-CpEdbC2L.mjs.map → juice-js-observability-services.page-CBtxLm0R.mjs.map} +1 -1
  36. package/fesm2022/{juice-js-observability-silences.page-DI4q9Fx-.mjs → juice-js-observability-silences.page-WxGogpDD.mjs} +2 -2
  37. package/fesm2022/{juice-js-observability-silences.page-DI4q9Fx-.mjs.map → juice-js-observability-silences.page-WxGogpDD.mjs.map} +1 -1
  38. package/fesm2022/{juice-js-observability-slo.page-CAdDtj28.mjs → juice-js-observability-slo.page-BRigA4Ss.mjs} +4 -4
  39. package/fesm2022/{juice-js-observability-slo.page-CAdDtj28.mjs.map → juice-js-observability-slo.page-BRigA4Ss.mjs.map} +1 -1
  40. package/fesm2022/{juice-js-observability-slos.page-CQRX3Kmn.mjs → juice-js-observability-slos.page-DVg2gK4Y.mjs} +3 -3
  41. package/fesm2022/{juice-js-observability-slos.page-CQRX3Kmn.mjs.map → juice-js-observability-slos.page-DVg2gK4Y.mjs.map} +1 -1
  42. package/fesm2022/{juice-js-observability-suggestions-CX_srxh1.mjs → juice-js-observability-suggestions-CBuNlU0Y.mjs} +3 -3
  43. package/fesm2022/{juice-js-observability-suggestions-CX_srxh1.mjs.map → juice-js-observability-suggestions-CBuNlU0Y.mjs.map} +1 -1
  44. package/fesm2022/{juice-js-observability-telemetry-CwdIXE9m.mjs → juice-js-observability-telemetry-CaunxC3Y.mjs} +2 -2
  45. package/fesm2022/{juice-js-observability-telemetry-CwdIXE9m.mjs.map → juice-js-observability-telemetry-CaunxC3Y.mjs.map} +1 -1
  46. package/fesm2022/{juice-js-observability-timeline.page-dH4NzP4l.mjs → juice-js-observability-timeline.page-ChDtTC3b.mjs} +3 -3
  47. package/fesm2022/{juice-js-observability-timeline.page-dH4NzP4l.mjs.map → juice-js-observability-timeline.page-ChDtTC3b.mjs.map} +1 -1
  48. package/fesm2022/{juice-js-observability-topology.page-IJrW71aU.mjs → juice-js-observability-topology.page-BN5NL2st.mjs} +2 -2
  49. package/fesm2022/{juice-js-observability-topology.page-IJrW71aU.mjs.map → juice-js-observability-topology.page-BN5NL2st.mjs.map} +1 -1
  50. package/fesm2022/{juice-js-observability-trace.page-Bp8ZBzEh.mjs → juice-js-observability-trace.page-CtJQZkNW.mjs} +3 -3
  51. package/fesm2022/{juice-js-observability-trace.page-Bp8ZBzEh.mjs.map → juice-js-observability-trace.page-CtJQZkNW.mjs.map} +1 -1
  52. package/fesm2022/{juice-js-observability-traces.page-CPcODdxw.mjs → juice-js-observability-traces.page-BkGlHFEK.mjs} +2 -2
  53. package/fesm2022/{juice-js-observability-traces.page-CPcODdxw.mjs.map → juice-js-observability-traces.page-BkGlHFEK.mjs.map} +1 -1
  54. package/fesm2022/juice-js-observability.mjs +120 -129
  55. package/fesm2022/juice-js-observability.mjs.map +1 -1
  56. package/package.json +3 -3
  57. package/types/juice-js-observability.d.ts +14 -8
package/README.md CHANGED
@@ -20,6 +20,16 @@ providers: [
20
20
  MenuModule.forRoot([...yourMenus, ...observabilityMenus('/observability', 100)]),
21
21
  ```
22
22
 
23
+ The menu puts the investigation pages at the top (Overview, Services, Traces, Logs, Metrics, Alerts, Incidents) and the
24
+ rest in three groups: Explore (with Load runs), Automation and Configure. It needs juice-layout 2.2 or later, which
25
+ opens a group on any of its pages and adds the page switcher: every page one Ctrl+K away, and go-to keys
26
+ for the top pages (`g s` Services, `g t` Traces, `g l` Logs, `g m` Metrics, `g a` Alerts, `g i` Incidents, `g o`
27
+ Overview).
28
+
29
+ The Approvals entry counts the action requests waiting for the signed-in user, through juice-layout's
30
+ `MenuBadgeService` under the menu id `APPROVALS_MENU_ID` (`approvals`); the menu shows it on Automation while that group
31
+ is closed. `provideJuiceObservability({ approvalCount: false })` turns it off.
32
+
23
33
  ```scss
24
34
  // styles.scss (the app's global styles, once): the pages' layout, in the Juice Console's teal theme, light and dark (.dark).
25
35
  @use '@juice-js/observability';
@@ -1,9 +1,9 @@
1
1
  import { ApiService, ApprovalCount, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { S as formatBytes, b as copyText, c as ContextBar, g as AgoPipe, h as apiResource, o as problemText, y as ReasonPipe } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
2
+ import { S as formatBytes, b as copyText, c as ContextBar, g as AgoPipe, h as apiResource, o as problemText, y as ReasonPipe } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from "@angular/core";
5
- import { RouterLink } from "@angular/router";
6
5
  import { DatePipe } from "@angular/common";
6
+ import { RouterLink } from "@angular/router";
7
7
  import * as i1 from "@angular/forms";
8
8
  import { FormsModule } from "@angular/forms";
9
9
  import * as i2 from "@angular/material/button";
@@ -1123,4 +1123,4 @@ i0.ɵɵngDeclareClassMetadata({
1123
1123
  });
1124
1124
  export { AgentPage };
1125
1125
 
1126
- //# sourceMappingURL=juice-js-observability-agent.page-BJ0R-pGG.mjs.map
1126
+ //# sourceMappingURL=juice-js-observability-agent.page-DE84_XZr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-agent.page-BJ0R-pGG.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/agent.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ApprovalCount } from '../core/approval-count';\nimport { ContextService } from '../core/context.service';\nimport { ActionParameter, AgentAction, AgentCommand, BundleSummary, EnrollmentToken } from '../core/models';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AgoPipe, ReasonPipe, copyText, formatBytes } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/** What the actions return (Juice.Observability.Agent's Diagnostics). */\ninterface HostSummary {\n hostname: string; operatingSystem: string; architecture: string; uptimeSeconds: number; processorCount: number; loadAverage: number[] | null;\n memoryTotalBytes: number | null; memoryAvailableBytes: number | null; agentVersion: string;\n}\ninterface Filesystem { mountPoint: string; format: string; totalBytes: number; freeBytes: number; availableBytes: number; }\ninterface DiskUsage { filesystems: Filesystem[]; truncated: boolean; }\ninterface TcpReachability { host: string; port: number; reachable: boolean; address: string | null; elapsedMs: number; error: string | null; }\n\nconst WAITING = ['Pending', 'Delivered'];\nconst LABELS: Record<string, string> = {\n 'host.summary': 'Host summary', 'disk.usage': 'Disk usage', 'tcp.reachability': 'TCP reachability', 'agent.update': 'Update the agent',\n 'service.restart': 'Restart a service', 'files.cleanup': 'Clean up old files', 'diagnostics.bundle': 'Diagnostic bundle',\n};\nconst PARAMETER_LABELS: Record<string, string> = {\n pathPrefix: 'Only under this path', host: 'Host', port: 'Port', timeoutMs: 'Wait (ms)', service: 'Service', folder: 'Folder',\n keepHours: 'Keep files from the last (hours)', dryRun: 'Dry run: only report what would go', logLines: 'Lines from each log',\n};\n\nfunction formatUptime(seconds: number): string {\n const days = Math.floor(seconds / 86_400);\n const hours = Math.floor((seconds % 86_400) / 3600);\n return days > 0 ? `${days} d ${hours} h` : hours > 0 ? `${hours} h ${Math.floor((seconds % 3600) / 60)} min` : `${Math.floor(seconds / 60)} min`;\n}\n\n/**\n * One Juice Agent: whether it's calling in, what it was asked and what it answered. Operators run the read-only diagnostics; admins update and\n * revoke it. The platform signs each command, and the agent's own allowlist on its host still decides: a refusal there shows as `Rejected`.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe, ReasonPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['agents'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Agents</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ agent.value()?.hostname ?? '…' }}</h1>\n </jc-context-bar>\n @if (agent.isLoading() && !agent.value()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (agent.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (agent.value(); as a) {\n <div class=\"jc-summary\" data-testid=\"agent-summary\">\n <span class=\"jc-badge\" data-testid=\"agent-state\" [class.jc-health-healthy]=\"a.online\" [class.jc-health-offline]=\"!a.online && a.status === 'Active'\" [class.jc-health-none]=\"a.status !== 'Active'\">\n {{ a.status !== 'Active' ? a.status : a.online ? 'Online' : 'Not calling in' }}</span>\n <span>{{ a.operatingSystem }}</span>\n <span>version <span class=\"jc-mono\" data-testid=\"agent-version\">{{ a.version }}</span></span>\n <span class=\"jc-muted\">last seen {{ a.lastSeenAt | ago }}</span>\n @if (a.resourceId) { <a [routerLink]=\"['resources', a.resourceId] | jcLink\" [queryParams]=\"ctx.keep()\">Host resource</a> }\n </div>\n <p class=\"jc-muted jc-small\">Enrolled {{ a.enrolledAt | date: 'MMM d, y, HH:mm' }} by {{ a.enrolledBy }}. Certificate valid until {{ a.certificateNotAfter | date: 'MMM d, HH:mm' }}; the agent renews it when a third is left.</p>\n @if (a.status !== 'Active') {\n <p class=\"jc-notice\" data-testid=\"agent-revoked\">Revoked {{ a.revokedAt | date: 'MMM d, y, HH:mm' }} by {{ a.revokedBy }}: {{ a.revokeReason }}. The platform refuses its certificate for good.</p>\n @if (successor(); as s) {\n <p data-testid=\"agent-successor\">{{ a.hostname }} enrolled again {{ s.enrolledAt | date: 'MMM d, HH:mm' }} as <a [routerLink]=\"['agents', s.id] | jcLink\" [queryParams]=\"ctx.keep()\">a new agent</a>.</p>\n } @else {\n <section class=\"jc-card\" data-testid=\"reenroll\">\n <h2>Bring this host back</h2>\n <p class=\"jc-muted jc-small\">The host comes back as a new agent, with a new key: this one stays revoked, with its history. It needs a new token from an admin, put on the host.</p>\n <button mat-flat-button type=\"button\" data-testid=\"reenroll-create\" [disabled]=\"creating()\" (click)=\"reenroll(a.hostname)\">Create a token for {{ a.hostname }}</button>\n @if (reenrollError()) { <span class=\"jc-error\" data-testid=\"reenroll-error\"> {{ reenrollError() }}</span> }\n @if (token(); as t) {\n <div class=\"jc-notice\" data-testid=\"reenroll-token\">\n <p>Replace the token in the agent's token file (<span class=\"jc-mono\">Agent:EnrollmentTokenFile</span>) with this one. It works once, until {{ t.expiresAt | date: 'MMM d, HH:mm' }}, and <strong>won't be shown again</strong>.</p>\n <p class=\"jc-row\"><span class=\"jc-mono\" data-testid=\"reenroll-token-value\">{{ t.token }}</span>\n <button mat-button type=\"button\" (click)=\"copy(t.token)\">{{ copied() === 'copied' ? 'Copied' : copied() === 'selected' ? 'Selected: press Ctrl+C' : 'Copy' }}</button></p>\n <p>The agent notices it within seconds, sets its old identity aside and enrolls again: nothing else on the host changes. An agent from before 9 November doesn't: clear its data directory's identity files and restart it.</p>\n </div>\n }\n </section>\n }\n } @else {\n <section class=\"jc-card\">\n <h2>Ask the agent</h2>\n <form class=\"jc-form\" data-testid=\"command-form\" (ngSubmit)=\"issue()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Action</mat-label>\n <mat-select name=\"action\" data-testid=\"command-action\" [ngModel]=\"action()\" (ngModelChange)=\"choose($event)\">\n @for (o of actionList(); track o.name) {\n <mat-option [value]=\"o.name\" [disabled]=\"o.permitted === false\" [attr.data-testid]=\"'action-' + o.name\">\n {{ label(o.name) }}@if (o.custom) { <span class=\"jc-muted\"> · custom</span> }@if (o.permitted === false) { <span class=\"jc-muted\"> · not allowed on this host</span> }\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (action() === 'agent.update') {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Version</mat-label>\n <mat-select name=\"version\" data-testid=\"command-version\" [(ngModel)]=\"version\">\n @for (p of packages.value()?.items ?? []; track p.version) { <mat-option [value]=\"p.version\">{{ p.version }}</mat-option> }\n </mat-select>\n </mat-form-field>\n @if (packages.value()?.items?.length === 0) { <span class=\"jc-muted jc-small\">No signed packages are offered: see Agents:PackageDirectory.</span> }\n } @else {\n @for (p of selected()?.parameters ?? []; track p.name) {\n @if (p.type === 'boolean') {\n <mat-checkbox [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] === true\" (ngModelChange)=\"set(p.name, $event)\">{{ title(p) }}</mat-checkbox>\n } @else if (p.allowed?.length) {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-md]=\"p.type !== 'string'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <mat-select [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n @if (!p.required) { <mat-option value=\"\">Any</mat-option> }\n @for (v of p.allowed; track v) { <mat-option [value]=\"v\">{{ v }}</mat-option> }\n </mat-select>\n </mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-sm]=\"p.type === 'integer'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <input matInput [type]=\"p.type === 'integer' ? 'number' : 'text'\" [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [attr.min]=\"p.minimum\" [attr.max]=\"p.maximum\"\n [attr.maxlength]=\"p.maxLength\" [placeholder]=\"p.description ?? ''\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n </mat-form-field>\n }\n }\n }\n @if (needsApproval()) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why (for whoever approves it)</mat-label>\n <input matInput name=\"requestReason\" data-testid=\"request-reason\" maxlength=\"500\" [(ngModel)]=\"requestReason\">\n </mat-form-field>\n @if (selected()?.changing && agent.value()?.resourceId) {\n <mat-checkbox name=\"watchHost\" data-testid=\"request-watch-host\" [(ngModel)]=\"watchHost\">Fix this host's health: run only while it's unhealthy, and confirm recovery after</mat-checkbox>\n }\n }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"command-issue\" [disabled]=\"issuing() || selected()?.permitted === false\">{{ needsApproval() ? 'Request' : action() === 'agent.update' ? 'Update' : 'Run' }}</button>\n @if (issueError()) { <span class=\"jc-error\" data-testid=\"command-error\">{{ issueError() }}</span> }\n @if (issued()) { <span class=\"jc-muted\" data-testid=\"command-issued\">{{ issued() }}</span> }\n </div>\n @if (selected(); as s) {\n <div class=\"jc-muted jc-small jc-form-actions\" data-testid=\"command-hint\">\n <div>{{ s.description }} <span data-testid=\"command-approval\">{{ s.risk }} risk: {{ approvalText(s.approval) }}.</span></div>\n @if (s.limits.length) { <div data-testid=\"command-limits\">On this host: {{ s.limits.join('; ') }}.</div> }\n </div>\n }\n </form>\n @if (actions.value(); as list) {\n @if (!list.reportedAt) {\n <p class=\"jc-notice\" data-testid=\"actions-not-reported\">This agent doesn't report what its host allows (it's older than this platform): the list shows the built-in actions, and one its host doesn't permit comes back <strong>Rejected</strong>.</p>\n } @else {\n <p class=\"jc-muted jc-small\">As the agent reported {{ list.reportedAt | ago }}, when it started. Its host still checks every command.</p>\n }\n }\n </section>\n }\n\n @if (requestList().length) {\n <section class=\"jc-card\" data-testid=\"requests\">\n <h2>Requests</h2>\n <table class=\"jc-table\">\n <thead><tr><th>Asked</th><th>Action</th><th>By, and why</th><th>State</th><th>Decided</th><th></th></tr></thead>\n <tbody>\n @for (r of requestList(); track r.id) {\n <tr [attr.data-testid]=\"'request-' + r.id\">\n <td class=\"jc-nowrap\">{{ r.requestedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ r.action }}</strong><div class=\"jc-muted jc-small\">{{ r.risk }} risk</div></td>\n <td>{{ r.requestedBy }}<div class=\"jc-small\">{{ r.reason }}</div></td>\n <td class=\"jc-nowrap\"><span class=\"jc-badge\" [class.jc-health-degraded]=\"r.state === 'Pending'\" [class.jc-health-healthy]=\"r.state === 'Issued'\"\n [class.jc-health-none]=\"r.state !== 'Pending' && r.state !== 'Issued'\" data-testid=\"request-state\">{{ r.state === 'Pending' ? 'Waiting for approval' : r.state }}</span>\n @if (r.state === 'Pending') { <div class=\"jc-muted jc-small\">until {{ r.expiresAt | date: 'HH:mm' }}</div> }\n @if (r.verification && r.verification !== 'None') {\n <div class=\"jc-small\" data-testid=\"request-verification\" [class.jc-error]=\"r.verification === 'NotVerified'\" [title]=\"r.verificationNote ?? ''\">{{ verificationText(r.verification) }}</div>\n }</td>\n <td class=\"jc-small\">@if (r.decidedBy) { {{ r.decidedBy }}, {{ r.decidedAt | date: 'HH:mm' }} }@if (r.comment) { <div>{{ r.comment }}</div> }</td>\n <td class=\"jc-row-actions\">@if (r.state === 'Pending') { <button mat-button type=\"button\" [attr.data-testid]=\"'request-cancel-' + r.id\" (click)=\"cancelRequest(r.id)\">Cancel</button> }</td>\n </tr>\n }\n </tbody>\n </table>\n </section>\n }\n\n <section class=\"jc-card\" data-testid=\"commands\">\n <h2>Commands</h2>\n @if (commands.error()) { <p class=\"jc-error\">{{ commandsError() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Issued</th><th>Action</th><th>By</th><th>State</th><th>Answer</th></tr></thead>\n <tbody>\n @for (c of allCommands(); track c.id) {\n <tr [attr.data-testid]=\"'command-' + c.id\">\n <td class=\"jc-nowrap\">{{ c.issuedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ c.action }}</strong>@if (describe(c); as d) { <div class=\"jc-small jc-mono\">{{ d }}</div> }</td>\n <td>{{ c.issuedBy }}</td>\n <td class=\"jc-nowrap\">\n <span class=\"jc-badge\" [class.jc-health-healthy]=\"c.state === 'Succeeded'\" [class.jc-health-unhealthy]=\"c.state === 'Failed' || c.state === 'Rejected'\"\n [class.jc-health-degraded]=\"waiting(c)\" [class.jc-health-none]=\"c.state === 'Expired' || c.state === 'Cancelled'\" data-testid=\"command-state\">{{ c.state }}</span>\n @if (c.durationMs !== null) { <div class=\"jc-muted jc-small\">{{ c.durationMs }} ms</div> }\n </td>\n <td class=\"jc-small\" data-testid=\"command-answer\">\n @if (c.reason) { <div [class.jc-bad]=\"c.state !== 'Succeeded'\">{{ c.reason | reason }}</div> }\n @if (c.state === 'Succeeded' && c.result) {\n @switch (c.action) {\n @case ('host.summary') {\n @if (summary(c); as h) {\n <div>{{ h.hostname }} · {{ h.operatingSystem }} {{ h.architecture }} · up {{ uptime(h.uptimeSeconds) }}</div>\n <div>{{ h.processorCount }} CPUs@if (h.loadAverage) { · load {{ h.loadAverage.join(' ') }} }@if (h.memoryTotalBytes) { · memory {{ bytes(h.memoryAvailableBytes) }} of {{ bytes(h.memoryTotalBytes) }} available }</div>\n }\n }\n @case ('disk.usage') {\n @if (disk(c); as d) {\n <table class=\"jc-kv\" data-testid=\"disk-result\">\n @for (f of fullestFirst(d, expanded().has(c.id)); track f.mountPoint) {\n <tr [class.jc-bad]=\"low(f)\">\n <td class=\"jc-mono\">{{ f.mountPoint }}</td><td>{{ f.format }}</td><td class=\"jc-nowrap\">{{ bytes(f.availableBytes) }} free of {{ bytes(f.totalBytes) }}</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No filesystems there.</td></tr> }\n </table>\n @if (d.filesystems.length > shown) {\n <button mat-button type=\"button\" [attr.data-testid]=\"'disk-toggle-' + c.id\" (click)=\"toggle(c.id)\">\n {{ expanded().has(c.id) ? 'Show the fullest ' + shown : 'Show all ' + d.filesystems.length }}</button>\n }\n @if (d.truncated) { <div class=\"jc-muted\">More filesystems than the agent reports at once.</div> }\n }\n }\n @case ('tcp.reachability') {\n @if (tcp(c); as t) {\n @if (t.reachable) { <div>Reachable at {{ t.address }} in {{ t.elapsedMs }} ms</div> }\n @else { <div class=\"jc-bad\">Not reachable after {{ t.elapsedMs }} ms: {{ t.error }}</div> }\n }\n }\n @case ('diagnostics.bundle') {\n @if (bundle(c); as b) {\n <div data-testid=\"bundle-result\">{{ bytes(b.sizeBytes) }} zip: {{ b.entries.length }} files@if (b.redacted) { · {{ b.redacted }} {{ b.redacted === 1 ? 'value' : 'values' }} redacted }\n <button mat-button type=\"button\" [attr.data-testid]=\"'bundle-download-' + c.id\" [disabled]=\"downloading() === b.bundleId\" (click)=\"download(b)\">Download</button>\n </div>\n @for (s of b.skipped; track s) { <div class=\"jc-muted\">Left out: {{ s }}</div> }\n @if (downloadErrors()[b.bundleId]; as e) { <div class=\"jc-error\" [attr.data-testid]=\"'bundle-error-' + c.id\">{{ e }}</div> }\n }\n }\n @default {\n @if (flat(c.result); as rows) {\n <table class=\"jc-kv\" data-testid=\"custom-result\">@for (r of rows; track r[0]) { <tr><td>{{ r[0] }}</td><td class=\"jc-mono\">{{ r[1] }}</td></tr> }</table>\n } @else { <pre class=\"jc-mono\" style=\"white-space: pre-wrap; margin: 0\" data-testid=\"custom-result\">{{ json(c.result) }}</pre> }\n }\n }\n }\n @if (waiting(c)) { <div class=\"jc-muted\">{{ c.state === 'Pending' ? 'Waiting for the agent to call in' : 'Handed to the agent' }}, until {{ c.expiresAt | date: 'HH:mm:ss' }}</div> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">Nothing asked yet.</td></tr> }\n </tbody>\n </table>\n @if (nextCursor()) { <button mat-button type=\"button\" data-testid=\"commands-older\" (click)=\"loadOlder()\">Older</button> }\n </section>\n\n @if (a.status === 'Active') {\n <section class=\"jc-card\">\n <h2>Revoke</h2>\n <p class=\"jc-muted jc-small\">The agent stops at its next call: the platform refuses its certificate from then on, and commands still waiting are cancelled. It can't be undone; the host would enroll again with a new token.</p>\n <form class=\"jc-form\" (ngSubmit)=\"revoke()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why</mat-label><input matInput name=\"reason\" data-testid=\"revoke-reason\" [(ngModel)]=\"reason\" maxlength=\"500\" (ngModelChange)=\"confirming.set(false)\"></mat-form-field>\n @if (confirming()) {\n <button mat-flat-button color=\"warn\" type=\"submit\" data-testid=\"revoke-confirm\" [disabled]=\"revoking()\">Revoke {{ a.hostname }}</button>\n <button mat-button type=\"button\" (click)=\"confirming.set(false)\">Cancel</button>\n } @else {\n <button mat-stroked-button type=\"submit\" data-testid=\"revoke\" [disabled]=\"!reason.trim()\">Revoke</button>\n }\n @if (revokeError()) { <span class=\"jc-error\" data-testid=\"revoke-error\">{{ revokeError() }}</span> }\n </form>\n </section>\n }\n }`,\n})\nexport class AgentPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly approvalCount = inject(ApprovalCount);\n readonly id = input.required<string>();\n protected readonly action = signal('host.summary');\n /** The form's values for the chosen action, by parameter name. */\n protected readonly values = signal<Record<string, unknown>>({});\n protected readonly issuing = signal(false);\n protected readonly issueError = signal('');\n protected readonly confirming = signal(false);\n protected readonly revoking = signal(false);\n protected readonly revokeError = signal('');\n protected version = '';\n protected reason = '';\n protected requestReason = '';\n /** Aim the request at this agent's host: checked unhealthy before it runs, and watched for recovery after. */\n protected watchHost = false;\n /** What happened to the last request, when it didn't simply run. */\n protected readonly issued = signal('');\n protected readonly needsApproval = computed(() => (this.selected()?.approval ?? 'None') !== 'None');\n protected readonly requests = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.actionRequests({ agentId: params, limit: 20 }) });\n protected readonly requestList = computed(() => this.requests.value()?.items ?? []);\n protected readonly creating = signal(false);\n protected readonly reenrollError = signal('');\n protected readonly token = signal<EnrollmentToken | null>(null);\n protected readonly copied = signal<'' | 'copied' | 'selected'>('');\n\n /** For a revoked agent: the active one its host enrolled as since, if any. */\n private readonly everyone = apiResource({ params: () => this.agent.value()?.status === 'Revoked' || undefined, stream: () => this.api.agents(true) });\n protected readonly successor = computed(() => {\n const revoked = this.agent.value();\n if (!revoked?.revokedAt) return undefined;\n return (this.everyone.value()?.items ?? []).find(a => a.status === 'Active' && a.hostname === revoked.hostname && Date.parse(a.enrolledAt) > Date.parse(revoked.revokedAt!));\n });\n\n /** What the agent reported it can run, with its host's bounds: the menu and the form come from it, custom actions included. */\n protected readonly actions = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentActions(params) });\n protected readonly actionList = computed(() => this.actions.value()?.items ?? []);\n protected readonly selected = computed<AgentAction | undefined>(() => this.actionList().find(a => a.name === this.action()));\n\n protected readonly agent = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agent(params) });\n protected readonly error = computed(() => problemText(this.agent.error()));\n protected readonly commands = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentCommands(params) });\n protected readonly commandsError = computed(() => problemText(this.commands.error()));\n /** Asked for only once someone picks an update, since only admins can use it. */\n protected readonly packages = apiResource({ params: () => this.action() === 'agent.update' || undefined, stream: () => this.api.agentPackages() });\n private readonly older = signal<{ items: AgentCommand[]; cursor: string | null } | null>(null);\n protected readonly allCommands = computed(() => {\n const first = this.commands.value()?.items ?? [];\n const seen = new Set(first.map(c => c.id));\n return [...first, ...(this.older()?.items ?? []).filter(c => !seen.has(c.id))];\n });\n protected readonly nextCursor = computed(() => this.older() ? this.older()!.cursor : this.commands.value()?.nextCursor ?? null);\n\n constructor() {\n // Once the list is in, start on an action the host permits, with its defaults filled in.\n effect(() => {\n const list = this.actionList();\n if (list.length === 0) return;\n const current = list.find(a => a.name === untracked(this.action));\n if (!current || current.permitted === false) this.choose((list.find(a => a.permitted !== false) ?? list[0]).name);\n else if (Object.keys(untracked(this.values)).length === 0) this.choose(current.name);\n });\n // While a command waits, look again every 2 seconds, and at the agent too, since an update changes its version. While a request waits for\n // approval, every 5: someone else decides it.\n effect(onCleanup => {\n const running = this.allCommands().some(c => this.waiting(c));\n const deciding = this.requestList().some(r => r.state === 'Pending');\n if (!running && !deciding) return;\n const timer = setTimeout(() => { this.commands.reload(); this.agent.reload(); this.requests.reload(); }, running ? 2000 : 5000);\n onCleanup(() => clearTimeout(timer));\n });\n }\n\n protected waiting(c: AgentCommand): boolean { return WAITING.includes(c.state) && new Date(c.expiresAt).getTime() > Date.now(); }\n\n protected describe(c: AgentCommand): string {\n const p = c.parameters ?? {};\n switch (c.action) {\n case 'disk.usage': return p['pathPrefix'] ? `under ${p['pathPrefix']}` : 'all filesystems';\n case 'tcp.reachability': return `${p['host']}:${p['port']}, wait ${p['timeoutMs']} ms`;\n case 'agent.update': return `to ${p['version']}`;\n default: return Object.entries(p).map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`).join(', ');\n }\n }\n\n /** The built-ins by name as people say them; a custom action by its own name. */\n protected label(name: string): string { return LABELS[name] ?? name; }\n\n protected title(p: ActionParameter): string {\n const words = PARAMETER_LABELS[p.name] ?? p.name.replace(/([A-Z])/g, ' $1').replace(/^./, c => c.toUpperCase());\n return p.required || p.type === 'boolean' ? words : `${words} (optional)`;\n }\n\n protected choose(name: string) {\n this.action.set(name);\n this.issueError.set('');\n const defaults: Record<string, unknown> = {};\n for (const p of this.actionList().find(a => a.name === name)?.parameters ?? []) {\n if (p.default !== null) defaults[p.name] = p.type === 'integer' ? Number(p.default) : p.type === 'boolean' ? p.default === 'true' : p.default;\n else if (p.required && p.allowed?.length === 1) defaults[p.name] = p.allowed[0];\n }\n this.values.set(defaults);\n }\n\n protected set(name: string, value: unknown) { this.values.update(v => ({ ...v, [name]: value })); }\n\n /** A result of plain values reads as a table; anything nested as JSON. */\n protected flat(result: unknown): [string, string][] | null {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return null;\n const entries = Object.entries(result as Record<string, unknown>);\n return entries.every(([, v]) => v === null || ['string', 'number', 'boolean'].includes(typeof v)) ? entries.map(([k, v]) => [k, v === null ? '—' : String(v)]) : null;\n }\n\n protected summary(c: AgentCommand) { return c.result as unknown as HostSummary; }\n protected bundle(c: AgentCommand) { return c.result as unknown as BundleSummary; }\n protected readonly downloading = signal<string | null>(null);\n /** A failed download's reason, by bundle: shown under that bundle only. */\n protected readonly downloadErrors = signal<Record<string, string>>({});\n\n /** Fetches the zip with the user's token and hands it to the browser as a file. */\n protected download(b: BundleSummary) {\n this.downloading.set(b.bundleId);\n this.downloadErrors.update(e => ({ ...e, [b.bundleId]: '' }));\n this.api.downloadBundle(this.id(), b.bundleId).subscribe({\n next: response => {\n this.downloading.set(null);\n const name = /filename=\"?([^\";]+)\"?/.exec(response.headers.get('content-disposition') ?? '')?.[1] ?? `juice-bundle-${b.bundleId}.zip`;\n const url = URL.createObjectURL(response.body!);\n const link = document.createElement('a');\n link.href = url;\n link.download = name;\n link.click();\n setTimeout(() => URL.revokeObjectURL(url), 10_000);\n },\n error: e => {\n this.downloading.set(null);\n const reason = e?.status === 404 ? 'The bundle is gone: bundles are kept 14 days by default.'\n : e?.status === 403 ? 'Downloading a bundle takes an operator or an admin: its log excerpts can say more than the rest of the Console.' : problemText(e);\n this.downloadErrors.update(errors => ({ ...errors, [b.bundleId]: reason }));\n },\n });\n }\n protected disk(c: AgentCommand) { return c.result as unknown as DiskUsage; }\n protected tcp(c: AgentCommand) { return c.result as unknown as TcpReachability; }\n /** A whole host can have dozens of mounts: the fullest come first, and the rest on request. */\n protected readonly shown = 8;\n protected readonly expanded = signal(new Set<string>());\n protected toggle(id: string) { this.expanded.update(s => { const next = new Set(s); if (!next.delete(id)) next.add(id); return next; }); }\n protected fullestFirst(d: DiskUsage, all: boolean): Filesystem[] {\n const free = (f: Filesystem) => (f.totalBytes > 0 ? f.availableBytes / f.totalBytes : 1);\n const sizable = (f: Filesystem) => Number(f.totalBytes >= 1024 ** 3);\n const sorted = [...d.filesystems].sort((a, b) => Number(this.low(b)) - Number(this.low(a)) || sizable(b) - sizable(a) || free(a) - free(b));\n return all ? sorted : sorted.slice(0, this.shown);\n }\n /** Under 10 % free. Small read-only images (ISO, modules, squashfs) are always full by design, so only filesystems of 1 GB or more count. */\n protected low(f: Filesystem): boolean { return f.totalBytes >= 1024 ** 3 && f.availableBytes / f.totalBytes < 0.1; }\n protected bytes(n: number | null) { return formatBytes(n); }\n protected uptime(s: number) { return formatUptime(s); }\n protected json(v: unknown) { return JSON.stringify(v, null, 2); }\n\n /** The form's values, typed as the action declares them; an empty optional one left out. The API and the agent check them again. */\n private parameters(): Record<string, unknown> {\n if (this.action() === 'agent.update') return { version: this.version };\n const values = this.values();\n const out: Record<string, unknown> = {};\n for (const p of this.selected()?.parameters ?? []) {\n const v = values[p.name];\n if (p.type === 'boolean') { if (v === true || p.required) out[p.name] = v === true; continue; }\n if (v === undefined || v === null || v === '') continue;\n out[p.name] = p.type === 'integer' ? Number(v) : String(v).trim();\n }\n return out;\n }\n\n /** Whether it fixed what it was for: only health from telemetry after the action says so, never the agent. */\n protected verificationText(verification: string): string {\n switch (verification) {\n case 'Verifying': return 'Watching health for recovery';\n case 'Verified': return 'Recovery confirmed by health';\n case 'NotVerified': return 'Recovery not confirmed';\n default: return verification;\n }\n }\n\n protected approvalText(policy: string): string {\n switch (policy) {\n case 'None': return 'runs when asked';\n case 'Admin': return 'needs an admin: an admin\\'s request runs at once, an operator\\'s waits for an admin to approve it';\n default: return 'needs a second person: an admin other than whoever asks approves it';\n }\n }\n\n /** What needs no one else runs; what needs approval becomes a request, which runs once approved. */\n protected issue() {\n const action = this.action();\n this.issuing.set(true);\n this.issueError.set('');\n this.issued.set('');\n const failed = (e: unknown) => {\n this.issuing.set(false);\n this.issueError.set((e as { status?: number }).status === 403 ? 'Asking an agent needs the operator or admin role.' : problemText(e));\n };\n if (!this.needsApproval()) {\n this.api.issueCommand(this.id(), action, this.parameters()).subscribe({ next: () => { this.issuing.set(false); this.commands.reload(); }, error: failed });\n return;\n }\n const host = this.watchHost && this.selected()?.changing ? this.agent.value()?.resourceId : null;\n this.api.requestAction(this.id(), action, this.parameters(), this.requestReason.trim(), host ? { type: 'Host', id: host } : null).subscribe({\n next: r => {\n this.issuing.set(false);\n this.requestReason = '';\n this.issued.set(r.state !== 'Issued' ? 'Requested: it runs once approved, on the Approvals page.' : r.policy === 'None' ? 'Needs no approval as asked: running.' : 'Approved by your role: running.');\n this.requests.reload();\n this.commands.reload();\n this.approvalCount.refresh();\n },\n error: failed,\n });\n }\n\n protected cancelRequest(id: string) {\n this.api.cancelRequest(id).subscribe({ next: () => { this.requests.reload(); this.approvalCount.refresh(); }, error: e => this.issueError.set(problemText(e)) });\n }\n\n protected loadOlder() {\n const cursor = this.nextCursor();\n if (!cursor) return;\n this.api.agentCommands(this.id(), cursor).subscribe({\n next: page => this.older.update(o => ({ items: [...(o?.items ?? []), ...page.items], cursor: page.nextCursor })),\n error: e => this.issueError.set(problemText(e)),\n });\n }\n\n /** A token for this host to enroll again with. Admins only; shown once. */\n protected reenroll(hostname: string) {\n this.creating.set(true);\n this.reenrollError.set('');\n this.copied.set('');\n this.api.createEnrollmentToken(`re-enroll ${hostname}`, 60).subscribe({\n next: t => { this.creating.set(false); this.token.set(t); },\n error: e => { this.creating.set(false); this.reenrollError.set((e as { status?: number }).status === 403 ? 'Enrolling an agent needs the admin role.' : problemText(e)); },\n });\n }\n\n protected copy(text: string) {\n copyText(text, document.querySelector('[data-testid=reenroll-token-value]')).then(done => this.copied.set(done));\n }\n\n protected revoke() {\n if (!this.confirming()) { this.confirming.set(true); return; }\n this.revoking.set(true);\n this.revokeError.set('');\n this.api.revokeAgent(this.id(), this.reason.trim()).subscribe({\n next: () => { this.revoking.set(false); this.confirming.set(false); this.agent.reload(); this.commands.reload(); },\n error: e => { this.revoking.set(false); this.revokeError.set((e as { status?: number }).status === 403 ? 'Revoking an agent needs the admin role.' : problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA,MAAM,UAAU,CAAC,WAAW,WAAW;AACvC,MAAM,SAAiC;CACrC,gBAAgB;CAAgB,cAAc;CAAc,oBAAoB;CAAoB,gBAAgB;CACpH,mBAAmB;CAAqB,iBAAiB;CAAsB,sBAAsB;AACtG;AACD,MAAM,mBAA2C;CAC/C,YAAY;CAAwB,MAAM;CAAQ,MAAM;CAAQ,WAAW;CAAa,SAAS;CAAW,QAAQ;CACpH,WAAW;CAAoC,QAAQ;CAAsC,UAAU;AACxG;AAED,SAAS,aAAa,SAAe;CACnC,MAAM,OAAO,KAAK,MAAM,UAAU,KAAM;CACxC,MAAM,QAAQ,KAAK,MAAO,UAAU,QAAU,IAAI;CAClD,OAAO,OAAO,IAAI,GAAG,KAAI,KAAM,MAAK,MAAO,QAAQ,IAAI,GAAG,MAAK,KAAM,KAAK,MAAO,UAAU,OAAQ,EAAE,EAAC,QAAS,GAAG,KAAK,MAAM,UAAU,EAAE,EAAC;AAC5I;AAwOA,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACvB,gBAAgB,OAAO,aAAa;CAC5C,KAAK,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAA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AAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;IAAS;GAAU;GACrM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8NX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-agent.page-DE84_XZr.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/agent.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, input, signal, untracked } from '@angular/core';\nimport { DatePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatSelectModule } from '@angular/material/select';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ApprovalCount } from '../core/approval-count';\nimport { ContextService } from '../core/context.service';\nimport { ActionParameter, AgentAction, AgentCommand, BundleSummary, EnrollmentToken } from '../core/models';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AgoPipe, ReasonPipe, copyText, formatBytes } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/** What the actions return (Juice.Observability.Agent's Diagnostics). */\ninterface HostSummary {\n hostname: string; operatingSystem: string; architecture: string; uptimeSeconds: number; processorCount: number; loadAverage: number[] | null;\n memoryTotalBytes: number | null; memoryAvailableBytes: number | null; agentVersion: string;\n}\ninterface Filesystem { mountPoint: string; format: string; totalBytes: number; freeBytes: number; availableBytes: number; }\ninterface DiskUsage { filesystems: Filesystem[]; truncated: boolean; }\ninterface TcpReachability { host: string; port: number; reachable: boolean; address: string | null; elapsedMs: number; error: string | null; }\n\nconst WAITING = ['Pending', 'Delivered'];\nconst LABELS: Record<string, string> = {\n 'host.summary': 'Host summary', 'disk.usage': 'Disk usage', 'tcp.reachability': 'TCP reachability', 'agent.update': 'Update the agent',\n 'service.restart': 'Restart a service', 'files.cleanup': 'Clean up old files', 'diagnostics.bundle': 'Diagnostic bundle',\n};\nconst PARAMETER_LABELS: Record<string, string> = {\n pathPrefix: 'Only under this path', host: 'Host', port: 'Port', timeoutMs: 'Wait (ms)', service: 'Service', folder: 'Folder',\n keepHours: 'Keep files from the last (hours)', dryRun: 'Dry run: only report what would go', logLines: 'Lines from each log',\n};\n\nfunction formatUptime(seconds: number): string {\n const days = Math.floor(seconds / 86_400);\n const hours = Math.floor((seconds % 86_400) / 3600);\n return days > 0 ? `${days} d ${hours} h` : hours > 0 ? `${hours} h ${Math.floor((seconds % 3600) / 60)} min` : `${Math.floor(seconds / 60)} min`;\n}\n\n/**\n * One Juice Agent: whether it's calling in, what it was asked and what it answered. Operators run the read-only diagnostics; admins update and\n * revoke it. The platform signs each command, and the agent's own allowlist on its host still decides: a refusal there shows as `Rejected`.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, MatSelectModule, ContextBar, AgoPipe, ReasonPipe],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['agents'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Agents</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ agent.value()?.hostname ?? '…' }}</h1>\n </jc-context-bar>\n @if (agent.isLoading() && !agent.value()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (agent.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (agent.value(); as a) {\n <div class=\"jc-summary\" data-testid=\"agent-summary\">\n <span class=\"jc-badge\" data-testid=\"agent-state\" [class.jc-health-healthy]=\"a.online\" [class.jc-health-offline]=\"!a.online && a.status === 'Active'\" [class.jc-health-none]=\"a.status !== 'Active'\">\n {{ a.status !== 'Active' ? a.status : a.online ? 'Online' : 'Not calling in' }}</span>\n <span>{{ a.operatingSystem }}</span>\n <span>version <span class=\"jc-mono\" data-testid=\"agent-version\">{{ a.version }}</span></span>\n <span class=\"jc-muted\">last seen {{ a.lastSeenAt | ago }}</span>\n @if (a.resourceId) { <a [routerLink]=\"['resources', a.resourceId] | jcLink\" [queryParams]=\"ctx.keep()\">Host resource</a> }\n </div>\n <p class=\"jc-muted jc-small\">Enrolled {{ a.enrolledAt | date: 'MMM d, y, HH:mm' }} by {{ a.enrolledBy }}. Certificate valid until {{ a.certificateNotAfter | date: 'MMM d, HH:mm' }}; the agent renews it when a third is left.</p>\n @if (a.status !== 'Active') {\n <p class=\"jc-notice\" data-testid=\"agent-revoked\">Revoked {{ a.revokedAt | date: 'MMM d, y, HH:mm' }} by {{ a.revokedBy }}: {{ a.revokeReason }}. The platform refuses its certificate for good.</p>\n @if (successor(); as s) {\n <p data-testid=\"agent-successor\">{{ a.hostname }} enrolled again {{ s.enrolledAt | date: 'MMM d, HH:mm' }} as <a [routerLink]=\"['agents', s.id] | jcLink\" [queryParams]=\"ctx.keep()\">a new agent</a>.</p>\n } @else {\n <section class=\"jc-card\" data-testid=\"reenroll\">\n <h2>Bring this host back</h2>\n <p class=\"jc-muted jc-small\">The host comes back as a new agent, with a new key: this one stays revoked, with its history. It needs a new token from an admin, put on the host.</p>\n <button mat-flat-button type=\"button\" data-testid=\"reenroll-create\" [disabled]=\"creating()\" (click)=\"reenroll(a.hostname)\">Create a token for {{ a.hostname }}</button>\n @if (reenrollError()) { <span class=\"jc-error\" data-testid=\"reenroll-error\"> {{ reenrollError() }}</span> }\n @if (token(); as t) {\n <div class=\"jc-notice\" data-testid=\"reenroll-token\">\n <p>Replace the token in the agent's token file (<span class=\"jc-mono\">Agent:EnrollmentTokenFile</span>) with this one. It works once, until {{ t.expiresAt | date: 'MMM d, HH:mm' }}, and <strong>won't be shown again</strong>.</p>\n <p class=\"jc-row\"><span class=\"jc-mono\" data-testid=\"reenroll-token-value\">{{ t.token }}</span>\n <button mat-button type=\"button\" (click)=\"copy(t.token)\">{{ copied() === 'copied' ? 'Copied' : copied() === 'selected' ? 'Selected: press Ctrl+C' : 'Copy' }}</button></p>\n <p>The agent notices it within seconds, sets its old identity aside and enrolls again: nothing else on the host changes. An agent from before 9 November doesn't: clear its data directory's identity files and restart it.</p>\n </div>\n }\n </section>\n }\n } @else {\n <section class=\"jc-card\">\n <h2>Ask the agent</h2>\n <form class=\"jc-form\" data-testid=\"command-form\" (ngSubmit)=\"issue()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Action</mat-label>\n <mat-select name=\"action\" data-testid=\"command-action\" [ngModel]=\"action()\" (ngModelChange)=\"choose($event)\">\n @for (o of actionList(); track o.name) {\n <mat-option [value]=\"o.name\" [disabled]=\"o.permitted === false\" [attr.data-testid]=\"'action-' + o.name\">\n {{ label(o.name) }}@if (o.custom) { <span class=\"jc-muted\"> · custom</span> }@if (o.permitted === false) { <span class=\"jc-muted\"> · not allowed on this host</span> }\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n @if (action() === 'agent.update') {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Version</mat-label>\n <mat-select name=\"version\" data-testid=\"command-version\" [(ngModel)]=\"version\">\n @for (p of packages.value()?.items ?? []; track p.version) { <mat-option [value]=\"p.version\">{{ p.version }}</mat-option> }\n </mat-select>\n </mat-form-field>\n @if (packages.value()?.items?.length === 0) { <span class=\"jc-muted jc-small\">No signed packages are offered: see Agents:PackageDirectory.</span> }\n } @else {\n @for (p of selected()?.parameters ?? []; track p.name) {\n @if (p.type === 'boolean') {\n <mat-checkbox [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] === true\" (ngModelChange)=\"set(p.name, $event)\">{{ title(p) }}</mat-checkbox>\n } @else if (p.allowed?.length) {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-md]=\"p.type !== 'string'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <mat-select [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n @if (!p.required) { <mat-option value=\"\">Any</mat-option> }\n @for (v of p.allowed; track v) { <mat-option [value]=\"v\">{{ v }}</mat-option> }\n </mat-select>\n </mat-form-field>\n } @else {\n <mat-form-field subscriptSizing=\"dynamic\" [class.jc-field-sm]=\"p.type === 'integer'\" [class.jc-field-wide]=\"p.type === 'string'\"><mat-label>{{ title(p) }}</mat-label>\n <input matInput [type]=\"p.type === 'integer' ? 'number' : 'text'\" [name]=\"p.name\" [attr.data-testid]=\"'command-param-' + p.name\" [attr.min]=\"p.minimum\" [attr.max]=\"p.maximum\"\n [attr.maxlength]=\"p.maxLength\" [placeholder]=\"p.description ?? ''\" [ngModel]=\"values()[p.name] ?? ''\" (ngModelChange)=\"set(p.name, $event)\">\n </mat-form-field>\n }\n }\n }\n @if (needsApproval()) {\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why (for whoever approves it)</mat-label>\n <input matInput name=\"requestReason\" data-testid=\"request-reason\" maxlength=\"500\" [(ngModel)]=\"requestReason\">\n </mat-form-field>\n @if (selected()?.changing && agent.value()?.resourceId) {\n <mat-checkbox name=\"watchHost\" data-testid=\"request-watch-host\" [(ngModel)]=\"watchHost\">Fix this host's health: run only while it's unhealthy, and confirm recovery after</mat-checkbox>\n }\n }\n <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"command-issue\" [disabled]=\"issuing() || selected()?.permitted === false\">{{ needsApproval() ? 'Request' : action() === 'agent.update' ? 'Update' : 'Run' }}</button>\n @if (issueError()) { <span class=\"jc-error\" data-testid=\"command-error\">{{ issueError() }}</span> }\n @if (issued()) { <span class=\"jc-muted\" data-testid=\"command-issued\">{{ issued() }}</span> }\n </div>\n @if (selected(); as s) {\n <div class=\"jc-muted jc-small jc-form-actions\" data-testid=\"command-hint\">\n <div>{{ s.description }} <span data-testid=\"command-approval\">{{ s.risk }} risk: {{ approvalText(s.approval) }}.</span></div>\n @if (s.limits.length) { <div data-testid=\"command-limits\">On this host: {{ s.limits.join('; ') }}.</div> }\n </div>\n }\n </form>\n @if (actions.value(); as list) {\n @if (!list.reportedAt) {\n <p class=\"jc-notice\" data-testid=\"actions-not-reported\">This agent doesn't report what its host allows (it's older than this platform): the list shows the built-in actions, and one its host doesn't permit comes back <strong>Rejected</strong>.</p>\n } @else {\n <p class=\"jc-muted jc-small\">As the agent reported {{ list.reportedAt | ago }}, when it started. Its host still checks every command.</p>\n }\n }\n </section>\n }\n\n @if (requestList().length) {\n <section class=\"jc-card\" data-testid=\"requests\">\n <h2>Requests</h2>\n <table class=\"jc-table\">\n <thead><tr><th>Asked</th><th>Action</th><th>By, and why</th><th>State</th><th>Decided</th><th></th></tr></thead>\n <tbody>\n @for (r of requestList(); track r.id) {\n <tr [attr.data-testid]=\"'request-' + r.id\">\n <td class=\"jc-nowrap\">{{ r.requestedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ r.action }}</strong><div class=\"jc-muted jc-small\">{{ r.risk }} risk</div></td>\n <td>{{ r.requestedBy }}<div class=\"jc-small\">{{ r.reason }}</div></td>\n <td class=\"jc-nowrap\"><span class=\"jc-badge\" [class.jc-health-degraded]=\"r.state === 'Pending'\" [class.jc-health-healthy]=\"r.state === 'Issued'\"\n [class.jc-health-none]=\"r.state !== 'Pending' && r.state !== 'Issued'\" data-testid=\"request-state\">{{ r.state === 'Pending' ? 'Waiting for approval' : r.state }}</span>\n @if (r.state === 'Pending') { <div class=\"jc-muted jc-small\">until {{ r.expiresAt | date: 'HH:mm' }}</div> }\n @if (r.verification && r.verification !== 'None') {\n <div class=\"jc-small\" data-testid=\"request-verification\" [class.jc-error]=\"r.verification === 'NotVerified'\" [title]=\"r.verificationNote ?? ''\">{{ verificationText(r.verification) }}</div>\n }</td>\n <td class=\"jc-small\">@if (r.decidedBy) { {{ r.decidedBy }}, {{ r.decidedAt | date: 'HH:mm' }} }@if (r.comment) { <div>{{ r.comment }}</div> }</td>\n <td class=\"jc-row-actions\">@if (r.state === 'Pending') { <button mat-button type=\"button\" [attr.data-testid]=\"'request-cancel-' + r.id\" (click)=\"cancelRequest(r.id)\">Cancel</button> }</td>\n </tr>\n }\n </tbody>\n </table>\n </section>\n }\n\n <section class=\"jc-card\" data-testid=\"commands\">\n <h2>Commands</h2>\n @if (commands.error()) { <p class=\"jc-error\">{{ commandsError() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Issued</th><th>Action</th><th>By</th><th>State</th><th>Answer</th></tr></thead>\n <tbody>\n @for (c of allCommands(); track c.id) {\n <tr [attr.data-testid]=\"'command-' + c.id\">\n <td class=\"jc-nowrap\">{{ c.issuedAt | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ c.action }}</strong>@if (describe(c); as d) { <div class=\"jc-small jc-mono\">{{ d }}</div> }</td>\n <td>{{ c.issuedBy }}</td>\n <td class=\"jc-nowrap\">\n <span class=\"jc-badge\" [class.jc-health-healthy]=\"c.state === 'Succeeded'\" [class.jc-health-unhealthy]=\"c.state === 'Failed' || c.state === 'Rejected'\"\n [class.jc-health-degraded]=\"waiting(c)\" [class.jc-health-none]=\"c.state === 'Expired' || c.state === 'Cancelled'\" data-testid=\"command-state\">{{ c.state }}</span>\n @if (c.durationMs !== null) { <div class=\"jc-muted jc-small\">{{ c.durationMs }} ms</div> }\n </td>\n <td class=\"jc-small\" data-testid=\"command-answer\">\n @if (c.reason) { <div [class.jc-bad]=\"c.state !== 'Succeeded'\">{{ c.reason | reason }}</div> }\n @if (c.state === 'Succeeded' && c.result) {\n @switch (c.action) {\n @case ('host.summary') {\n @if (summary(c); as h) {\n <div>{{ h.hostname }} · {{ h.operatingSystem }} {{ h.architecture }} · up {{ uptime(h.uptimeSeconds) }}</div>\n <div>{{ h.processorCount }} CPUs@if (h.loadAverage) { · load {{ h.loadAverage.join(' ') }} }@if (h.memoryTotalBytes) { · memory {{ bytes(h.memoryAvailableBytes) }} of {{ bytes(h.memoryTotalBytes) }} available }</div>\n }\n }\n @case ('disk.usage') {\n @if (disk(c); as d) {\n <table class=\"jc-kv\" data-testid=\"disk-result\">\n @for (f of fullestFirst(d, expanded().has(c.id)); track f.mountPoint) {\n <tr [class.jc-bad]=\"low(f)\">\n <td class=\"jc-mono\">{{ f.mountPoint }}</td><td>{{ f.format }}</td><td class=\"jc-nowrap\">{{ bytes(f.availableBytes) }} free of {{ bytes(f.totalBytes) }}</td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No filesystems there.</td></tr> }\n </table>\n @if (d.filesystems.length > shown) {\n <button mat-button type=\"button\" [attr.data-testid]=\"'disk-toggle-' + c.id\" (click)=\"toggle(c.id)\">\n {{ expanded().has(c.id) ? 'Show the fullest ' + shown : 'Show all ' + d.filesystems.length }}</button>\n }\n @if (d.truncated) { <div class=\"jc-muted\">More filesystems than the agent reports at once.</div> }\n }\n }\n @case ('tcp.reachability') {\n @if (tcp(c); as t) {\n @if (t.reachable) { <div>Reachable at {{ t.address }} in {{ t.elapsedMs }} ms</div> }\n @else { <div class=\"jc-bad\">Not reachable after {{ t.elapsedMs }} ms: {{ t.error }}</div> }\n }\n }\n @case ('diagnostics.bundle') {\n @if (bundle(c); as b) {\n <div data-testid=\"bundle-result\">{{ bytes(b.sizeBytes) }} zip: {{ b.entries.length }} files@if (b.redacted) { · {{ b.redacted }} {{ b.redacted === 1 ? 'value' : 'values' }} redacted }\n <button mat-button type=\"button\" [attr.data-testid]=\"'bundle-download-' + c.id\" [disabled]=\"downloading() === b.bundleId\" (click)=\"download(b)\">Download</button>\n </div>\n @for (s of b.skipped; track s) { <div class=\"jc-muted\">Left out: {{ s }}</div> }\n @if (downloadErrors()[b.bundleId]; as e) { <div class=\"jc-error\" [attr.data-testid]=\"'bundle-error-' + c.id\">{{ e }}</div> }\n }\n }\n @default {\n @if (flat(c.result); as rows) {\n <table class=\"jc-kv\" data-testid=\"custom-result\">@for (r of rows; track r[0]) { <tr><td>{{ r[0] }}</td><td class=\"jc-mono\">{{ r[1] }}</td></tr> }</table>\n } @else { <pre class=\"jc-mono\" style=\"white-space: pre-wrap; margin: 0\" data-testid=\"custom-result\">{{ json(c.result) }}</pre> }\n }\n }\n }\n @if (waiting(c)) { <div class=\"jc-muted\">{{ c.state === 'Pending' ? 'Waiting for the agent to call in' : 'Handed to the agent' }}, until {{ c.expiresAt | date: 'HH:mm:ss' }}</div> }\n </td>\n </tr>\n } @empty { <tr><td colspan=\"5\" class=\"jc-muted\">Nothing asked yet.</td></tr> }\n </tbody>\n </table>\n @if (nextCursor()) { <button mat-button type=\"button\" data-testid=\"commands-older\" (click)=\"loadOlder()\">Older</button> }\n </section>\n\n @if (a.status === 'Active') {\n <section class=\"jc-card\">\n <h2>Revoke</h2>\n <p class=\"jc-muted jc-small\">The agent stops at its next call: the platform refuses its certificate from then on, and commands still waiting are cancelled. It can't be undone; the host would enroll again with a new token.</p>\n <form class=\"jc-form\" (ngSubmit)=\"revoke()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Why</mat-label><input matInput name=\"reason\" data-testid=\"revoke-reason\" [(ngModel)]=\"reason\" maxlength=\"500\" (ngModelChange)=\"confirming.set(false)\"></mat-form-field>\n @if (confirming()) {\n <button mat-flat-button color=\"warn\" type=\"submit\" data-testid=\"revoke-confirm\" [disabled]=\"revoking()\">Revoke {{ a.hostname }}</button>\n <button mat-button type=\"button\" (click)=\"confirming.set(false)\">Cancel</button>\n } @else {\n <button mat-stroked-button type=\"submit\" data-testid=\"revoke\" [disabled]=\"!reason.trim()\">Revoke</button>\n }\n @if (revokeError()) { <span class=\"jc-error\" data-testid=\"revoke-error\">{{ revokeError() }}</span> }\n </form>\n </section>\n }\n }`,\n})\nexport class AgentPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n private readonly approvalCount = inject(ApprovalCount);\n readonly id = input.required<string>();\n protected readonly action = signal('host.summary');\n /** The form's values for the chosen action, by parameter name. */\n protected readonly values = signal<Record<string, unknown>>({});\n protected readonly issuing = signal(false);\n protected readonly issueError = signal('');\n protected readonly confirming = signal(false);\n protected readonly revoking = signal(false);\n protected readonly revokeError = signal('');\n protected version = '';\n protected reason = '';\n protected requestReason = '';\n /** Aim the request at this agent's host: checked unhealthy before it runs, and watched for recovery after. */\n protected watchHost = false;\n /** What happened to the last request, when it didn't simply run. */\n protected readonly issued = signal('');\n protected readonly needsApproval = computed(() => (this.selected()?.approval ?? 'None') !== 'None');\n protected readonly requests = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.actionRequests({ agentId: params, limit: 20 }) });\n protected readonly requestList = computed(() => this.requests.value()?.items ?? []);\n protected readonly creating = signal(false);\n protected readonly reenrollError = signal('');\n protected readonly token = signal<EnrollmentToken | null>(null);\n protected readonly copied = signal<'' | 'copied' | 'selected'>('');\n\n /** For a revoked agent: the active one its host enrolled as since, if any. */\n private readonly everyone = apiResource({ params: () => this.agent.value()?.status === 'Revoked' || undefined, stream: () => this.api.agents(true) });\n protected readonly successor = computed(() => {\n const revoked = this.agent.value();\n if (!revoked?.revokedAt) return undefined;\n return (this.everyone.value()?.items ?? []).find(a => a.status === 'Active' && a.hostname === revoked.hostname && Date.parse(a.enrolledAt) > Date.parse(revoked.revokedAt!));\n });\n\n /** What the agent reported it can run, with its host's bounds: the menu and the form come from it, custom actions included. */\n protected readonly actions = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentActions(params) });\n protected readonly actionList = computed(() => this.actions.value()?.items ?? []);\n protected readonly selected = computed<AgentAction | undefined>(() => this.actionList().find(a => a.name === this.action()));\n\n protected readonly agent = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agent(params) });\n protected readonly error = computed(() => problemText(this.agent.error()));\n protected readonly commands = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.agentCommands(params) });\n protected readonly commandsError = computed(() => problemText(this.commands.error()));\n /** Asked for only once someone picks an update, since only admins can use it. */\n protected readonly packages = apiResource({ params: () => this.action() === 'agent.update' || undefined, stream: () => this.api.agentPackages() });\n private readonly older = signal<{ items: AgentCommand[]; cursor: string | null } | null>(null);\n protected readonly allCommands = computed(() => {\n const first = this.commands.value()?.items ?? [];\n const seen = new Set(first.map(c => c.id));\n return [...first, ...(this.older()?.items ?? []).filter(c => !seen.has(c.id))];\n });\n protected readonly nextCursor = computed(() => this.older() ? this.older()!.cursor : this.commands.value()?.nextCursor ?? null);\n\n constructor() {\n // Once the list is in, start on an action the host permits, with its defaults filled in.\n effect(() => {\n const list = this.actionList();\n if (list.length === 0) return;\n const current = list.find(a => a.name === untracked(this.action));\n if (!current || current.permitted === false) this.choose((list.find(a => a.permitted !== false) ?? list[0]).name);\n else if (Object.keys(untracked(this.values)).length === 0) this.choose(current.name);\n });\n // While a command waits, look again every 2 seconds, and at the agent too, since an update changes its version. While a request waits for\n // approval, every 5: someone else decides it.\n effect(onCleanup => {\n const running = this.allCommands().some(c => this.waiting(c));\n const deciding = this.requestList().some(r => r.state === 'Pending');\n if (!running && !deciding) return;\n const timer = setTimeout(() => { this.commands.reload(); this.agent.reload(); this.requests.reload(); }, running ? 2000 : 5000);\n onCleanup(() => clearTimeout(timer));\n });\n }\n\n protected waiting(c: AgentCommand): boolean { return WAITING.includes(c.state) && new Date(c.expiresAt).getTime() > Date.now(); }\n\n protected describe(c: AgentCommand): string {\n const p = c.parameters ?? {};\n switch (c.action) {\n case 'disk.usage': return p['pathPrefix'] ? `under ${p['pathPrefix']}` : 'all filesystems';\n case 'tcp.reachability': return `${p['host']}:${p['port']}, wait ${p['timeoutMs']} ms`;\n case 'agent.update': return `to ${p['version']}`;\n default: return Object.entries(p).map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`).join(', ');\n }\n }\n\n /** The built-ins by name as people say them; a custom action by its own name. */\n protected label(name: string): string { return LABELS[name] ?? name; }\n\n protected title(p: ActionParameter): string {\n const words = PARAMETER_LABELS[p.name] ?? p.name.replace(/([A-Z])/g, ' $1').replace(/^./, c => c.toUpperCase());\n return p.required || p.type === 'boolean' ? words : `${words} (optional)`;\n }\n\n protected choose(name: string) {\n this.action.set(name);\n this.issueError.set('');\n const defaults: Record<string, unknown> = {};\n for (const p of this.actionList().find(a => a.name === name)?.parameters ?? []) {\n if (p.default !== null) defaults[p.name] = p.type === 'integer' ? Number(p.default) : p.type === 'boolean' ? p.default === 'true' : p.default;\n else if (p.required && p.allowed?.length === 1) defaults[p.name] = p.allowed[0];\n }\n this.values.set(defaults);\n }\n\n protected set(name: string, value: unknown) { this.values.update(v => ({ ...v, [name]: value })); }\n\n /** A result of plain values reads as a table; anything nested as JSON. */\n protected flat(result: unknown): [string, string][] | null {\n if (!result || typeof result !== 'object' || Array.isArray(result)) return null;\n const entries = Object.entries(result as Record<string, unknown>);\n return entries.every(([, v]) => v === null || ['string', 'number', 'boolean'].includes(typeof v)) ? entries.map(([k, v]) => [k, v === null ? '—' : String(v)]) : null;\n }\n\n protected summary(c: AgentCommand) { return c.result as unknown as HostSummary; }\n protected bundle(c: AgentCommand) { return c.result as unknown as BundleSummary; }\n protected readonly downloading = signal<string | null>(null);\n /** A failed download's reason, by bundle: shown under that bundle only. */\n protected readonly downloadErrors = signal<Record<string, string>>({});\n\n /** Fetches the zip with the user's token and hands it to the browser as a file. */\n protected download(b: BundleSummary) {\n this.downloading.set(b.bundleId);\n this.downloadErrors.update(e => ({ ...e, [b.bundleId]: '' }));\n this.api.downloadBundle(this.id(), b.bundleId).subscribe({\n next: response => {\n this.downloading.set(null);\n const name = /filename=\"?([^\";]+)\"?/.exec(response.headers.get('content-disposition') ?? '')?.[1] ?? `juice-bundle-${b.bundleId}.zip`;\n const url = URL.createObjectURL(response.body!);\n const link = document.createElement('a');\n link.href = url;\n link.download = name;\n link.click();\n setTimeout(() => URL.revokeObjectURL(url), 10_000);\n },\n error: e => {\n this.downloading.set(null);\n const reason = e?.status === 404 ? 'The bundle is gone: bundles are kept 14 days by default.'\n : e?.status === 403 ? 'Downloading a bundle takes an operator or an admin: its log excerpts can say more than the rest of the Console.' : problemText(e);\n this.downloadErrors.update(errors => ({ ...errors, [b.bundleId]: reason }));\n },\n });\n }\n protected disk(c: AgentCommand) { return c.result as unknown as DiskUsage; }\n protected tcp(c: AgentCommand) { return c.result as unknown as TcpReachability; }\n /** A whole host can have dozens of mounts: the fullest come first, and the rest on request. */\n protected readonly shown = 8;\n protected readonly expanded = signal(new Set<string>());\n protected toggle(id: string) { this.expanded.update(s => { const next = new Set(s); if (!next.delete(id)) next.add(id); return next; }); }\n protected fullestFirst(d: DiskUsage, all: boolean): Filesystem[] {\n const free = (f: Filesystem) => (f.totalBytes > 0 ? f.availableBytes / f.totalBytes : 1);\n const sizable = (f: Filesystem) => Number(f.totalBytes >= 1024 ** 3);\n const sorted = [...d.filesystems].sort((a, b) => Number(this.low(b)) - Number(this.low(a)) || sizable(b) - sizable(a) || free(a) - free(b));\n return all ? sorted : sorted.slice(0, this.shown);\n }\n /** Under 10 % free. Small read-only images (ISO, modules, squashfs) are always full by design, so only filesystems of 1 GB or more count. */\n protected low(f: Filesystem): boolean { return f.totalBytes >= 1024 ** 3 && f.availableBytes / f.totalBytes < 0.1; }\n protected bytes(n: number | null) { return formatBytes(n); }\n protected uptime(s: number) { return formatUptime(s); }\n protected json(v: unknown) { return JSON.stringify(v, null, 2); }\n\n /** The form's values, typed as the action declares them; an empty optional one left out. The API and the agent check them again. */\n private parameters(): Record<string, unknown> {\n if (this.action() === 'agent.update') return { version: this.version };\n const values = this.values();\n const out: Record<string, unknown> = {};\n for (const p of this.selected()?.parameters ?? []) {\n const v = values[p.name];\n if (p.type === 'boolean') { if (v === true || p.required) out[p.name] = v === true; continue; }\n if (v === undefined || v === null || v === '') continue;\n out[p.name] = p.type === 'integer' ? Number(v) : String(v).trim();\n }\n return out;\n }\n\n /** Whether it fixed what it was for: only health from telemetry after the action says so, never the agent. */\n protected verificationText(verification: string): string {\n switch (verification) {\n case 'Verifying': return 'Watching health for recovery';\n case 'Verified': return 'Recovery confirmed by health';\n case 'NotVerified': return 'Recovery not confirmed';\n default: return verification;\n }\n }\n\n protected approvalText(policy: string): string {\n switch (policy) {\n case 'None': return 'runs when asked';\n case 'Admin': return 'needs an admin: an admin\\'s request runs at once, an operator\\'s waits for an admin to approve it';\n default: return 'needs a second person: an admin other than whoever asks approves it';\n }\n }\n\n /** What needs no one else runs; what needs approval becomes a request, which runs once approved. */\n protected issue() {\n const action = this.action();\n this.issuing.set(true);\n this.issueError.set('');\n this.issued.set('');\n const failed = (e: unknown) => {\n this.issuing.set(false);\n this.issueError.set((e as { status?: number }).status === 403 ? 'Asking an agent needs the operator or admin role.' : problemText(e));\n };\n if (!this.needsApproval()) {\n this.api.issueCommand(this.id(), action, this.parameters()).subscribe({ next: () => { this.issuing.set(false); this.commands.reload(); }, error: failed });\n return;\n }\n const host = this.watchHost && this.selected()?.changing ? this.agent.value()?.resourceId : null;\n this.api.requestAction(this.id(), action, this.parameters(), this.requestReason.trim(), host ? { type: 'Host', id: host } : null).subscribe({\n next: r => {\n this.issuing.set(false);\n this.requestReason = '';\n this.issued.set(r.state !== 'Issued' ? 'Requested: it runs once approved, on the Approvals page.' : r.policy === 'None' ? 'Needs no approval as asked: running.' : 'Approved by your role: running.');\n this.requests.reload();\n this.commands.reload();\n this.approvalCount.refresh();\n },\n error: failed,\n });\n }\n\n protected cancelRequest(id: string) {\n this.api.cancelRequest(id).subscribe({ next: () => { this.requests.reload(); this.approvalCount.refresh(); }, error: e => this.issueError.set(problemText(e)) });\n }\n\n protected loadOlder() {\n const cursor = this.nextCursor();\n if (!cursor) return;\n this.api.agentCommands(this.id(), cursor).subscribe({\n next: page => this.older.update(o => ({ items: [...(o?.items ?? []), ...page.items], cursor: page.nextCursor })),\n error: e => this.issueError.set(problemText(e)),\n });\n }\n\n /** A token for this host to enroll again with. Admins only; shown once. */\n protected reenroll(hostname: string) {\n this.creating.set(true);\n this.reenrollError.set('');\n this.copied.set('');\n this.api.createEnrollmentToken(`re-enroll ${hostname}`, 60).subscribe({\n next: t => { this.creating.set(false); this.token.set(t); },\n error: e => { this.creating.set(false); this.reenrollError.set((e as { status?: number }).status === 403 ? 'Enrolling an agent needs the admin role.' : problemText(e)); },\n });\n }\n\n protected copy(text: string) {\n copyText(text, document.querySelector('[data-testid=reenroll-token-value]')).then(done => this.copied.set(done));\n }\n\n protected revoke() {\n if (!this.confirming()) { this.confirming.set(true); return; }\n this.revoking.set(true);\n this.revokeError.set('');\n this.api.revokeAgent(this.id(), this.reason.trim()).subscribe({\n next: () => { this.revoking.set(false); this.confirming.set(false); this.agent.reload(); this.commands.reload(); },\n error: e => { this.revoking.set(false); this.revokeError.set((e as { status?: number }).status === 403 ? 'Revoking an agent needs the admin role.' : problemText(e)); },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6BA,MAAM,UAAU,CAAC,WAAW,WAAW;AACvC,MAAM,SAAiC;CACrC,gBAAgB;CAAgB,cAAc;CAAc,oBAAoB;CAAoB,gBAAgB;CACpH,mBAAmB;CAAqB,iBAAiB;CAAsB,sBAAsB;AACtG;AACD,MAAM,mBAA2C;CAC/C,YAAY;CAAwB,MAAM;CAAQ,MAAM;CAAQ,WAAW;CAAa,SAAS;CAAW,QAAQ;CACpH,WAAW;CAAoC,QAAQ;CAAsC,UAAU;AACxG;AAED,SAAS,aAAa,SAAe;CACnC,MAAM,OAAO,KAAK,MAAM,UAAU,KAAM;CACxC,MAAM,QA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IAAA,MAAA;IAAA,MAAtK;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA0I;IAAO,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAgO1L,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAlOrB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;IAAS;GAAU;GACrM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8NX,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { b as copyText, c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
2
+ import { b as copyText, c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, signal } from "@angular/core";
5
- import { RouterLink } from "@angular/router";
6
5
  import { DatePipe } from "@angular/common";
6
+ import { RouterLink } from "@angular/router";
7
7
  import * as i1 from "@angular/forms";
8
8
  import { FormsModule } from "@angular/forms";
9
9
  import * as i2 from "@angular/material/button";
@@ -410,4 +410,4 @@ i0.ɵɵngDeclareClassMetadata({
410
410
  });
411
411
  export { AgentsPage };
412
412
 
413
- //# sourceMappingURL=juice-js-observability-agents.page-D-z66p2m.mjs.map
413
+ //# sourceMappingURL=juice-js-observability-agents.page-C-o-OXai.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-agents.page-D-z66p2m.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/agents.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { 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 { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Agent, EnrollmentToken } from '../core/models';\nimport { AgoPipe, copyText } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/**\n * Juice Agents (roadmap Phase 7): which hosts have one, whether it's calling in, its version and when its certificate runs out. An admin creates the\n * one-time token a new agent enrolls with; it's shown here once, since the platform keeps only its hash.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Agents</h1>\n <span class=\"jc-spacer\"></span>\n <mat-checkbox [ngModel]=\"showAll()\" (ngModelChange)=\"showAll.set($event)\" data-testid=\"agents-all\">Include revoked</mat-checkbox>\n </jc-context-bar>\n @if (agents.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (agents.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Enroll an agent</h2>\n <form class=\"jc-form\" data-testid=\"enroll-form\" (ngSubmit)=\"createToken()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>For (host or purpose)</mat-label><input matInput name=\"purpose\" data-testid=\"enroll-purpose\" [(ngModel)]=\"purpose\" maxlength=\"200\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Valid for (min)</mat-label><input matInput type=\"number\" min=\"5\" max=\"1440\" name=\"minutes\" [(ngModel)]=\"minutes\"></mat-form-field>\n <button mat-flat-button type=\"submit\" data-testid=\"enroll-create\" [disabled]=\"creating()\">Create token</button>\n @if (tokenError()) { <span class=\"jc-error\" data-testid=\"enroll-error\">{{ tokenError() }}</span> }\n </form>\n @if (token(); as t) {\n <div class=\"jc-notice\" data-testid=\"enroll-token\">\n <p>Give this to the agent as <span class=\"jc-mono\">Agent:EnrollmentTokenFile</span>. It works once, until {{ t.expiresAt | date: 'MMM d, HH:mm' }}, and <strong>won't be shown again</strong>.</p>\n <p class=\"jc-row\"><span class=\"jc-mono\" data-testid=\"enroll-token-value\">{{ t.token }}</span>\n <button mat-button type=\"button\" data-testid=\"enroll-copy\" (click)=\"copy(t.token)\">{{ copied() === 'copied' ? 'Copied' : copied() === 'selected' ? 'Selected: press Ctrl+C' : 'Copy' }}</button>\n <button mat-button type=\"button\" (click)=\"token.set(null)\">Done</button></p>\n </div>\n }\n <p class=\"jc-muted jc-small\">The token only lets an agent enroll. What it may do is set on its host, in <span class=\"jc-mono\">Allowlist:Actions</span>: an empty list permits nothing.</p>\n </section>\n\n <table class=\"jc-table\" data-testid=\"agents\">\n <thead><tr><th>Host</th><th>State</th><th>Last seen</th><th>Version</th><th>Certificate until</th><th>Enrolled</th></tr></thead>\n <tbody>\n @for (a of agents.value()?.items ?? []; track a.id) {\n <tr [class.jc-muted]=\"a.status !== 'Active'\">\n <td><a [routerLink]=\"['agents', a.id] | jcLink\" [queryParams]=\"ctx.keep()\" [attr.data-testid]=\"'agent-' + a.hostname\"><strong>{{ a.hostname }}</strong></a>\n <div class=\"jc-muted jc-small\">{{ a.operatingSystem }}</div></td>\n <td>\n <span class=\"jc-badge\" [class.jc-health-healthy]=\"a.online\" [class.jc-health-offline]=\"!a.online && a.status === 'Active'\" [class.jc-health-none]=\"a.status !== 'Active'\">{{ state(a) }}</span>\n @if (a.status !== 'Active' && a.revokeReason) { <div class=\"jc-small\">{{ a.revokeReason }}</div> }\n </td>\n <td class=\"jc-nowrap\">{{ a.lastSeenAt | ago }}</td>\n <td class=\"jc-mono jc-small\">{{ a.version }}</td>\n <td class=\"jc-nowrap\" [class.jc-bad]=\"a.status === 'Active' && expiring(a)\">{{ a.certificateNotAfter | date: 'MMM d, HH:mm' }}</td>\n <td class=\"jc-small\">{{ a.enrolledAt | date: 'MMM d' }} by {{ a.enrolledBy }}</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">No agents{{ showAll() ? '' : ' active' }}. Create a token above and start one on a host.</td></tr> }\n </tbody>\n </table>`,\n})\nexport class AgentsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly showAll = signal(false);\n protected readonly creating = signal(false);\n protected readonly tokenError = signal('');\n protected readonly token = signal<EnrollmentToken | null>(null);\n protected readonly copied = signal<'' | 'copied' | 'selected'>('');\n protected purpose = '';\n protected minutes = 60;\n\n protected readonly agents = apiResource({ params: () => this.showAll(), stream: ({ params }) => this.api.agents(params) });\n protected readonly error = computed(() => problemText(this.agents.error()));\n\n protected state(a: Agent): string { return a.status !== 'Active' ? a.status : a.online ? 'Online' : 'Not calling in'; }\n\n /** An active agent renews when a third of its certificate is left; one with less than a day left has missed its renewals. */\n protected expiring(a: Agent): boolean { return new Date(a.certificateNotAfter).getTime() - Date.now() < 86_400_000; }\n\n protected createToken() {\n this.creating.set(true);\n this.tokenError.set('');\n this.copied.set('');\n this.api.createEnrollmentToken(this.purpose.trim(), this.minutes || 60).subscribe({\n next: t => { this.creating.set(false); this.token.set(t); this.purpose = ''; },\n error: e => { this.creating.set(false); this.tokenError.set((e as { status?: number }).status === 403 ? 'Enrolling an agent needs the admin role.' : problemText(e)); },\n });\n }\n\n protected copy(text: string) {\n copyText(text, document.querySelector('[data-testid=enroll-token-value]')).then(done => this.copied.set(done));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyEA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,UAAU,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,WAAW,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CACxB,aAAa,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,QAAQ,OAA+B,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC5C,SAAS,OAAmC,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,UAAU;CACV,UAAU;CAED,SAAS,YAAY;EAAE,cAAc,KAAK,QAAO;EAAI,SAAS,EAAE,aAAa,KAAK,IAAI,OAAO,MAAM;CAAC,CAAE;CACtG,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAEjE,MAAM,GAAQ;EAAY,OAAO,EAAE,WAAW,WAAW,EAAE,SAAS,EAAE,SAAS,WAAW;CAAkB;CAG5G,SAAS,GAAQ;EAAa,OAAO,IAAI,KAAK,EAAE,mBAAmB,CAAC,CA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A;GAAA;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAc;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,UAAA,CAAA,UAAA;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,MAArJ;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAyH;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAiD7J,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAnDtB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAY;GAAO;GACxK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-agents.page-C-o-OXai.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/agents.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { 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 { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { Agent, EnrollmentToken } from '../core/models';\nimport { AgoPipe, copyText } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/**\n * Juice Agents (roadmap Phase 7): which hosts have one, whether it's calling in, its version and when its certificate runs out. An admin creates the\n * one-time token a new agent enrolls with; it's shown here once, since the platform keeps only its hash.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatCheckboxModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar>\n <h1>Agents</h1>\n <span class=\"jc-spacer\"></span>\n <mat-checkbox [ngModel]=\"showAll()\" (ngModelChange)=\"showAll.set($event)\" data-testid=\"agents-all\">Include revoked</mat-checkbox>\n </jc-context-bar>\n @if (agents.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (agents.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\">\n <h2>Enroll an agent</h2>\n <form class=\"jc-form\" data-testid=\"enroll-form\" (ngSubmit)=\"createToken()\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>For (host or purpose)</mat-label><input matInput name=\"purpose\" data-testid=\"enroll-purpose\" [(ngModel)]=\"purpose\" maxlength=\"200\"></mat-form-field>\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-sm\"><mat-label>Valid for (min)</mat-label><input matInput type=\"number\" min=\"5\" max=\"1440\" name=\"minutes\" [(ngModel)]=\"minutes\"></mat-form-field>\n <button mat-flat-button type=\"submit\" data-testid=\"enroll-create\" [disabled]=\"creating()\">Create token</button>\n @if (tokenError()) { <span class=\"jc-error\" data-testid=\"enroll-error\">{{ tokenError() }}</span> }\n </form>\n @if (token(); as t) {\n <div class=\"jc-notice\" data-testid=\"enroll-token\">\n <p>Give this to the agent as <span class=\"jc-mono\">Agent:EnrollmentTokenFile</span>. It works once, until {{ t.expiresAt | date: 'MMM d, HH:mm' }}, and <strong>won't be shown again</strong>.</p>\n <p class=\"jc-row\"><span class=\"jc-mono\" data-testid=\"enroll-token-value\">{{ t.token }}</span>\n <button mat-button type=\"button\" data-testid=\"enroll-copy\" (click)=\"copy(t.token)\">{{ copied() === 'copied' ? 'Copied' : copied() === 'selected' ? 'Selected: press Ctrl+C' : 'Copy' }}</button>\n <button mat-button type=\"button\" (click)=\"token.set(null)\">Done</button></p>\n </div>\n }\n <p class=\"jc-muted jc-small\">The token only lets an agent enroll. What it may do is set on its host, in <span class=\"jc-mono\">Allowlist:Actions</span>: an empty list permits nothing.</p>\n </section>\n\n <table class=\"jc-table\" data-testid=\"agents\">\n <thead><tr><th>Host</th><th>State</th><th>Last seen</th><th>Version</th><th>Certificate until</th><th>Enrolled</th></tr></thead>\n <tbody>\n @for (a of agents.value()?.items ?? []; track a.id) {\n <tr [class.jc-muted]=\"a.status !== 'Active'\">\n <td><a [routerLink]=\"['agents', a.id] | jcLink\" [queryParams]=\"ctx.keep()\" [attr.data-testid]=\"'agent-' + a.hostname\"><strong>{{ a.hostname }}</strong></a>\n <div class=\"jc-muted jc-small\">{{ a.operatingSystem }}</div></td>\n <td>\n <span class=\"jc-badge\" [class.jc-health-healthy]=\"a.online\" [class.jc-health-offline]=\"!a.online && a.status === 'Active'\" [class.jc-health-none]=\"a.status !== 'Active'\">{{ state(a) }}</span>\n @if (a.status !== 'Active' && a.revokeReason) { <div class=\"jc-small\">{{ a.revokeReason }}</div> }\n </td>\n <td class=\"jc-nowrap\">{{ a.lastSeenAt | ago }}</td>\n <td class=\"jc-mono jc-small\">{{ a.version }}</td>\n <td class=\"jc-nowrap\" [class.jc-bad]=\"a.status === 'Active' && expiring(a)\">{{ a.certificateNotAfter | date: 'MMM d, HH:mm' }}</td>\n <td class=\"jc-small\">{{ a.enrolledAt | date: 'MMM d' }} by {{ a.enrolledBy }}</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">No agents{{ showAll() ? '' : ' active' }}. Create a token above and start one on a host.</td></tr> }\n </tbody>\n </table>`,\n})\nexport class AgentsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly showAll = signal(false);\n protected readonly creating = signal(false);\n protected readonly tokenError = signal('');\n protected readonly token = signal<EnrollmentToken | null>(null);\n protected readonly copied = signal<'' | 'copied' | 'selected'>('');\n protected purpose = '';\n protected minutes = 60;\n\n protected readonly agents = apiResource({ params: () => this.showAll(), stream: ({ params }) => this.api.agents(params) });\n protected readonly error = computed(() => problemText(this.agents.error()));\n\n protected state(a: Agent): string { return a.status !== 'Active' ? a.status : a.online ? 'Online' : 'Not calling in'; }\n\n /** An active agent renews when a third of its certificate is left; one with less than a day left has missed its renewals. */\n protected expiring(a: Agent): boolean { return new Date(a.certificateNotAfter).getTime() - Date.now() < 86_400_000; }\n\n protected createToken() {\n this.creating.set(true);\n this.tokenError.set('');\n this.copied.set('');\n this.api.createEnrollmentToken(this.purpose.trim(), this.minutes || 60).subscribe({\n next: t => { this.creating.set(false); this.token.set(t); this.purpose = ''; },\n error: e => { this.creating.set(false); this.tokenError.set((e as { status?: number }).status === 403 ? 'Enrolling an agent needs the admin role.' : problemText(e)); },\n });\n }\n\n protected copy(text: string) {\n copyText(text, document.querySelector('[data-testid=enroll-token-value]')).then(done => this.copied.set(done));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyEA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,UAAU,OAAO,OAAM,GAAA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AAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,UAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAArJ;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAyH;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAiD7J,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAnDtB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAY;GAAO;GACxK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+CX,CAAA"}
@@ -1,10 +1,10 @@
1
1
  import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
- import { c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, u as KeyValueTable, y as ReasonPipe } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
3
- import { t as SuggestionsCard } from "./juice-js-observability-suggestions-CX_srxh1.mjs";
2
+ import { c as ContextBar, g as AgoPipe, h as apiResource, l as HealthBadge, o as problemText, u as KeyValueTable, y as ReasonPipe } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
3
+ import { t as SuggestionsCard } from "./juice-js-observability-suggestions-CBuNlU0Y.mjs";
4
4
  import * as i0 from "@angular/core";
5
5
  import { ChangeDetectionStrategy, Component, computed, inject, input, signal } from "@angular/core";
6
- import { RouterLink } from "@angular/router";
7
6
  import { DatePipe, LowerCasePipe } from "@angular/common";
7
+ import { RouterLink } from "@angular/router";
8
8
  import * as i1 from "@angular/forms";
9
9
  import { FormsModule } from "@angular/forms";
10
10
  import * as i2 from "@angular/material/button";
@@ -597,4 +597,4 @@ i0.ɵɵngDeclareClassMetadata({
597
597
  });
598
598
  export { AlertPage };
599
599
 
600
- //# sourceMappingURL=juice-js-observability-alert.page-DhcSGLH0.mjs.map
600
+ //# sourceMappingURL=juice-js-observability-alert.page-KyakwaUL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-alert.page-DhcSGLH0.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alert.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { DatePipe, LowerCasePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge, KeyValueTable } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { SuggestionsCard } from '../shared/suggestions';\nimport { CorrelationDecision } from '../core/models';\n\n/**\n * One alert (Console requirements §14): evidence, lifecycle history, the subject's health and reasons, the way into\n * the investigation, and acknowledgement for operators.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, LowerCasePipe, FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatProgressBarModule,\n ContextBar, HealthBadge, KeyValueTable, AgoPipe, ReasonPipe, SuggestionsCard],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Alerts</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ detail.value()?.alert?.rule ?? '…' }}</h1>\n </jc-context-bar>\n @if (detail.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (detail.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (detail.value(); as d) {\n <div class=\"jc-summary\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"d.alert.severity === 'Critical'\" [class.jc-health-degraded]=\"d.alert.severity === 'Warning'\">{{ d.alert.severity }}</span>\n <strong>{{ d.alert.state }}</strong>\n <span>{{ d.alert.subjectKey }}</span>\n @if (d.alert.noData) { <span class=\"jc-muted\">no data at the last evaluation: state kept</span> }\n @if (d.alert.subjectType === 'service' && d.alert.subjectId) {\n <a mat-flat-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment)\">Investigate</a>\n <a mat-stroked-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment, { tab: 'traces', status: 'error' })\">Error traces</a>\n }\n @for (l of d.links; track l.url) { <a mat-button [href]=\"l.url\" target=\"_blank\" rel=\"noopener\">{{ l.title }} ↗</a> }\n @if (d.alert.state !== 'Resolved') {\n <a mat-stroked-button data-testid=\"alert-open-incident\" [routerLink]=\"['incidents'] | jcLink\" [queryParams]=\"incidentLink(d.alert.id, d.alert.rule, d.alert.subjectKey)\">Open an incident</a>\n <a mat-stroked-button data-testid=\"alert-silence\" [routerLink]=\"['silences'] | jcLink\" [queryParams]=\"silenceLink(d.alert.subjectKey, d.alert.environment, d.alert.subjectType)\">Silence this</a>\n }\n </div>\n @if (notifications.value(); as n) {\n @for (s of n.silences; track s.id) {\n <p class=\"jc-notice\" data-testid=\"alert-silenced\">Notifications are held until {{ s.endsAt | date: 'MMM d, HH:mm' }}: “{{ s.comment }}” ({{ s.createdBy }}). The alert itself still fires and resolves.</p>\n }\n @for (i of n.incidents; track i.id) {\n <p>In incident <a [routerLink]=\"['incidents', i.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ i.title }}</a> ({{ i.state }})</p>\n }\n }\n <div class=\"jc-grid-2\">\n <section class=\"jc-card\"><h2>Evidence</h2><jc-kv [values]=\"d.evidence\" /></section>\n <section class=\"jc-card\">\n <h2>Subject health</h2>\n @for (h of d.subjectHealth; track h.subjectId + h.environment) {\n <p><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /> {{ h.environment }}</p>\n <ul class=\"jc-reasons\">@for (r of h.reasons; track r) { <li>{{ r | reason }}</li> }</ul>\n } @empty { <p class=\"jc-muted\">No health for this subject.</p> }\n </section>\n </div>\n <section class=\"jc-card\" data-testid=\"alert-related\">\n <h2>Around this alert</h2>\n @if (related.value(); as r) {\n <p class=\"jc-notice\" data-testid=\"alert-related-note\">{{ r.note }}</p>\n <table class=\"jc-table\"><tbody>\n @for (i of r.items; track i.type + i.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ i.at | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ i.title }}</strong>@if (i.detail) { <div class=\"jc-muted jc-small\">{{ i.detail }}</div> }</td>\n <td class=\"jc-small\"><ul class=\"jc-reasons\">@for (x of i.reasons; track x.code) { <li>{{ x.text }} <span class=\"jc-muted\">(+{{ x.points }})</span></li> }</ul></td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No changes or dependency health changes in the 2 hours before this alert.</td></tr> }\n </tbody></table>\n @if (d.alert.subjectId && d.alert.subjectType === 'service') {\n <a mat-stroked-button [routerLink]=\"['timeline'] | jcLink\" [queryParams]=\"timelineLink(d.alert.subjectId, d.alert.environment, r.breachStartedAt)\">Open the timeline</a>\n }\n }\n @if (related.error()) { <p class=\"jc-error\">{{ relatedError() }}</p> }\n </section>\n @if (d.alert.state === 'Firing' || merged()) {\n <section class=\"jc-card\" data-testid=\"alert-suggestions\">\n <h2>Suggested with this alert</h2>\n @if (merged(); as m) { <p data-testid=\"alert-suggestion-merged\">Merged into <a [routerLink]=\"['incidents', m] | jcLink\" [queryParams]=\"ctx.keep()\">the incident</a>.</p> }\n <jc-suggestions [suggestions]=\"suggestions.value()\" (decided)=\"decided($event)\" />\n @if (suggestions.error()) { <p class=\"jc-error\">{{ suggestionsError() }}</p> }\n </section>\n }\n <section class=\"jc-card\" data-testid=\"alert-notifications\">\n <h2>Notifications</h2>\n @if (notifications.value(); as n) {\n @for (e of n.escalations; track e.policy) {\n <p>Escalation <strong>{{ e.name }}</strong>: {{ e.stepsSent }} of {{ e.steps }} steps sent, {{ e.state | lowercase }}@if (e.stopReason) { ({{ e.stopReason | reason }}) }@if (e.nextAt) {, next at {{ e.nextAt | date: 'HH:mm:ss' }} }</p>\n }\n <table class=\"jc-table\">\n <thead><tr><th>To</th><th>Event</th><th>Status</th><th>Attempts</th><th>Detail</th><th>When</th></tr></thead>\n <tbody>\n @for (x of n.deliveries; track x.delivery.id) {\n <tr>\n <td>{{ x.endpointKey }} <span class=\"jc-muted jc-small\">{{ x.kind }}</span></td>\n <td>{{ x.delivery.event }}@if (x.delivery.escalationStep) { step {{ x.delivery.escalationStep }} }</td>\n <td [class.jc-bad]=\"x.delivery.status === 'Failed'\">{{ x.delivery.status }}</td>\n <td>{{ x.delivery.attempts }}</td>\n <td class=\"jc-small\">{{ x.delivery.lastError }}@if (x.delivery.nextAttemptAt && x.delivery.status === 'Retrying') { · next {{ x.delivery.nextAttemptAt | date: 'HH:mm:ss' }} }</td>\n <td class=\"jc-nowrap\">{{ x.delivery.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">Nothing sent about this alert: no channel takes it.</td></tr> }\n </tbody>\n </table>\n }\n @if (notifications.error()) { <p class=\"jc-error\">{{ notificationsError() }}</p> }\n </section>\n <section class=\"jc-card\">\n <h2>History</h2>\n <table class=\"jc-table\"><tbody>\n @for (t of d.history; track t.at + t.to) {\n <tr><td>{{ t.at | date: 'MMM d, HH:mm:ss' }}</td><td>{{ t.from ?? '—' }} → <strong>{{ t.to }}</strong></td><td>{{ t.reason | reason }}</td><td>{{ t.value ?? '—' }}</td></tr>\n }\n </tbody></table>\n </section>\n <section class=\"jc-card\">\n <h2>Acknowledgement</h2>\n @if (d.alert.acknowledgedAt) {\n <p>By <strong>{{ d.alert.acknowledgedBy }}</strong> {{ d.alert.acknowledgedAt | ago }}@if (d.acknowledgeComment) {: “{{ d.acknowledgeComment }}”}</p>\n } @else if (d.alert.state !== 'Resolved') {\n <form (ngSubmit)=\"acknowledge()\" class=\"jc-filter-form\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Comment</mat-label><input matInput name=\"comment\" [(ngModel)]=\"comment\" maxlength=\"1000\"></mat-form-field>\n <button mat-flat-button type=\"submit\" [disabled]=\"sending()\">Acknowledge</button>\n </form>\n @if (ackError()) { <p class=\"jc-error\">{{ ackError() }}</p> }\n } @else { <p class=\"jc-muted\">Resolved without acknowledgement.</p> }\n </section>\n }`,\n})\nexport class AlertPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly id = input.required<string>();\n protected comment = '';\n protected readonly sending = signal(false);\n protected readonly ackError = signal('');\n\n protected readonly detail = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alert(params) });\n protected readonly error = computed(() => problemText(this.detail.error()));\n protected readonly related = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.relatedToAlert(params) });\n protected readonly relatedError = computed(() => problemText(this.related.error()));\n protected readonly notifications = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alertNotifications(params) });\n protected readonly notificationsError = computed(() => problemText(this.notifications.error()));\n /** Only a firing alert is suggested with others, so only its page asks. */\n protected readonly suggestions = apiResource({\n params: () => (this.detail.value()?.alert.state === 'Firing' ? this.id() : undefined),\n stream: ({ params }) => this.api.alertSuggestions(params),\n });\n protected readonly suggestionsError = computed(() => problemText(this.suggestions.error()));\n /** The incident a suggestion on this page was merged into. Keyed by alert: the page is reused when a suggestion's link opens another alert. */\n private readonly mergedInto = signal<{ alert: string; incident: string } | null>(null);\n protected readonly merged = computed(() => (this.mergedInto()?.alert === this.id() ? this.mergedInto()!.incident : null));\n\n /** A decision, or null when one was refused because the list was stale: either way, read it again. */\n protected decided(d: CorrelationDecision | null) {\n if (d?.incidentId) this.mergedInto.set({ alert: this.id(), incident: d.incidentId });\n this.suggestions.reload();\n this.notifications.reload();\n }\n\n incidentLink(alert: string, rule: string, subject: string) { return this.ctx.keep({ alert, title: `${rule} on ${subject}` }); }\n\n /** The new-silence form, filled in for this alert's subject. */\n silenceLink(subject: string, environment: string | null, type: string) {\n const name = type === 'service' ? subject.replace(/^service:/, '').replace(/@[^@]*$/, '') : null;\n const host = type === 'host' ? subject.replace(/^host:/, '') : null;\n return this.ctx.keep({ service: name, environment, host });\n }\n\n /** The service page over the alert's environment, from shortly before the breach. */\n /** The service's timeline from 2 hours before the breach to 1 hour after. */\n timelineLink(service: string, environment: string | null, breach: string) {\n const at = new Date(breach).getTime();\n return this.ctx.keep({ service, env: environment, range: null, from: new Date(at - 2 * 3_600_000).toISOString(), to: new Date(at + 3_600_000).toISOString() });\n }\n\n investigate(environment: string | null, extra: Record<string, string> = {}) {\n const alert = this.detail.value()?.alert;\n const start = alert?.breachStartedAt ? new Date(alert.breachStartedAt).getTime() - 15 * 60_000 : null;\n const end = alert?.resolvedAt ? new Date(alert.resolvedAt).getTime() + 5 * 60_000 : Date.now();\n const window = start && end - start <= 24 * 3_600_000\n ? { from: new Date(start).toISOString(), to: new Date(end).toISOString(), range: null } : {};\n return this.ctx.keep({ env: environment, ...window, ...extra });\n }\n\n acknowledge() {\n this.sending.set(true);\n this.ackError.set('');\n this.api.acknowledge(this.id(), this.comment).subscribe({\n next: () => { this.sending.set(false); this.detail.reload(); this.notifications.reload(); },\n error: e => {\n this.sending.set(false);\n this.ackError.set((e as { status?: number }).status === 403 ? 'Acknowledging needs the operator or admin role.' : problemText(e));\n },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4IA,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiHX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-alert.page-KyakwaUL.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alert.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input, signal } from '@angular/core';\nimport { apiResource } from '../shared/resource';\nimport { DatePipe, LowerCasePipe } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe, ReasonPipe } from '../shared/format';\nimport { ContextBar, HealthBadge, KeyValueTable } from '../shared/ui';\nimport { problemText } from '../shared/telemetry';\nimport { SuggestionsCard } from '../shared/suggestions';\nimport { CorrelationDecision } from '../core/models';\n\n/**\n * One alert (Console requirements §14): evidence, lifecycle history, the subject's health and reasons, the way into\n * the investigation, and acknowledgement for operators.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, LowerCasePipe, FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatProgressBarModule,\n ContextBar, HealthBadge, KeyValueTable, AgoPipe, ReasonPipe, SuggestionsCard],\n template: `\n <jc-context-bar>\n <a [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep()\" class=\"jc-crumb\">Alerts</a><span class=\"jc-crumb-sep\">›</span>\n <h1>{{ detail.value()?.alert?.rule ?? '…' }}</h1>\n </jc-context-bar>\n @if (detail.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (detail.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n @if (detail.value(); as d) {\n <div class=\"jc-summary\">\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"d.alert.severity === 'Critical'\" [class.jc-health-degraded]=\"d.alert.severity === 'Warning'\">{{ d.alert.severity }}</span>\n <strong>{{ d.alert.state }}</strong>\n <span>{{ d.alert.subjectKey }}</span>\n @if (d.alert.noData) { <span class=\"jc-muted\">no data at the last evaluation: state kept</span> }\n @if (d.alert.subjectType === 'service' && d.alert.subjectId) {\n <a mat-flat-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment)\">Investigate</a>\n <a mat-stroked-button [routerLink]=\"['services', d.alert.subjectId] | jcLink\" [queryParams]=\"investigate(d.alert.environment, { tab: 'traces', status: 'error' })\">Error traces</a>\n }\n @for (l of d.links; track l.url) { <a mat-button [href]=\"l.url\" target=\"_blank\" rel=\"noopener\">{{ l.title }} ↗</a> }\n @if (d.alert.state !== 'Resolved') {\n <a mat-stroked-button data-testid=\"alert-open-incident\" [routerLink]=\"['incidents'] | jcLink\" [queryParams]=\"incidentLink(d.alert.id, d.alert.rule, d.alert.subjectKey)\">Open an incident</a>\n <a mat-stroked-button data-testid=\"alert-silence\" [routerLink]=\"['silences'] | jcLink\" [queryParams]=\"silenceLink(d.alert.subjectKey, d.alert.environment, d.alert.subjectType)\">Silence this</a>\n }\n </div>\n @if (notifications.value(); as n) {\n @for (s of n.silences; track s.id) {\n <p class=\"jc-notice\" data-testid=\"alert-silenced\">Notifications are held until {{ s.endsAt | date: 'MMM d, HH:mm' }}: “{{ s.comment }}” ({{ s.createdBy }}). The alert itself still fires and resolves.</p>\n }\n @for (i of n.incidents; track i.id) {\n <p>In incident <a [routerLink]=\"['incidents', i.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ i.title }}</a> ({{ i.state }})</p>\n }\n }\n <div class=\"jc-grid-2\">\n <section class=\"jc-card\"><h2>Evidence</h2><jc-kv [values]=\"d.evidence\" /></section>\n <section class=\"jc-card\">\n <h2>Subject health</h2>\n @for (h of d.subjectHealth; track h.subjectId + h.environment) {\n <p><jc-health [state]=\"h.state\" [stale]=\"h.stale\" /> {{ h.environment }}</p>\n <ul class=\"jc-reasons\">@for (r of h.reasons; track r) { <li>{{ r | reason }}</li> }</ul>\n } @empty { <p class=\"jc-muted\">No health for this subject.</p> }\n </section>\n </div>\n <section class=\"jc-card\" data-testid=\"alert-related\">\n <h2>Around this alert</h2>\n @if (related.value(); as r) {\n <p class=\"jc-notice\" data-testid=\"alert-related-note\">{{ r.note }}</p>\n <table class=\"jc-table\"><tbody>\n @for (i of r.items; track i.type + i.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ i.at | date: 'MMM d, HH:mm:ss' }}</td>\n <td><strong>{{ i.title }}</strong>@if (i.detail) { <div class=\"jc-muted jc-small\">{{ i.detail }}</div> }</td>\n <td class=\"jc-small\"><ul class=\"jc-reasons\">@for (x of i.reasons; track x.code) { <li>{{ x.text }} <span class=\"jc-muted\">(+{{ x.points }})</span></li> }</ul></td>\n </tr>\n } @empty { <tr><td class=\"jc-muted\">No changes or dependency health changes in the 2 hours before this alert.</td></tr> }\n </tbody></table>\n @if (d.alert.subjectId && d.alert.subjectType === 'service') {\n <a mat-stroked-button [routerLink]=\"['timeline'] | jcLink\" [queryParams]=\"timelineLink(d.alert.subjectId, d.alert.environment, r.breachStartedAt)\">Open the timeline</a>\n }\n }\n @if (related.error()) { <p class=\"jc-error\">{{ relatedError() }}</p> }\n </section>\n @if (d.alert.state === 'Firing' || merged()) {\n <section class=\"jc-card\" data-testid=\"alert-suggestions\">\n <h2>Suggested with this alert</h2>\n @if (merged(); as m) { <p data-testid=\"alert-suggestion-merged\">Merged into <a [routerLink]=\"['incidents', m] | jcLink\" [queryParams]=\"ctx.keep()\">the incident</a>.</p> }\n <jc-suggestions [suggestions]=\"suggestions.value()\" (decided)=\"decided($event)\" />\n @if (suggestions.error()) { <p class=\"jc-error\">{{ suggestionsError() }}</p> }\n </section>\n }\n <section class=\"jc-card\" data-testid=\"alert-notifications\">\n <h2>Notifications</h2>\n @if (notifications.value(); as n) {\n @for (e of n.escalations; track e.policy) {\n <p>Escalation <strong>{{ e.name }}</strong>: {{ e.stepsSent }} of {{ e.steps }} steps sent, {{ e.state | lowercase }}@if (e.stopReason) { ({{ e.stopReason | reason }}) }@if (e.nextAt) {, next at {{ e.nextAt | date: 'HH:mm:ss' }} }</p>\n }\n <table class=\"jc-table\">\n <thead><tr><th>To</th><th>Event</th><th>Status</th><th>Attempts</th><th>Detail</th><th>When</th></tr></thead>\n <tbody>\n @for (x of n.deliveries; track x.delivery.id) {\n <tr>\n <td>{{ x.endpointKey }} <span class=\"jc-muted jc-small\">{{ x.kind }}</span></td>\n <td>{{ x.delivery.event }}@if (x.delivery.escalationStep) { step {{ x.delivery.escalationStep }} }</td>\n <td [class.jc-bad]=\"x.delivery.status === 'Failed'\">{{ x.delivery.status }}</td>\n <td>{{ x.delivery.attempts }}</td>\n <td class=\"jc-small\">{{ x.delivery.lastError }}@if (x.delivery.nextAttemptAt && x.delivery.status === 'Retrying') { · next {{ x.delivery.nextAttemptAt | date: 'HH:mm:ss' }} }</td>\n <td class=\"jc-nowrap\">{{ x.delivery.createdAt | date: 'MMM d, HH:mm:ss' }}</td>\n </tr>\n } @empty { <tr><td colspan=\"6\" class=\"jc-muted\">Nothing sent about this alert: no channel takes it.</td></tr> }\n </tbody>\n </table>\n }\n @if (notifications.error()) { <p class=\"jc-error\">{{ notificationsError() }}</p> }\n </section>\n <section class=\"jc-card\">\n <h2>History</h2>\n <table class=\"jc-table\"><tbody>\n @for (t of d.history; track t.at + t.to) {\n <tr><td>{{ t.at | date: 'MMM d, HH:mm:ss' }}</td><td>{{ t.from ?? '—' }} → <strong>{{ t.to }}</strong></td><td>{{ t.reason | reason }}</td><td>{{ t.value ?? '—' }}</td></tr>\n }\n </tbody></table>\n </section>\n <section class=\"jc-card\">\n <h2>Acknowledgement</h2>\n @if (d.alert.acknowledgedAt) {\n <p>By <strong>{{ d.alert.acknowledgedBy }}</strong> {{ d.alert.acknowledgedAt | ago }}@if (d.acknowledgeComment) {: “{{ d.acknowledgeComment }}”}</p>\n } @else if (d.alert.state !== 'Resolved') {\n <form (ngSubmit)=\"acknowledge()\" class=\"jc-filter-form\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-wide\"><mat-label>Comment</mat-label><input matInput name=\"comment\" [(ngModel)]=\"comment\" maxlength=\"1000\"></mat-form-field>\n <button mat-flat-button type=\"submit\" [disabled]=\"sending()\">Acknowledge</button>\n </form>\n @if (ackError()) { <p class=\"jc-error\">{{ ackError() }}</p> }\n } @else { <p class=\"jc-muted\">Resolved without acknowledgement.</p> }\n </section>\n }`,\n})\nexport class AlertPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n readonly id = input.required<string>();\n protected comment = '';\n protected readonly sending = signal(false);\n protected readonly ackError = signal('');\n\n protected readonly detail = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alert(params) });\n protected readonly error = computed(() => problemText(this.detail.error()));\n protected readonly related = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.relatedToAlert(params) });\n protected readonly relatedError = computed(() => problemText(this.related.error()));\n protected readonly notifications = apiResource({ params: () => this.id(), stream: ({ params }) => this.api.alertNotifications(params) });\n protected readonly notificationsError = computed(() => problemText(this.notifications.error()));\n /** Only a firing alert is suggested with others, so only its page asks. */\n protected readonly suggestions = apiResource({\n params: () => (this.detail.value()?.alert.state === 'Firing' ? this.id() : undefined),\n stream: ({ params }) => this.api.alertSuggestions(params),\n });\n protected readonly suggestionsError = computed(() => problemText(this.suggestions.error()));\n /** The incident a suggestion on this page was merged into. Keyed by alert: the page is reused when a suggestion's link opens another alert. */\n private readonly mergedInto = signal<{ alert: string; incident: string } | null>(null);\n protected readonly merged = computed(() => (this.mergedInto()?.alert === this.id() ? this.mergedInto()!.incident : null));\n\n /** A decision, or null when one was refused because the list was stale: either way, read it again. */\n protected decided(d: CorrelationDecision | null) {\n if (d?.incidentId) this.mergedInto.set({ alert: this.id(), incident: d.incidentId });\n this.suggestions.reload();\n this.notifications.reload();\n }\n\n incidentLink(alert: string, rule: string, subject: string) { return this.ctx.keep({ alert, title: `${rule} on ${subject}` }); }\n\n /** The new-silence form, filled in for this alert's subject. */\n silenceLink(subject: string, environment: string | null, type: string) {\n const name = type === 'service' ? subject.replace(/^service:/, '').replace(/@[^@]*$/, '') : null;\n const host = type === 'host' ? subject.replace(/^host:/, '') : null;\n return this.ctx.keep({ service: name, environment, host });\n }\n\n /** The service page over the alert's environment, from shortly before the breach. */\n /** The service's timeline from 2 hours before the breach to 1 hour after. */\n timelineLink(service: string, environment: string | null, breach: string) {\n const at = new Date(breach).getTime();\n return this.ctx.keep({ service, env: environment, range: null, from: new Date(at - 2 * 3_600_000).toISOString(), to: new Date(at + 3_600_000).toISOString() });\n }\n\n investigate(environment: string | null, extra: Record<string, string> = {}) {\n const alert = this.detail.value()?.alert;\n const start = alert?.breachStartedAt ? new Date(alert.breachStartedAt).getTime() - 15 * 60_000 : null;\n const end = alert?.resolvedAt ? new Date(alert.resolvedAt).getTime() + 5 * 60_000 : Date.now();\n const window = start && end - start <= 24 * 3_600_000\n ? { from: new Date(start).toISOString(), to: new Date(end).toISOString(), range: null } : {};\n return this.ctx.keep({ env: environment, ...window, ...extra });\n }\n\n acknowledge() {\n this.sending.set(true);\n this.ackError.set('');\n this.api.acknowledge(this.id(), this.comment).subscribe({\n next: () => { this.sending.set(false); this.detail.reload(); this.notifications.reload(); },\n error: e => {\n this.sending.set(false);\n this.ackError.set((e as { status?: number }).status === 403 ? 'Acknowledging needs the operator or admin role.' : problemText(e));\n },\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4IA,IAAa,YAAb,MAAa,UAAS;CACD,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CAC/B,KAAK,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAC5B,UAAU;CACD,UAAU,OA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, LinkPipe } from "./juice-js-observability.mjs";
2
- import { c as ContextBar, g as AgoPipe, o as problemText, p as cursorList } from "./juice-js-observability-telemetry-CwdIXE9m.mjs";
2
+ import { c as ContextBar, g as AgoPipe, o as problemText, p as cursorList } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, inject, input } from "@angular/core";
5
5
  import { RouterLink } from "@angular/router";
@@ -208,4 +208,4 @@ i0.ɵɵngDeclareClassMetadata({
208
208
  });
209
209
  export { AlertsPage };
210
210
 
211
- //# sourceMappingURL=juice-js-observability-alerts.page-B0ZpGPk9.mjs.map
211
+ //# sourceMappingURL=juice-js-observability-alerts.page-up57Y8fX.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability-alerts.page-B0ZpGPk9.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alerts.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { cursorList } from '../shared/paging';\nimport { problemText } from '../shared/telemetry';\n\n/** Alerts, newest first (Console requirements §14), filtered by state; 100 at a time, with the next on request. */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatButtonModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Alerts</h1>\n @for (s of states; track s) {\n <a class=\"jc-chip\" [class.jc-selected]=\"s === (state() ?? 'firing')\" [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep({ state: s })\">{{ s }}</a>\n }\n </jc-context-bar>\n @if (alerts.first.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (alerts.first.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Severity</th><th>Rule</th><th>Subject</th><th>State</th><th>Value</th><th>Fired</th><th>Acknowledged</th></tr></thead>\n <tbody>\n @for (a of alerts.items(); track a.id) {\n <tr>\n <td><span class=\"jc-badge\" [class.jc-health-unhealthy]=\"a.severity === 'Critical'\" [class.jc-health-degraded]=\"a.severity === 'Warning'\">{{ a.severity }}</span></td>\n <td><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.rule }}</a></td>\n <td>{{ a.subjectKey }}</td>\n <td>{{ a.state }}@if (a.noData) { <span class=\"jc-muted\" title=\"The last evaluation had too few samples; the state is kept\"> · no data</span> }</td>\n <td>{{ a.lastValue ?? '—' }}</td>\n <td>{{ a.firedAt | ago }}</td>\n <td>{{ a.acknowledgedBy ?? '—' }}</td>\n </tr>\n } @empty { @if (alerts.first.hasValue()) { <tr><td colspan=\"7\" class=\"jc-muted\">No {{ state() ?? 'firing' }} alerts.</td></tr> } }\n </tbody>\n </table>\n @if (alerts.items().length > 0) {\n <div class=\"jc-more\">\n <span class=\"jc-muted\">{{ alerts.items().length }} {{ state() ?? 'firing' }} alert{{ alerts.items().length === 1 ? '' : 's' }}{{ alerts.hasMore() ? ', newest first' : '' }}</span>\n @if (alerts.hasMore()) {\n <button mat-button (click)=\"alerts.more()\" [disabled]=\"alerts.loadingMore()\">{{ alerts.loadingMore() ? 'Loading…' : 'Load more' }}</button>\n }\n @if (alerts.moreError()) { <span class=\"jc-error\">{{ moreError() }}</span> }\n </div>\n }`,\n})\nexport class AlertsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly states = ['firing', 'pending', 'resolved'];\n readonly state = input<string>();\n protected readonly alerts = cursorList(\n () => ({ state: this.state() ?? 'firing', environment: this.ctx.environment() }), params => params, q => this.api.alerts(q));\n protected readonly error = computed(() => problemText(this.alerts.first.error()));\n protected readonly moreError = computed(() => problemText(this.alerts.moreError()));\n}\n"],"mappings":";;;;;;;;;AAkDA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,SAAS;EAAC;EAAU;EAAW;CAAU;CACnD,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACb,SAAS,kBACnB;EAAE,OAAO,KAAK,MAAK,KAAM;EAAU,aAAa,KAAK,IAAI,YAAW;CAAE,KAAK,WAAU,SAAQ,MAAK,KAAK,IAAI,OAAO,CAAC,CAAC;CAC1G,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAM,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC9D,YAAY,eAAe,YAAY,KAAK,OAAO,UAAS,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CARxE,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAU,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UAlCX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCN,UAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MAjCgB;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAe;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA,CAAA,WAAA;IAAA,UAAA,CAAA,aAAA,WAAA;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,MAAvE;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAiE;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAmC/E,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EArCtB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAiB;IAAsB;IAAY;GAAO;GAC1F,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCX,CAAA"}
1
+ {"version":3,"file":"juice-js-observability-alerts.page-up57Y8fX.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/alerts.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { RouterLink } from '@angular/router';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { AgoPipe } from '../shared/format';\nimport { ContextBar } from '../shared/ui';\nimport { cursorList } from '../shared/paging';\nimport { problemText } from '../shared/telemetry';\n\n/** Alerts, newest first (Console requirements §14), filtered by state; 100 at a time, with the next on request. */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, MatButtonModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Alerts</h1>\n @for (s of states; track s) {\n <a class=\"jc-chip\" [class.jc-selected]=\"s === (state() ?? 'firing')\" [routerLink]=\"['alerts'] | jcLink\" [queryParams]=\"ctx.keep({ state: s })\">{{ s }}</a>\n }\n </jc-context-bar>\n @if (alerts.first.isLoading()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (alerts.first.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n <table class=\"jc-table\">\n <thead><tr><th>Severity</th><th>Rule</th><th>Subject</th><th>State</th><th>Value</th><th>Fired</th><th>Acknowledged</th></tr></thead>\n <tbody>\n @for (a of alerts.items(); track a.id) {\n <tr>\n <td><span class=\"jc-badge\" [class.jc-health-unhealthy]=\"a.severity === 'Critical'\" [class.jc-health-degraded]=\"a.severity === 'Warning'\">{{ a.severity }}</span></td>\n <td><a [routerLink]=\"['alerts', a.id] | jcLink\" [queryParams]=\"ctx.keep()\">{{ a.rule }}</a></td>\n <td>{{ a.subjectKey }}</td>\n <td>{{ a.state }}@if (a.noData) { <span class=\"jc-muted\" title=\"The last evaluation had too few samples; the state is kept\"> · no data</span> }</td>\n <td>{{ a.lastValue ?? '—' }}</td>\n <td>{{ a.firedAt | ago }}</td>\n <td>{{ a.acknowledgedBy ?? '—' }}</td>\n </tr>\n } @empty { @if (alerts.first.hasValue()) { <tr><td colspan=\"7\" class=\"jc-muted\">No {{ state() ?? 'firing' }} alerts.</td></tr> } }\n </tbody>\n </table>\n @if (alerts.items().length > 0) {\n <div class=\"jc-more\">\n <span class=\"jc-muted\">{{ alerts.items().length }} {{ state() ?? 'firing' }} alert{{ alerts.items().length === 1 ? '' : 's' }}{{ alerts.hasMore() ? ', newest first' : '' }}</span>\n @if (alerts.hasMore()) {\n <button mat-button (click)=\"alerts.more()\" [disabled]=\"alerts.loadingMore()\">{{ alerts.loadingMore() ? 'Loading…' : 'Load more' }}</button>\n }\n @if (alerts.moreError()) { <span class=\"jc-error\">{{ moreError() }}</span> }\n </div>\n }`,\n})\nexport class AlertsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly states = ['firing', 'pending', 'resolved'];\n readonly state = input<string>();\n protected readonly alerts = cursorList(\n () => ({ state: this.state() ?? 'firing', environment: this.ctx.environment() }), params => params, q => this.api.alerts(q));\n protected readonly error = computed(() => problemText(this.alerts.first.error()));\n protected readonly moreError = computed(() => problemText(this.alerts.moreError()));\n}\n"],"mappings":";;;;;;;;;AAkDA,IAAa,aAAb,MAAa,WAAU;CACF,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,SAAS;EAAC;EAAU;EAAW;CAAU;CACnD,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACb,SAAS,kBACnB;EAAE,OAAO,KAAK,MAAK,KAAM;EAAU,aAAa,KAAK,IAAI,YAAW;CAAE,KAAK,WAAU,SAAQ,MAAK,KAAK,IAAI,OAAO,CAAC,CAAC;CAC1G,QAAQ,eAAe,YAAY,KAAK,OAAO,MAAM,MAAK,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAC9D,YAAY,eAAe,YAAY,KAAK,OAAO,UAAS,CAAE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CARxE,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAU,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAV,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAU,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UAlCX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCN,UAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MAjCgB;IAAU,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;GAAe;GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,UAAA;IAAA,QAAA,CAAA,WAAA;IAAA,UAAA,CAAA,aAAA,WAAA;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,MAAvE;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAiE;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAmC/E,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EArCtB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAiB;IAAsB;IAAY;GAAO;GAC1F,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCX,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { ApiService, ApprovalCount, 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-CwdIXE9m.mjs";
2
+ import { c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-CaunxC3Y.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { ChangeDetectionStrategy, Component, computed, effect, inject, signal } from "@angular/core";
5
- import { RouterLink } from "@angular/router";
6
5
  import { DatePipe } from "@angular/common";
6
+ import { RouterLink } from "@angular/router";
7
7
  import * as i1 from "@angular/forms";
8
8
  import { FormsModule } from "@angular/forms";
9
9
  import * as i2 from "@angular/material/button";
@@ -384,4 +384,4 @@ i0.ɵɵngDeclareClassMetadata({
384
384
  });
385
385
  export { ApprovalsPage };
386
386
 
387
- //# sourceMappingURL=juice-js-observability-approvals.page-l5mwxlcl.mjs.map
387
+ //# sourceMappingURL=juice-js-observability-approvals.page-BgHDUGd4.mjs.map