@juice-js/observability 1.1.0-alpha.28 → 1.1.0-alpha.29

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.
@@ -66,6 +66,17 @@ var AgentPage = class AgentPage {
66
66
  revokeError = signal("", ...ngDevMode ? [{ debugName: "revokeError" }] : /* istanbul ignore next */ []);
67
67
  version = "";
68
68
  reason = "";
69
+ requestReason = "";
70
+ issued = signal("", ...ngDevMode ? [{ debugName: "issued" }] : /* istanbul ignore next */ []);
71
+ needsApproval = computed(() => (this.selected()?.approval ?? "None") !== "None", ...ngDevMode ? [{ debugName: "needsApproval" }] : /* istanbul ignore next */ []);
72
+ requests = apiResource({
73
+ params: () => this.id(),
74
+ stream: ({ params }) => this.api.actionRequests({
75
+ agentId: params,
76
+ limit: 20
77
+ })
78
+ });
79
+ requestList = computed(() => this.requests.value()?.items ?? [], ...ngDevMode ? [{ debugName: "requestList" }] : /* istanbul ignore next */ []);
69
80
  creating = signal(false, ...ngDevMode ? [{ debugName: "creating" }] : /* istanbul ignore next */ []);
70
81
  reenrollError = signal("", ...ngDevMode ? [{ debugName: "reenrollError" }] : /* istanbul ignore next */ []);
71
82
  token = signal(null, ...ngDevMode ? [{ debugName: "token" }] : /* istanbul ignore next */ []);
@@ -115,11 +126,14 @@ var AgentPage = class AgentPage {
115
126
  else if (Object.keys(untracked(this.values)).length === 0) this.choose(current.name);
116
127
  });
117
128
  effect((onCleanup) => {
118
- if (!this.allCommands().some((c) => this.waiting(c))) return;
129
+ const running = this.allCommands().some((c) => this.waiting(c));
130
+ const deciding = this.requestList().some((r) => r.state === "Pending");
131
+ if (!running && !deciding) return;
119
132
  const timer = setTimeout(() => {
120
133
  this.commands.reload();
121
134
  this.agent.reload();
122
- }, 2e3);
135
+ this.requests.reload();
136
+ }, running ? 2e3 : 5e3);
123
137
  onCleanup(() => clearTimeout(timer));
124
138
  });
125
139
  }
@@ -216,19 +230,47 @@ var AgentPage = class AgentPage {
216
230
  }
217
231
  return out;
218
232
  }
233
+ approvalText(policy) {
234
+ switch (policy) {
235
+ case "None": return "runs when asked";
236
+ case "Admin": return "needs an admin: an admin's request runs at once, an operator's waits for an admin to approve it";
237
+ default: return "needs a second person: an admin other than whoever asks approves it";
238
+ }
239
+ }
219
240
  issue() {
220
241
  const action = this.action();
221
242
  this.issuing.set(true);
222
243
  this.issueError.set("");
223
- this.api.issueCommand(this.id(), action, this.parameters()).subscribe({
224
- next: () => {
244
+ this.issued.set("");
245
+ const failed = (e) => {
246
+ this.issuing.set(false);
247
+ this.issueError.set(e.status === 403 ? "Asking an agent needs the operator or admin role." : problemText(e));
248
+ };
249
+ if (!this.needsApproval()) {
250
+ this.api.issueCommand(this.id(), action, this.parameters()).subscribe({
251
+ next: () => {
252
+ this.issuing.set(false);
253
+ this.commands.reload();
254
+ },
255
+ error: failed
256
+ });
257
+ return;
258
+ }
259
+ this.api.requestAction(this.id(), action, this.parameters(), this.requestReason.trim()).subscribe({
260
+ next: (r) => {
225
261
  this.issuing.set(false);
262
+ this.requestReason = "";
263
+ this.issued.set(r.state === "Issued" ? "Approved by your role: running." : "Requested: it runs once approved, on the Approvals page.");
264
+ this.requests.reload();
226
265
  this.commands.reload();
227
266
  },
228
- error: (e) => {
229
- this.issuing.set(false);
230
- this.issueError.set(e.status === 403 ? action === "agent.update" ? "Updating an agent needs the admin role." : "Asking an agent needs the operator or admin role." : problemText(e));
231
- }
267
+ error: failed
268
+ });
269
+ }
270
+ cancelRequest(id) {
271
+ this.api.cancelRequest(id).subscribe({
272
+ next: () => this.requests.reload(),
273
+ error: (e) => this.issueError.set(problemText(e))
232
274
  });
233
275
  }
234
276
  loadOlder() {
@@ -378,13 +420,19 @@ var AgentPage = class AgentPage {
378
420
  }
379
421
  }
380
422
  }
423
+ @if (needsApproval()) {
424
+ <mat-form-field subscriptSizing="dynamic" class="jc-field-wide"><mat-label>Why (for whoever approves it)</mat-label>
425
+ <input matInput name="requestReason" data-testid="request-reason" maxlength="500" [(ngModel)]="requestReason">
426
+ </mat-form-field>
427
+ }
381
428
  <div class="jc-form-actions">
382
- <button mat-flat-button type="submit" data-testid="command-issue" [disabled]="issuing() || selected()?.permitted === false">{{ action() === 'agent.update' ? 'Update' : 'Run' }}</button>
429
+ <button mat-flat-button type="submit" data-testid="command-issue" [disabled]="issuing() || selected()?.permitted === false">{{ needsApproval() ? 'Request' : action() === 'agent.update' ? 'Update' : 'Run' }}</button>
383
430
  @if (issueError()) { <span class="jc-error" data-testid="command-error">{{ issueError() }}</span> }
431
+ @if (issued()) { <span class="jc-muted" data-testid="command-issued">{{ issued() }}</span> }
384
432
  </div>
385
433
  @if (selected(); as s) {
386
434
  <div class="jc-muted jc-small jc-form-actions" data-testid="command-hint">
387
- <div>{{ s.description }}@if (s.changing) { Admins only. }</div>
435
+ <div>{{ s.description }} <span data-testid="command-approval">{{ s.risk }} risk: {{ approvalText(s.approval) }}.</span></div>
388
436
  @if (s.limits.length) { <div data-testid="command-limits">On this host: {{ s.limits.join('; ') }}.</div> }
389
437
  </div>
390
438
  }
@@ -399,6 +447,29 @@ var AgentPage = class AgentPage {
399
447
  </section>
400
448
  }
401
449
 
450
+ @if (requestList().length) {
451
+ <section class="jc-card" data-testid="requests">
452
+ <h2>Requests</h2>
453
+ <table class="jc-table">
454
+ <thead><tr><th>Asked</th><th>Action</th><th>By, and why</th><th>State</th><th>Decided</th><th></th></tr></thead>
455
+ <tbody>
456
+ @for (r of requestList(); track r.id) {
457
+ <tr [attr.data-testid]="'request-' + r.id">
458
+ <td class="jc-nowrap">{{ r.requestedAt | date: 'MMM d, HH:mm:ss' }}</td>
459
+ <td><strong>{{ r.action }}</strong><div class="jc-muted jc-small">{{ r.risk }} risk</div></td>
460
+ <td>{{ r.requestedBy }}<div class="jc-small">{{ r.reason }}</div></td>
461
+ <td class="jc-nowrap"><span class="jc-badge" [class.jc-health-degraded]="r.state === 'Pending'" [class.jc-health-healthy]="r.state === 'Issued'"
462
+ [class.jc-health-none]="r.state !== 'Pending' && r.state !== 'Issued'" data-testid="request-state">{{ r.state === 'Pending' ? 'Waiting for approval' : r.state }}</span>
463
+ @if (r.state === 'Pending') { <div class="jc-muted jc-small">until {{ r.expiresAt | date: 'HH:mm' }}</div> }</td>
464
+ <td class="jc-small">@if (r.decidedBy) { {{ r.decidedBy }}, {{ r.decidedAt | date: 'HH:mm' }} }@if (r.comment) { <div>{{ r.comment }}</div> }</td>
465
+ <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>
466
+ </tr>
467
+ }
468
+ </tbody>
469
+ </table>
470
+ </section>
471
+ }
472
+
402
473
  <section class="jc-card" data-testid="commands">
403
474
  <h2>Commands</h2>
404
475
  @if (commands.error()) { <p class="jc-error">{{ commandsError() }}</p> }
@@ -837,13 +908,19 @@ i0.ɵɵngDeclareClassMetadata({
837
908
  }
838
909
  }
839
910
  }
911
+ @if (needsApproval()) {
912
+ <mat-form-field subscriptSizing="dynamic" class="jc-field-wide"><mat-label>Why (for whoever approves it)</mat-label>
913
+ <input matInput name="requestReason" data-testid="request-reason" maxlength="500" [(ngModel)]="requestReason">
914
+ </mat-form-field>
915
+ }
840
916
  <div class="jc-form-actions">
841
- <button mat-flat-button type="submit" data-testid="command-issue" [disabled]="issuing() || selected()?.permitted === false">{{ action() === 'agent.update' ? 'Update' : 'Run' }}</button>
917
+ <button mat-flat-button type="submit" data-testid="command-issue" [disabled]="issuing() || selected()?.permitted === false">{{ needsApproval() ? 'Request' : action() === 'agent.update' ? 'Update' : 'Run' }}</button>
842
918
  @if (issueError()) { <span class="jc-error" data-testid="command-error">{{ issueError() }}</span> }
919
+ @if (issued()) { <span class="jc-muted" data-testid="command-issued">{{ issued() }}</span> }
843
920
  </div>
844
921
  @if (selected(); as s) {
845
922
  <div class="jc-muted jc-small jc-form-actions" data-testid="command-hint">
846
- <div>{{ s.description }}@if (s.changing) { Admins only. }</div>
923
+ <div>{{ s.description }} <span data-testid="command-approval">{{ s.risk }} risk: {{ approvalText(s.approval) }}.</span></div>
847
924
  @if (s.limits.length) { <div data-testid="command-limits">On this host: {{ s.limits.join('; ') }}.</div> }
848
925
  </div>
849
926
  }
@@ -858,6 +935,29 @@ i0.ɵɵngDeclareClassMetadata({
858
935
  </section>
859
936
  }
860
937
 
938
+ @if (requestList().length) {
939
+ <section class="jc-card" data-testid="requests">
940
+ <h2>Requests</h2>
941
+ <table class="jc-table">
942
+ <thead><tr><th>Asked</th><th>Action</th><th>By, and why</th><th>State</th><th>Decided</th><th></th></tr></thead>
943
+ <tbody>
944
+ @for (r of requestList(); track r.id) {
945
+ <tr [attr.data-testid]="'request-' + r.id">
946
+ <td class="jc-nowrap">{{ r.requestedAt | date: 'MMM d, HH:mm:ss' }}</td>
947
+ <td><strong>{{ r.action }}</strong><div class="jc-muted jc-small">{{ r.risk }} risk</div></td>
948
+ <td>{{ r.requestedBy }}<div class="jc-small">{{ r.reason }}</div></td>
949
+ <td class="jc-nowrap"><span class="jc-badge" [class.jc-health-degraded]="r.state === 'Pending'" [class.jc-health-healthy]="r.state === 'Issued'"
950
+ [class.jc-health-none]="r.state !== 'Pending' && r.state !== 'Issued'" data-testid="request-state">{{ r.state === 'Pending' ? 'Waiting for approval' : r.state }}</span>
951
+ @if (r.state === 'Pending') { <div class="jc-muted jc-small">until {{ r.expiresAt | date: 'HH:mm' }}</div> }</td>
952
+ <td class="jc-small">@if (r.decidedBy) { {{ r.decidedBy }}, {{ r.decidedAt | date: 'HH:mm' }} }@if (r.comment) { <div>{{ r.comment }}</div> }</td>
953
+ <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>
954
+ </tr>
955
+ }
956
+ </tbody>
957
+ </table>
958
+ </section>
959
+ }
960
+
861
961
  <section class="jc-card" data-testid="commands">
862
962
  <h2>Commands</h2>
863
963
  @if (commands.error()) { <p class="jc-error">{{ commandsError() }}</p> }
@@ -953,4 +1053,4 @@ i0.ɵɵngDeclareClassMetadata({
953
1053
  });
954
1054
  export { AgentPage };
955
1055
 
956
- //# sourceMappingURL=juice-js-observability-agent.page-VsTEvbSN.mjs.map
1056
+ //# sourceMappingURL=juice-js-observability-agent.page-D6nP3YbF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-agent.page-D6nP3YbF.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 { ContextService } from '../core/context.service';\nimport { ActionParameter, AgentAction, AgentCommand, EnrollmentToken } from '../core/models';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AgoPipe, ReasonPipe, copyText } 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};\nconst PARAMETER_LABELS: Record<string, string> = { pathPrefix: 'Only under this path', host: 'Host', port: 'Port', timeoutMs: 'Wait (ms)' };\n\nfunction formatBytes(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined) return '—';\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit++; }\n return `${value < 10 && unit > 0 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`;\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 }\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> }</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 @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 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 /** 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 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 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 this.api.requestAction(this.id(), action, this.parameters(), this.requestReason.trim()).subscribe({\n next: r => {\n this.issuing.set(false);\n this.requestReason = '';\n this.issued.set(r.state === 'Issued' ? 'Approved by your role: running.' : 'Requested: it runs once approved, on the Approvals page.');\n this.requests.reload();\n this.commands.reload();\n },\n error: failed,\n });\n }\n\n protected cancelRequest(id: string) {\n this.api.cancelRequest(id).subscribe({ next: () => this.requests.reload(), 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":";;;;;;;;;;;;;;;;;;;AA4BA,MAAM,UAAU,CAAC,WAAW,WAAW;AACvC,MAAM,SAAiC;CACrC,gBAAgB;CAAgB,cAAc;CAAc,oBAAoB;CAAoB,gBAAgB;AACrH;AACD,MAAM,mBAA2C;CAAE,YAAY;CAAwB,MAAM;CAAQ,MAAM;CAAQ,WAAW;AAAW;AAEzI,SAAS,YAAY,OAAgC;CACnD,IAAI,UAAU,QAAQ,UAAU,QAAW,OAAO;CAClD,MAAM,QAAQ;EAAC;EAAK;EAAM;EAAM;EAAM;EAAM;CAAI;CAChD,IAAI,QAAQ;CACZ,IAAI,OAAO;CACX,OAAO,SAAS,QAAQ,OAAO,MAAM,SAAS,GAAG;EAAE,SAAS;EAAM;CAAQ;CAC1E,OAAO,GAAG,QAAQ,MAAM,OAAO,IAAI,MAAM,QAAQ,CAAC,IAAI,KAAK,MAAM,KAAK,EAAC,GAAI,MAAM;AACnF;AAEA,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;AAyNA,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;CACnB,SAAS,OAAO,gBAAe,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+MX,CAAA"}
@@ -0,0 +1,383 @@
1
+ import { ApiService, ContextService, LinkPipe } from "./juice-js-observability.mjs";
2
+ import { c as ContextBar, g as AgoPipe, h as apiResource, o as problemText } from "./juice-js-observability-telemetry-B98lekF2.mjs";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, computed, effect, inject, signal } from "@angular/core";
5
+ import { RouterLink } from "@angular/router";
6
+ import { DatePipe } from "@angular/common";
7
+ import * as i1 from "@angular/forms";
8
+ import { FormsModule } from "@angular/forms";
9
+ import * as i2 from "@angular/material/button";
10
+ import { MatButtonModule } from "@angular/material/button";
11
+ import { MatFormFieldModule } from "@angular/material/form-field";
12
+ import * as i4 from "@angular/material/input";
13
+ import { MatInputModule } from "@angular/material/input";
14
+ import * as i5 from "@angular/material/progress-bar";
15
+ import { MatProgressBarModule } from "@angular/material/progress-bar";
16
+ import * as i3 from "@angular/material/select";
17
+ var ApprovalsPage = class ApprovalsPage {
18
+ ctx = inject(ContextService);
19
+ api = inject(ApiService);
20
+ busy = signal(null, ...ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []);
21
+ comments = signal({}, ...ngDevMode ? [{ debugName: "comments" }] : /* istanbul ignore next */ []);
22
+ errors = signal({}, ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
23
+ pending = apiResource({ stream: () => this.api.actionRequests({ state: "Pending" }) });
24
+ recent = apiResource({ stream: () => this.api.actionRequests({ limit: 30 }) });
25
+ decided = computed(() => (this.recent.value()?.items ?? []).filter((r) => r.state !== "Pending"), ...ngDevMode ? [{ debugName: "decided" }] : /* istanbul ignore next */ []);
26
+ error = computed(() => problemText(this.pending.error()), ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
27
+ constructor() {
28
+ effect((onCleanup) => {
29
+ this.pending.value();
30
+ const timer = setTimeout(() => {
31
+ this.pending.reload();
32
+ this.recent.reload();
33
+ }, 1e4);
34
+ onCleanup(() => clearTimeout(timer));
35
+ });
36
+ }
37
+ describe(r) {
38
+ return Object.entries(r.parameters ?? {}).map(([k, v]) => `${k}=${typeof v === "string" ? v : JSON.stringify(v)}`).join(", ");
39
+ }
40
+ comment(id, text) {
41
+ this.comments.update((c) => ({
42
+ ...c,
43
+ [id]: text
44
+ }));
45
+ }
46
+ decide(r, call) {
47
+ this.busy.set(r.id);
48
+ this.errors.update((e) => ({
49
+ ...e,
50
+ [r.id]: ""
51
+ }));
52
+ call.subscribe({
53
+ next: () => {
54
+ this.busy.set(null);
55
+ this.pending.reload();
56
+ this.recent.reload();
57
+ },
58
+ error: (e) => {
59
+ this.busy.set(null);
60
+ const status = e.status;
61
+ const text = status === 403 && r.policy === "SecondPerson" ? `An admin other than ${r.requestedBy} has to approve this.` : status === 403 ? "Deciding needs the admin role." : problemText(e);
62
+ this.errors.update((x) => ({
63
+ ...x,
64
+ [r.id]: text
65
+ }));
66
+ }
67
+ });
68
+ }
69
+ approve(r) {
70
+ this.decide(r, this.api.approveRequest(r.id, (this.comments()[r.id] ?? "").trim()));
71
+ }
72
+ reject(r) {
73
+ const comment = (this.comments()[r.id] ?? "").trim();
74
+ if (!comment) {
75
+ this.errors.update((e) => ({
76
+ ...e,
77
+ [r.id]: "Say why in the comment."
78
+ }));
79
+ return;
80
+ }
81
+ this.decide(r, this.api.rejectRequest(r.id, comment));
82
+ }
83
+ static ɵfac = i0.ɵɵngDeclareFactory({
84
+ minVersion: "12.0.0",
85
+ version: "22.2.4",
86
+ ngImport: i0,
87
+ type: ApprovalsPage,
88
+ deps: [],
89
+ target: i0.ɵɵFactoryTarget.Component
90
+ });
91
+ static ɵcmp = i0.ɵɵngDeclareComponent({
92
+ minVersion: "17.0.0",
93
+ version: "22.2.4",
94
+ type: ApprovalsPage,
95
+ isStandalone: true,
96
+ selector: "ng-component",
97
+ ngImport: i0,
98
+ template: `
99
+ <jc-context-bar><h1>Approvals</h1></jc-context-bar>
100
+ @if (pending.isLoading() && !pending.value()) { <mat-progress-bar mode="indeterminate" /> }
101
+ @if (pending.error()) { <p class="jc-error">{{ error() }}</p> }
102
+
103
+ <section class="jc-card" data-testid="approvals-pending">
104
+ <h2>Waiting</h2>
105
+ @for (r of pending.value()?.items ?? []; track r.id) {
106
+ <div class="jc-list-row" [attr.data-testid]="'approval-' + r.id">
107
+ <div>
108
+ <strong>{{ r.action }}</strong> on <a [routerLink]="['agents', r.agentId] | jcLink" [queryParams]="ctx.keep()">{{ r.hostname }}</a>
109
+ <span class="jc-badge" [class.jc-health-unhealthy]="r.risk === 'High'" [class.jc-health-degraded]="r.risk !== 'High'">{{ r.risk }} risk</span>
110
+ @if (describe(r); as d) { <div class="jc-mono jc-small">{{ d }}</div> }
111
+ <div class="jc-small">{{ r.requestedBy }}, {{ r.requestedAt | ago }}: {{ r.reason }}</div>
112
+ <div class="jc-muted jc-small">{{ r.policy === 'SecondPerson' ? 'Needs an admin other than ' + r.requestedBy : 'Needs an admin' }}. Expires {{ r.expiresAt | date: 'HH:mm' }}.</div>
113
+ </div>
114
+ <form class="jc-form" (ngSubmit)="approve(r)">
115
+ <mat-form-field subscriptSizing="dynamic" class="jc-field-md"><mat-label>Comment</mat-label>
116
+ <input matInput [name]="'comment-' + r.id" [attr.data-testid]="'approval-comment-' + r.id" maxlength="500" [ngModel]="comments()[r.id] ?? ''" (ngModelChange)="comment(r.id, $event)">
117
+ </mat-form-field>
118
+ <button mat-flat-button type="submit" [attr.data-testid]="'approve-' + r.id" [disabled]="busy() === r.id">Approve</button>
119
+ <button mat-stroked-button type="button" [attr.data-testid]="'reject-' + r.id" [disabled]="busy() === r.id" (click)="reject(r)">Reject</button>
120
+ @if (errors()[r.id]; as e) { <span class="jc-error" [attr.data-testid]="'approval-error-' + r.id">{{ e }}</span> }
121
+ </form>
122
+ </div>
123
+ } @empty { <p class="jc-muted" data-testid="approvals-none">Nothing is waiting for approval.</p> }
124
+ </section>
125
+
126
+ <section class="jc-card">
127
+ <h2>Decided lately</h2>
128
+ <table class="jc-table" data-testid="approvals-decided">
129
+ <thead><tr><th>Asked</th><th>Action</th><th>By</th><th>Decision</th></tr></thead>
130
+ <tbody>
131
+ @for (r of decided(); track r.id) {
132
+ <tr>
133
+ <td class="jc-nowrap">{{ r.requestedAt | date: 'MMM d, HH:mm' }}</td>
134
+ <td><strong>{{ r.action }}</strong> on <a [routerLink]="['agents', r.agentId] | jcLink" [queryParams]="ctx.keep()">{{ r.hostname }}</a></td>
135
+ <td>{{ r.requestedBy }}</td>
136
+ <td>{{ r.state }}@if (r.decidedBy) { by {{ r.decidedBy }} }@if (r.command) { · command {{ r.command.state }} }@if (r.comment) { <div class="jc-small">{{ r.comment }}</div> }</td>
137
+ </tr>
138
+ } @empty { <tr><td colspan="4" class="jc-muted">None yet.</td></tr> }
139
+ </tbody>
140
+ </table>
141
+ </section>`,
142
+ isInline: true,
143
+ dependencies: [
144
+ {
145
+ kind: "directive",
146
+ type: RouterLink,
147
+ selector: "[routerLink]",
148
+ inputs: [
149
+ "target",
150
+ "queryParams",
151
+ "fragment",
152
+ "queryParamsHandling",
153
+ "state",
154
+ "info",
155
+ "relativeTo",
156
+ "preserveFragment",
157
+ "skipLocationChange",
158
+ "replaceUrl",
159
+ "browserUrl",
160
+ "routerLink"
161
+ ]
162
+ },
163
+ {
164
+ kind: "ngmodule",
165
+ type: FormsModule
166
+ },
167
+ {
168
+ kind: "directive",
169
+ type: i1.ɵNgNoValidate,
170
+ selector: "form:not([ngNoForm]):not([ngNativeValidate])"
171
+ },
172
+ {
173
+ kind: "directive",
174
+ type: i1.DefaultValueAccessor,
175
+ selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
176
+ },
177
+ {
178
+ kind: "directive",
179
+ type: i1.NgControlStatus,
180
+ selector: "[formControlName],[ngModel],[formControl]"
181
+ },
182
+ {
183
+ kind: "directive",
184
+ type: i1.NgControlStatusGroup,
185
+ selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]"
186
+ },
187
+ {
188
+ kind: "directive",
189
+ type: i1.MaxLengthValidator,
190
+ selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]",
191
+ inputs: ["maxlength"]
192
+ },
193
+ {
194
+ kind: "directive",
195
+ type: i1.NgModel,
196
+ selector: "[ngModel]:not([formControlName]):not([formControl])",
197
+ inputs: [
198
+ "name",
199
+ "disabled",
200
+ "ngModel",
201
+ "ngModelOptions"
202
+ ],
203
+ outputs: ["ngModelChange"],
204
+ exportAs: ["ngModel"]
205
+ },
206
+ {
207
+ kind: "directive",
208
+ type: i1.NgForm,
209
+ selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]",
210
+ inputs: ["ngFormOptions"],
211
+ outputs: ["ngSubmit"],
212
+ exportAs: ["ngForm"]
213
+ },
214
+ {
215
+ kind: "ngmodule",
216
+ type: MatButtonModule
217
+ },
218
+ {
219
+ kind: "component",
220
+ type: i2.MatButton,
221
+ selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
222
+ inputs: ["matButton"],
223
+ exportAs: ["matButton", "matAnchor"]
224
+ },
225
+ {
226
+ kind: "ngmodule",
227
+ type: MatFormFieldModule
228
+ },
229
+ {
230
+ kind: "component",
231
+ type: i3.MatFormField,
232
+ selector: "mat-form-field",
233
+ inputs: [
234
+ "hideRequiredMarker",
235
+ "color",
236
+ "floatLabel",
237
+ "appearance",
238
+ "subscriptSizing",
239
+ "hintLabel"
240
+ ],
241
+ exportAs: ["matFormField"]
242
+ },
243
+ {
244
+ kind: "directive",
245
+ type: i3.MatLabel,
246
+ selector: "mat-label"
247
+ },
248
+ {
249
+ kind: "ngmodule",
250
+ type: MatInputModule
251
+ },
252
+ {
253
+ kind: "directive",
254
+ type: i4.MatInput,
255
+ selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]",
256
+ inputs: [
257
+ "disabled",
258
+ "id",
259
+ "placeholder",
260
+ "name",
261
+ "required",
262
+ "type",
263
+ "errorStateMatcher",
264
+ "aria-describedby",
265
+ "value",
266
+ "readonly",
267
+ "disabledInteractive"
268
+ ],
269
+ exportAs: ["matInput"]
270
+ },
271
+ {
272
+ kind: "ngmodule",
273
+ type: MatProgressBarModule
274
+ },
275
+ {
276
+ kind: "component",
277
+ type: i5.MatProgressBar,
278
+ selector: "mat-progress-bar",
279
+ inputs: [
280
+ "color",
281
+ "value",
282
+ "bufferValue",
283
+ "mode"
284
+ ],
285
+ outputs: ["animationEnd"],
286
+ exportAs: ["matProgressBar"]
287
+ },
288
+ {
289
+ kind: "component",
290
+ type: ContextBar,
291
+ selector: "jc-context-bar"
292
+ },
293
+ {
294
+ kind: "pipe",
295
+ type: LinkPipe,
296
+ name: "jcLink"
297
+ },
298
+ {
299
+ kind: "pipe",
300
+ type: DatePipe,
301
+ name: "date"
302
+ },
303
+ {
304
+ kind: "pipe",
305
+ type: AgoPipe,
306
+ name: "ago"
307
+ }
308
+ ],
309
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
310
+ });
311
+ };
312
+ i0.ɵɵngDeclareClassMetadata({
313
+ minVersion: "12.0.0",
314
+ version: "22.2.4",
315
+ ngImport: i0,
316
+ type: ApprovalsPage,
317
+ decorators: [{
318
+ type: Component,
319
+ args: [{
320
+ changeDetection: ChangeDetectionStrategy.OnPush,
321
+ imports: [
322
+ LinkPipe,
323
+ RouterLink,
324
+ DatePipe,
325
+ FormsModule,
326
+ MatButtonModule,
327
+ MatFormFieldModule,
328
+ MatInputModule,
329
+ MatProgressBarModule,
330
+ ContextBar,
331
+ AgoPipe
332
+ ],
333
+ template: `
334
+ <jc-context-bar><h1>Approvals</h1></jc-context-bar>
335
+ @if (pending.isLoading() && !pending.value()) { <mat-progress-bar mode="indeterminate" /> }
336
+ @if (pending.error()) { <p class="jc-error">{{ error() }}</p> }
337
+
338
+ <section class="jc-card" data-testid="approvals-pending">
339
+ <h2>Waiting</h2>
340
+ @for (r of pending.value()?.items ?? []; track r.id) {
341
+ <div class="jc-list-row" [attr.data-testid]="'approval-' + r.id">
342
+ <div>
343
+ <strong>{{ r.action }}</strong> on <a [routerLink]="['agents', r.agentId] | jcLink" [queryParams]="ctx.keep()">{{ r.hostname }}</a>
344
+ <span class="jc-badge" [class.jc-health-unhealthy]="r.risk === 'High'" [class.jc-health-degraded]="r.risk !== 'High'">{{ r.risk }} risk</span>
345
+ @if (describe(r); as d) { <div class="jc-mono jc-small">{{ d }}</div> }
346
+ <div class="jc-small">{{ r.requestedBy }}, {{ r.requestedAt | ago }}: {{ r.reason }}</div>
347
+ <div class="jc-muted jc-small">{{ r.policy === 'SecondPerson' ? 'Needs an admin other than ' + r.requestedBy : 'Needs an admin' }}. Expires {{ r.expiresAt | date: 'HH:mm' }}.</div>
348
+ </div>
349
+ <form class="jc-form" (ngSubmit)="approve(r)">
350
+ <mat-form-field subscriptSizing="dynamic" class="jc-field-md"><mat-label>Comment</mat-label>
351
+ <input matInput [name]="'comment-' + r.id" [attr.data-testid]="'approval-comment-' + r.id" maxlength="500" [ngModel]="comments()[r.id] ?? ''" (ngModelChange)="comment(r.id, $event)">
352
+ </mat-form-field>
353
+ <button mat-flat-button type="submit" [attr.data-testid]="'approve-' + r.id" [disabled]="busy() === r.id">Approve</button>
354
+ <button mat-stroked-button type="button" [attr.data-testid]="'reject-' + r.id" [disabled]="busy() === r.id" (click)="reject(r)">Reject</button>
355
+ @if (errors()[r.id]; as e) { <span class="jc-error" [attr.data-testid]="'approval-error-' + r.id">{{ e }}</span> }
356
+ </form>
357
+ </div>
358
+ } @empty { <p class="jc-muted" data-testid="approvals-none">Nothing is waiting for approval.</p> }
359
+ </section>
360
+
361
+ <section class="jc-card">
362
+ <h2>Decided lately</h2>
363
+ <table class="jc-table" data-testid="approvals-decided">
364
+ <thead><tr><th>Asked</th><th>Action</th><th>By</th><th>Decision</th></tr></thead>
365
+ <tbody>
366
+ @for (r of decided(); track r.id) {
367
+ <tr>
368
+ <td class="jc-nowrap">{{ r.requestedAt | date: 'MMM d, HH:mm' }}</td>
369
+ <td><strong>{{ r.action }}</strong> on <a [routerLink]="['agents', r.agentId] | jcLink" [queryParams]="ctx.keep()">{{ r.hostname }}</a></td>
370
+ <td>{{ r.requestedBy }}</td>
371
+ <td>{{ r.state }}@if (r.decidedBy) { by {{ r.decidedBy }} }@if (r.command) { · command {{ r.command.state }} }@if (r.comment) { <div class="jc-small">{{ r.comment }}</div> }</td>
372
+ </tr>
373
+ } @empty { <tr><td colspan="4" class="jc-muted">None yet.</td></tr> }
374
+ </tbody>
375
+ </table>
376
+ </section>`
377
+ }]
378
+ }],
379
+ ctorParameters: () => []
380
+ });
381
+ export { ApprovalsPage };
382
+
383
+ //# sourceMappingURL=juice-js-observability-approvals.page-DXi3O9Ol.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"juice-js-observability-approvals.page-DXi3O9Ol.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/pages/approvals.page.ts"],"sourcesContent":["import { LinkPipe } from '../core/options';\nimport { ChangeDetectionStrategy, Component, computed, effect, inject, signal } 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 { RouterLink } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { ApiService } from '../core/api.service';\nimport { ContextService } from '../core/context.service';\nimport { ActionRequest } from '../core/models';\nimport { AgoPipe } from '../shared/format';\nimport { apiResource } from '../shared/resource';\nimport { problemText } from '../shared/telemetry';\nimport { ContextBar } from '../shared/ui';\n\n/**\n * Requests waiting for approval, across every agent (roadmap Phase 8), and the ones decided lately. Admins approve or reject; under a\n * second-person policy, not their own. Approving signs the command and the agent runs it at its next poll.\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [LinkPipe, RouterLink, DatePipe, FormsModule, MatButtonModule, MatFormFieldModule, MatInputModule, MatProgressBarModule, ContextBar, AgoPipe],\n template: `\n <jc-context-bar><h1>Approvals</h1></jc-context-bar>\n @if (pending.isLoading() && !pending.value()) { <mat-progress-bar mode=\"indeterminate\" /> }\n @if (pending.error()) { <p class=\"jc-error\">{{ error() }}</p> }\n\n <section class=\"jc-card\" data-testid=\"approvals-pending\">\n <h2>Waiting</h2>\n @for (r of pending.value()?.items ?? []; track r.id) {\n <div class=\"jc-list-row\" [attr.data-testid]=\"'approval-' + r.id\">\n <div>\n <strong>{{ r.action }}</strong> on <a [routerLink]=\"['agents', r.agentId] | jcLink\" [queryParams]=\"ctx.keep()\">{{ r.hostname }}</a>\n <span class=\"jc-badge\" [class.jc-health-unhealthy]=\"r.risk === 'High'\" [class.jc-health-degraded]=\"r.risk !== 'High'\">{{ r.risk }} risk</span>\n @if (describe(r); as d) { <div class=\"jc-mono jc-small\">{{ d }}</div> }\n <div class=\"jc-small\">{{ r.requestedBy }}, {{ r.requestedAt | ago }}: {{ r.reason }}</div>\n <div class=\"jc-muted jc-small\">{{ r.policy === 'SecondPerson' ? 'Needs an admin other than ' + r.requestedBy : 'Needs an admin' }}. Expires {{ r.expiresAt | date: 'HH:mm' }}.</div>\n </div>\n <form class=\"jc-form\" (ngSubmit)=\"approve(r)\">\n <mat-form-field subscriptSizing=\"dynamic\" class=\"jc-field-md\"><mat-label>Comment</mat-label>\n <input matInput [name]=\"'comment-' + r.id\" [attr.data-testid]=\"'approval-comment-' + r.id\" maxlength=\"500\" [ngModel]=\"comments()[r.id] ?? ''\" (ngModelChange)=\"comment(r.id, $event)\">\n </mat-form-field>\n <button mat-flat-button type=\"submit\" [attr.data-testid]=\"'approve-' + r.id\" [disabled]=\"busy() === r.id\">Approve</button>\n <button mat-stroked-button type=\"button\" [attr.data-testid]=\"'reject-' + r.id\" [disabled]=\"busy() === r.id\" (click)=\"reject(r)\">Reject</button>\n @if (errors()[r.id]; as e) { <span class=\"jc-error\" [attr.data-testid]=\"'approval-error-' + r.id\">{{ e }}</span> }\n </form>\n </div>\n } @empty { <p class=\"jc-muted\" data-testid=\"approvals-none\">Nothing is waiting for approval.</p> }\n </section>\n\n <section class=\"jc-card\">\n <h2>Decided lately</h2>\n <table class=\"jc-table\" data-testid=\"approvals-decided\">\n <thead><tr><th>Asked</th><th>Action</th><th>By</th><th>Decision</th></tr></thead>\n <tbody>\n @for (r of decided(); track r.id) {\n <tr>\n <td class=\"jc-nowrap\">{{ r.requestedAt | date: 'MMM d, HH:mm' }}</td>\n <td><strong>{{ r.action }}</strong> on <a [routerLink]=\"['agents', r.agentId] | jcLink\" [queryParams]=\"ctx.keep()\">{{ r.hostname }}</a></td>\n <td>{{ r.requestedBy }}</td>\n <td>{{ r.state }}@if (r.decidedBy) { by {{ r.decidedBy }} }@if (r.command) { · command {{ r.command.state }} }@if (r.comment) { <div class=\"jc-small\">{{ r.comment }}</div> }</td>\n </tr>\n } @empty { <tr><td colspan=\"4\" class=\"jc-muted\">None yet.</td></tr> }\n </tbody>\n </table>\n </section>`,\n})\nexport class ApprovalsPage {\n protected readonly ctx = inject(ContextService);\n private readonly api = inject(ApiService);\n protected readonly busy = signal<string | null>(null);\n protected readonly comments = signal<Record<string, string>>({});\n protected readonly errors = signal<Record<string, string>>({});\n\n protected readonly pending = apiResource({ stream: () => this.api.actionRequests({ state: 'Pending' }) });\n private readonly recent = apiResource({ stream: () => this.api.actionRequests({ limit: 30 }) });\n protected readonly decided = computed(() => (this.recent.value()?.items ?? []).filter(r => r.state !== 'Pending'));\n protected readonly error = computed(() => problemText(this.pending.error()));\n\n constructor() {\n // Others ask and decide too: look again every 10 seconds.\n effect(onCleanup => {\n this.pending.value();\n const timer = setTimeout(() => { this.pending.reload(); this.recent.reload(); }, 10_000);\n onCleanup(() => clearTimeout(timer));\n });\n }\n\n protected describe(r: ActionRequest): string {\n return Object.entries(r.parameters ?? {}).map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`).join(', ');\n }\n\n protected comment(id: string, text: string) { this.comments.update(c => ({ ...c, [id]: text })); }\n\n private decide(r: ActionRequest, call: Observable<ActionRequest>) {\n this.busy.set(r.id);\n this.errors.update(e => ({ ...e, [r.id]: '' }));\n call.subscribe({\n next: () => { this.busy.set(null); this.pending.reload(); this.recent.reload(); },\n error: e => {\n this.busy.set(null);\n const status = (e as { status?: number }).status;\n const text = status === 403 && r.policy === 'SecondPerson' ? `An admin other than ${r.requestedBy} has to approve this.`\n : status === 403 ? 'Deciding needs the admin role.' : problemText(e);\n this.errors.update(x => ({ ...x, [r.id]: text }));\n },\n });\n }\n\n protected approve(r: ActionRequest) { this.decide(r, this.api.approveRequest(r.id, (this.comments()[r.id] ?? '').trim())); }\n\n protected reject(r: ActionRequest) {\n const comment = (this.comments()[r.id] ?? '').trim();\n if (!comment) { this.errors.update(e => ({ ...e, [r.id]: 'Say why in the comment.' })); return; }\n this.decide(r, this.api.rejectRequest(r.id, comment));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsEA,IAAa,gBAAb,MAAa,cAAa;CACL,MAAM,OAAO,cAAc;CAC7B,MAAM,OAAO,UAAU;CACrB,OAAO,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,WAAW,OAA+B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC7C,SAAS,OAA+B,CAAA,GAAG,GAAA,YAAA,CAA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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,MAAlI;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAsG;IAAO,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AA8C1I,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAhDzB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAoB;IAAgB;IAAsB;IAAY;GAAO;GACrJ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CX,CAAA"}
@@ -276,6 +276,28 @@ var ApiService = class ApiService {
276
276
  parameters
277
277
  });
278
278
  }
279
+ requestAction(agentId, action, parameters, reason) {
280
+ return this.once(`/agents/${agentId}/action-requests`, {
281
+ action,
282
+ parameters,
283
+ reason
284
+ });
285
+ }
286
+ actionRequests(query = {}) {
287
+ return this.get("/action-requests", {
288
+ limit: 100,
289
+ ...query
290
+ });
291
+ }
292
+ approveRequest(id, comment) {
293
+ return this.send("POST", `/action-requests/${id}/approval`, { comment });
294
+ }
295
+ rejectRequest(id, comment) {
296
+ return this.send("POST", `/action-requests/${id}/rejection`, { comment });
297
+ }
298
+ cancelRequest(id) {
299
+ return this.send("POST", `/action-requests/${id}/cancellation`, {});
300
+ }
279
301
  agentCommands(id, cursor) {
280
302
  return this.get(`/agents/${id}/commands`, {
281
303
  limit: 25,
@@ -495,7 +517,8 @@ const OBSERVABILITY_ROUTES = [
495
517
  page("incidents", "Incidents", () => import("./juice-js-observability-incidents.page-Bx7afoIh.mjs").then((m) => m.IncidentsPage)),
496
518
  page("incidents/:id", "Incident", () => import("./juice-js-observability-incident.page-CayeZdF_.mjs").then((m) => m.IncidentPage)),
497
519
  page("agents", "Agents", () => import("./juice-js-observability-agents.page-C9WjP1nl.mjs").then((m) => m.AgentsPage)),
498
- page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-VsTEvbSN.mjs").then((m) => m.AgentPage)),
520
+ page("agents/:id", "Agent", () => import("./juice-js-observability-agent.page-D6nP3YbF.mjs").then((m) => m.AgentPage)),
521
+ page("approvals", "Approvals", () => import("./juice-js-observability-approvals.page-DXi3O9Ol.mjs").then((m) => m.ApprovalsPage)),
499
522
  page("timeline", "Timeline", () => import("./juice-js-observability-timeline.page-DhU78o_M.mjs").then((m) => m.TimelinePage)),
500
523
  page("load-runs", "Load runs", () => import("./juice-js-observability-load-runs.page-ByWrvCra.mjs").then((m) => m.LoadRunsPage))
501
524
  ];
@@ -581,6 +604,12 @@ function observabilityMenus(basePath = "/", order = 1) {
581
604
  icon: "smart_toy",
582
605
  routerLink: link("agents")
583
606
  },
607
+ {
608
+ id: "approvals",
609
+ label: "Approvals",
610
+ icon: "approval",
611
+ routerLink: link("approvals")
612
+ },
584
613
  {
585
614
  id: "timeline",
586
615
  label: "Timeline",
@@ -1 +1 @@
1
- {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders } from '@angular/core';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/** Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n Agent, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ].map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;AAeA,MAAa,wBAAwB,IAAI,eAAqC,yBAAyB;CACrG,YAAY;CACZ,gBAAgB;EAAE,SAAS;EAAI,UAAU;EAAK,WAAW;CAAI;AAC9D,CAAA;AAGD,SAAgB,0BAA0B,UAAyC,CAAA,GAAE;CACnF,OAAO,yBAAyB,CAC9B;EACE,SAAS;EACT,UAAU;GACR,SAAS,QAAQ,WAAW;GAC5B,UAAU,QAAQ,YAAY;GAC9B,WAAW,QAAQ,aAAa;EACF;CACjC,CACF,CAAA;AACH;AAGA,SAAgB,kBAAkB,UAAgB;CAChD,MAAM,UAAU,SAAS,KAAI,CAAE,CAAC,QAAQ,cAAc,EAAE;CACxD,OAAO,UAAU,IAAI,YAAY;AACnC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AY,MAAM;GAAW,YAAY,KAAK,UAAU;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAS,YAAY,KAAK,WAAW;EAAC;CACpF,CAAA,CAAC,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
1
+ {"version":3,"file":"juice-js-observability.mjs","names":[],"sources":["../../../../projects/juice-js/observability/src/lib/core/options.ts","../../../../projects/juice-js/observability/src/lib/core/api.service.ts","../../../../projects/juice-js/observability/src/lib/core/context.service.ts","../../../../projects/juice-js/observability/src/lib/observability.routes.ts"],"sourcesContent":["import { EnvironmentProviders, Injectable, InjectionToken, Pipe, PipeTransform, inject, makeEnvironmentProviders } from '@angular/core';\n\n/** How the host app mounts Juice Observability. */\nexport interface ObservabilityOptions {\n /** The Juice API origin; empty when the API serves the app (same origin). */\n apiBase: string;\n /** Where the host mounts {@link OBSERVABILITY_ROUTES}: `/` for the whole app, or a path such as `/observability`. */\n basePath: string;\n /**\n * A link to the audit records of a trace, shown on the trace page: for the Juice Audit pages mounted at `/audit`,\n * `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.\n */\n auditLink?: ((traceId: string) => unknown[] | string | null) | null;\n}\n\nexport const OBSERVABILITY_OPTIONS = new InjectionToken<ObservabilityOptions>('OBSERVABILITY_OPTIONS', {\n providedIn: 'root',\n factory: () => ({ apiBase: '', basePath: '/', auditLink: null }),\n});\n\n/** Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. */\nexport function provideJuiceObservability(options: Partial<ObservabilityOptions> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n {\n provide: OBSERVABILITY_OPTIONS,\n useValue: {\n apiBase: options.apiBase ?? '',\n basePath: options.basePath ?? '/',\n auditLink: options.auditLink ?? null,\n } satisfies ObservabilityOptions,\n },\n ]);\n}\n\n/** `/observability/` → `/observability`; `` and `/` → `/`. */\nexport function normalizeBasePath(basePath: string): string {\n const trimmed = basePath.trim().replace(/^\\/+|\\/+$/g, '');\n return trimmed ? `/${trimmed}` : '/';\n}\n\n/** Router links to the pages, under the host's mount path. */\n@Injectable({ providedIn: 'root' })\nexport class ObservabilityLinks {\n private readonly options = inject(OBSERVABILITY_OPTIONS);\n readonly base = normalizeBasePath(this.options.basePath);\n\n /** `to('services', id)` → `['/observability', 'services', id]`. */\n to(...segments: unknown[]): unknown[] { return [this.base, ...segments]; }\n\n /** The host's link to the audit records of a trace, if it gave one. */\n audit(traceId: string | null | undefined): { route: unknown[] } | { href: string } | null {\n if (!traceId || !this.options.auditLink) return null;\n const link = this.options.auditLink(traceId);\n if (!link) return null;\n return typeof link === 'string' ? { href: link } : { route: link };\n }\n}\n\n/** `['services', id] | jcLink`: the same as {@link ObservabilityLinks.to} in a template. */\n@Pipe({ name: 'jcLink' })\nexport class LinkPipe implements PipeTransform {\n private readonly links = inject(ObservabilityLinks);\n transform(segments: unknown[]): unknown[] { return this.links.to(...segments); }\n}\n","import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { EMPTY, Observable, expand, map, reduce, shareReplay, switchMap } from 'rxjs';\nimport { OBSERVABILITY_OPTIONS } from './options';\nimport {\n ActionRequest, Agent, AgentActions, AgentCommand, AgentPackage, EnrollmentToken, AlertDetail, AlertNotifications, Alert, AllowlistEntry, Application, Channel, ChannelTestResult, Delivery, EscalationPolicy, IncidentDetail, IncidentEvent, IncidentSummary, Silence, DependencyEvidence, DependencyStatsPage, DeploymentEnvironment, LoadRun, LoadRunResults, Related, Timeline, Health, LogRecord, MetricInfo, Operation,\n Page, ResourceDetail, ResourceSummary, Rule, SearchHit, Series, Capacity, ServiceStats, Tenant, TelemetryPage, Topology, Trace,\n TraceSummary,\n} from './models';\n\n/**\n * A random UUID v4 for `Idempotency-Key`. Not `crypto.randomUUID()`: browsers offer it only in a secure context (HTTPS or localhost), so it\n * throws on a Console opened over plain HTTP at the machine's address, as the local stack is. `getRandomValues` works everywhere.\n */\nexport function idempotencyKey(): string {\n const b = crypto.getRandomValues(new Uint8Array(16));\n b[6] = (b[6] & 0x0f) | 0x40;\n b[8] = (b[8] & 0x3f) | 0x80;\n const hex = Array.from(b, x => x.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n\nexport type Query =Record<string, string | number | boolean | string[] | null | undefined>;\n\n/**\n * The Console's only backend: the Juice API (Console requirements §3). One deployment serves one tenant, the one the\n * signed-in user's token names.\n */\n@Injectable({ providedIn: 'root' })\nexport class ApiService {\n private readonly http = inject(HttpClient);\n private readonly base = `${inject(OBSERVABILITY_OPTIONS).apiBase}/api/v1`;\n\n /** The caller's tenant, fetched once. */\n readonly tenant$: Observable<Tenant> = this.http.get<Page<Tenant>>(`${this.base}/tenants`).pipe(\n map(page => {\n if (page.items.length === 0) throw new Error('No tenant is authorized for this user.');\n return page.items[0];\n }),\n shareReplay(1),\n );\n\n private get<T>(path: string, query: Query = {}): Observable<T> {\n let params = new HttpParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === null || value === undefined || value === '') continue;\n for (const item of Array.isArray(value) ? value : [value]) params = params.append(key, String(item));\n }\n return this.tenant$.pipe(switchMap(t => this.http.get<T>(`${this.base}/tenants/${t.id}${path}`, { params })));\n }\n\n /** A change. `Idempotency-Key` on what can be retried, so a repeated click or a lost response doesn't do it twice. */\n private send<T>(method: 'POST' | 'PUT' | 'DELETE', path: string, body?: unknown, headers: Record<string, string> = {}): Observable<T> {\n return this.tenant$.pipe(switchMap(t => this.http.request<T>(method, `${this.base}/tenants/${t.id}${path}`, { body, headers })));\n }\n private once<T>(path: string, body: unknown): Observable<T> { return this.send<T>('POST', path, body, { 'Idempotency-Key': idempotencyKey() }); }\n\n /** Every page of a cursor-paged list (bounded: at most `maxPages` requests). */\n private all<T>(path: string, query: Query = {}, maxPages = 25): Observable<Page<T>> {\n let pages = 0;\n return this.get<Page<T>>(path, { ...query, limit: 200 }).pipe(\n expand(page => page.nextCursor && ++pages < maxPages ? this.get<Page<T>>(path, { ...query, limit: 200, cursor: page.nextCursor }) : EMPTY),\n reduce((all, page) => ({ items: [...all.items, ...page.items], nextCursor: page.nextCursor }), { items: [] as T[], nextCursor: null as string | null }),\n );\n }\n\n environments() { return this.get<Page<DeploymentEnvironment>>('/environments'); }\n applications() { return this.get<Page<Application>>('/applications', { limit: 200 }); }\n resources(type?: string) { return this.all<ResourceSummary>('/resources', { type }); }\n resource(id: string) { return this.get<ResourceDetail>(`/resources/${id}`); }\n health(query: Query) { return this.all<Health>('/health', query); }\n topology(environment?: string | null) { return this.get<Topology>('/topology', { environment }); }\n\n rules() { return this.get<Page<Rule>>('/rules', { limit: 200 }); }\n createRule(definition: unknown) { return this.send<Rule>('POST', '/rules', definition); }\n /** With the rule's etag, so a change made since it was read isn't overwritten. */\n updateRule(key: string, definition: unknown, etag: string) { return this.send<Rule>('PUT', `/rules/${key}`, definition, { 'If-Match': `\"${etag}\"` }); }\n\n channels() { return this.get<Page<Channel>>('/webhooks'); }\n createChannel(body: unknown) { return this.send<Channel>('POST', '/webhooks', body); }\n updateChannel(id: string, body: unknown) { return this.send<Channel>('PUT', `/webhooks/${id}`, body); }\n deliveries(id: string, query: Query = {}) { return this.get<Page<Delivery>>(`/webhooks/${id}/deliveries`, { limit: 50, ...query }); }\n testChannel(id: string) { return this.send<ChannelTestResult>('POST', `/webhooks/${id}/test`); }\n retryDelivery(channelId: string, deliveryId: string) { return this.send<Delivery>('POST', `/webhooks/${channelId}/deliveries/${deliveryId}/retry`); }\n allowlist() { return this.get<Page<AllowlistEntry>>('/webhooks/allowlist'); }\n putAllowlist(destination: string, ports: number[]) { return this.send<AllowlistEntry>('PUT', '/webhooks/allowlist', { destination, ports }); }\n removeAllowlist(destination: string) { return this.send<void>('DELETE', `/webhooks/allowlist?destination=${encodeURIComponent(destination)}`); }\n\n escalationPolicies() { return this.get<Page<EscalationPolicy>>('/escalation-policies'); }\n createEscalationPolicy(body: unknown) { return this.send<EscalationPolicy>('POST', '/escalation-policies', body); }\n updateEscalationPolicy(key: string, body: unknown) { return this.send<EscalationPolicy>('PUT', `/escalation-policies/${key}`, body); }\n\n silences(query: Query = {}) { return this.get<Page<Silence>>('/silences', { limit: 200, ...query }); }\n createSilence(body: unknown) { return this.once<Silence>('/silences', body); }\n cancelSilence(id: string) { return this.send<void>('DELETE', `/silences/${id}`); }\n\n incidents(query: Query = {}) { return this.get<Page<IncidentSummary>>('/incidents', { limit: 100, ...query }); }\n incident(id: string) { return this.get<IncidentDetail>(`/incidents/${id}`); }\n createIncident(body: unknown) { return this.once<IncidentSummary>('/incidents', body); }\n moveIncident(id: string, to: string, comment: string) { return this.once<IncidentSummary>(`/incidents/${id}/transitions`, { to, comment }); }\n addIncidentNote(id: string, text: string) { return this.once<IncidentEvent>(`/incidents/${id}/notes`, { text }); }\n removeIncidentAlert(id: string, alertId: string) { return this.send<void>('DELETE', `/incidents/${id}/alerts/${alertId}`); }\n /** Active agents, or with `all` the revoked ones too (at most 500). */\n agents(all = false) { return this.get<Page<Agent>>('/agents', { all: all || null }); }\n agent(id: string) { return this.get<Agent>(`/agents/${id}`); }\n createEnrollmentToken(purpose: string, expiresInMinutes: number) { return this.send<EnrollmentToken>('POST', '/agents/enrollment-tokens', { purpose, expiresInMinutes }); }\n revokeAgent(id: string, reason: string) { return this.send<Agent>('POST', `/agents/${id}/revocation`, { reason }); }\n /** What the agent reported it can run, custom actions included, with what its host permits; the built-ins if it never reported. */\n agentActions(id: string) { return this.get<AgentActions>(`/agents/${id}/actions`); }\n agentPackages() { return this.get<Page<AgentPackage>>('/agents/packages'); }\n /** Idempotent: a repeated click or a lost response signs one command, not two. */\n issueCommand(id: string, action: string, parameters: Record<string, unknown>) { return this.once<AgentCommand>(`/agents/${id}/commands`, { action, parameters }); }\n /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */\n requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string) {\n return this.once<ActionRequest>(`/agents/${agentId}/action-requests`, { action, parameters, reason });\n }\n actionRequests(query: Query = {}) { return this.get<Page<ActionRequest>>('/action-requests', { limit: 100, ...query }); }\n approveRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/approval`, { comment }); }\n rejectRequest(id: string, comment: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/rejection`, { comment }); }\n cancelRequest(id: string) { return this.send<ActionRequest>('POST', `/action-requests/${id}/cancellation`, {}); }\n agentCommands(id: string, cursor?: string | null) { return this.get<Page<AgentCommand>>(`/agents/${id}/commands`, { limit: 25, cursor }); }\n\n alertNotifications(id: string) { return this.get<AlertNotifications>(`/alerts/${id}/notifications`); }\n\n /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */\n alerts(query: Query) { return this.get<Page<Alert>>('/alerts', { limit: 100, ...query }); }\n /** Every alert matching the query (bounded, like the other complete lists). */\n allAlerts(query: Query) { return this.all<Alert>('/alerts', query); }\n alert(id: string) { return this.get<AlertDetail>(`/alerts/${id}`); }\n acknowledge(id: string, comment: string): Observable<Alert> {\n return this.tenant$.pipe(switchMap(t => this.http.post<Alert>(`${this.base}/tenants/${t.id}/alerts/${id}/acknowledgement`,\n { comment }, { headers: { 'Idempotency-Key': idempotencyKey() } })));\n }\n\n traces(query: Query) { return this.get<TelemetryPage<TraceSummary>>('/telemetry/traces', query); }\n trace(traceId: string) { return this.get<Trace>(`/telemetry/traces/${traceId}`); }\n logs(query: Query) { return this.get<TelemetryPage<LogRecord>>('/telemetry/logs', query); }\n operations(query: Query) { return this.get<TelemetryPage<Operation>>('/telemetry/operations', query); }\n metrics(query: Query) { return this.get<TelemetryPage<MetricInfo>>('/telemetry/metrics', query); }\n series(query: Query) { return this.get<Series>('/telemetry/metrics/series', query); }\n serviceStats(query: Query) { return this.get<ServiceStats>('/telemetry/service-stats', query); }\n capacity(query: Query) { return this.get<Capacity>('/telemetry/capacity', query); }\n timeline(query: Query) { return this.get<Timeline>('/timeline', query); }\n relatedToAlert(id: string) { return this.get<Related>(`/alerts/${id}/related`); }\n loadRuns(query: Query) { return this.get<Page<LoadRun>>('/load-runs', query); }\n loadRunResults(id: string) { return this.get<LoadRunResults>(`/load-runs/${id}/results`); }\n dependencyStats(query: Query) { return this.get<DependencyStatsPage>('/telemetry/dependencies', query); }\n dependency(id: string, query: Query) { return this.get<DependencyEvidence>(`/telemetry/dependencies/${id}`, query); }\n search(q: string) { return this.get<TelemetryPage<SearchHit>>('/search', { q }); }\n}\n","import { Injectable, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { ActivatedRoute, NavigationEnd, Params, Router } from '@angular/router';\nimport { filter, map, startWith } from 'rxjs';\n\nexport const RANGES: Record<string, number> = {\n '15m': 15 * 60_000, '1h': 3_600_000, '6h': 6 * 3_600_000, '24h': 24 * 3_600_000, '7d': 7 * 24 * 3_600_000,\n};\n\n/** Search ranges are at most 24 hours (the API's bound); series and operations take up to 7 days. */\nexport const MAX_SEARCH_MS = RANGES['24h'];\n\n/**\n * The investigation context that follows the user between pages (Console requirements §17): environment and time\n * range. It lives in the URL (`env`, and `range` or `from`/`to`), so every page is a deep link and the browser's back\n * button restores it.\n */\n@Injectable({ providedIn: 'root' })\nexport class ContextService {\n private readonly router = inject(Router);\n\n // Created on first use, after the first navigation may already have ended: start from the current URL.\n private readonly params = toSignal(this.router.events.pipe(\n filter(e => e instanceof NavigationEnd),\n startWith(null),\n map(() => this.leaf().snapshot.queryParams),\n ), { initialValue: {} as Params });\n\n readonly environment = computed(() => (this.params()['env'] as string | undefined) ?? '');\n readonly range = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? 'custom' : ((p['range'] as string | undefined) ?? '1h');\n });\n readonly absolute = computed(() => {\n const p = this.params();\n return p['from'] && p['to'] ? { from: p['from'] as string, to: p['to'] as string } : null;\n });\n\n /** The window as ISO strings, evaluated now for a relative range. */\n window(maxMs?: number): { from: string; to: string } {\n const absolute = this.absolute();\n if (absolute) return absolute;\n const to = Date.now();\n const span = Math.min(RANGES[this.range()] ?? RANGES['1h'], maxMs ?? Number.MAX_SAFE_INTEGER);\n return { from: new Date(to - span).toISOString(), to: new Date(to).toISOString() };\n }\n\n /** Query parameters for a link: the context plus the target page's own. */\n keep(extra: Params = {}): Params {\n const p = this.params();\n const context: Params = {};\n for (const key of ['env', 'range', 'from', 'to']) if (p[key]) context[key] = p[key];\n return { ...context, ...extra };\n }\n\n /** Changes the context on the current page, keeping its other parameters. */\n set(change: { env?: string | null; range?: string | null; from?: string | null; to?: string | null }) {\n const queryParams: Params = { ...change };\n if (change.range) Object.assign(queryParams, { from: null, to: null });\n void this.router.navigate([], { relativeTo: this.leaf(), queryParams, queryParamsHandling: 'merge' });\n }\n\n /** A time window centred on a moment, for \"around this span\" links. */\n around(at: string, durationMs: number, paddingMs = 5 * 60_000): Params {\n const start = new Date(at).getTime();\n return this.keep({\n from: new Date(start - paddingMs).toISOString(),\n to: new Date(start + durationMs + paddingMs).toISOString(),\n range: null,\n });\n }\n\n private leaf(): ActivatedRoute {\n let route = this.router.routerState.root;\n while (route.firstChild) route = route.firstChild;\n return route;\n }\n}\n","import { Routes } from '@angular/router';\nimport { Menus } from '@juice-js/core';\nimport { normalizeBasePath } from './core/options';\n\nfunction page(path: string, title: string, load: Routes[number]['loadComponent']): Routes[number] {\n return { path, title: `${title} · Juice Observability`, loadComponent: load };\n}\n\n/**\n * The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and\n * rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.\n * The host mounts them at its `basePath` (see {@link provideJuiceObservability}) and adds its own guards.\n */\nexport const OBSERVABILITY_ROUTES: Routes = [\n page('', 'Overview', () => import('./pages/overview.page').then(m => m.OverviewPage)),\n page('services', 'Services', () => import('./pages/services.page').then(m => m.ServicesPage)),\n page('services/:id', 'Service', () => import('./pages/service.page').then(m => m.ServicePage)),\n page('traces', 'Traces', () => import('./pages/traces.page').then(m => m.TracesPage)),\n page('traces/:traceId', 'Trace', () => import('./pages/trace.page').then(m => m.TracePage)),\n page('topology', 'Dependencies', () => import('./pages/topology.page').then(m => m.TopologyPage)),\n page('logs', 'Logs', () => import('./pages/logs.page').then(m => m.LogsPage)),\n page('metrics', 'Metrics', () => import('./pages/metrics.page').then(m => m.MetricsPage)),\n page('resources', 'Resources', () => import('./pages/resources.page').then(m => m.ResourcesPage)),\n page('resources/:id', 'Resource', () => import('./pages/resource.page').then(m => m.ResourcePage)),\n page('alerts', 'Alerts', () => import('./pages/alerts.page').then(m => m.AlertsPage)),\n page('alerts/:id', 'Alert', () => import('./pages/alert.page').then(m => m.AlertPage)),\n page('rules', 'Rules', () => import('./pages/rules.page').then(m => m.RulesPage)),\n page('notifications', 'Notifications', () => import('./pages/notifications.page').then(m => m.NotificationsPage)),\n page('silences', 'Silences', () => import('./pages/silences.page').then(m => m.SilencesPage)),\n page('incidents', 'Incidents', () => import('./pages/incidents.page').then(m => m.IncidentsPage)),\n page('incidents/:id', 'Incident', () => import('./pages/incident.page').then(m => m.IncidentPage)),\n page('agents', 'Agents', () => import('./pages/agents.page').then(m => m.AgentsPage)),\n page('agents/:id', 'Agent', () => import('./pages/agent.page').then(m => m.AgentPage)),\n page('approvals', 'Approvals', () => import('./pages/approvals.page').then(m => m.ApprovalsPage)),\n page('timeline', 'Timeline', () => import('./pages/timeline.page').then(m => m.TimelinePage)),\n page('load-runs', 'Load runs', () => import('./pages/load-runs.page').then(m => m.LoadRunsPage)),\n];\n\n/** The side menu entries (juice-layout), investigation pages first, linking under `basePath`. */\nexport function observabilityMenus(basePath = '/', order = 1): Menus {\n const base = normalizeBasePath(basePath);\n const link = (path: string) => (base === '/' ? `/${path}` : path ? `${base}/${path}` : base);\n return [\n { id: 'overview', label: 'Overview', icon: 'dashboard', routerLink: link('') },\n { id: 'services', label: 'Services', icon: 'hub', routerLink: link('services') },\n { id: 'traces', label: 'Traces', icon: 'timeline', routerLink: link('traces') },\n { id: 'topology', label: 'Dependencies', icon: 'account_tree', routerLink: link('topology') },\n { id: 'logs', label: 'Logs', icon: 'notes', routerLink: link('logs') },\n { id: 'metrics', label: 'Metrics', icon: 'show_chart', routerLink: link('metrics') },\n { id: 'resources', label: 'Resources', icon: 'dns', routerLink: link('resources') },\n { id: 'alerts', label: 'Alerts', icon: 'notifications', routerLink: link('alerts') },\n { id: 'incidents', label: 'Incidents', icon: 'emergency', routerLink: link('incidents') },\n { id: 'rules', label: 'Rules', icon: 'rule', routerLink: link('rules') },\n { id: 'silences', label: 'Silences', icon: 'notifications_paused', routerLink: link('silences') },\n { id: 'notifications', label: 'Notifications', icon: 'campaign', routerLink: link('notifications') },\n { id: 'agents', label: 'Agents', icon: 'smart_toy', routerLink: link('agents') },\n { id: 'approvals', label: 'Approvals', icon: 'approval', routerLink: link('approvals') },\n { id: 'timeline', label: 'Timeline', icon: 'history', routerLink: link('timeline') },\n { id: 'load-runs', label: 'Load runs', icon: 'speed', routerLink: link('load-runs') },\n ].map((menu, index) => ({ ...menu, order: order + index }));\n}\n"],"mappings":";;;;;;AAeA,MAAa,wBAAwB,IAAI,eAAqC,yBAAyB;CACrG,YAAY;CACZ,gBAAgB;EAAE,SAAS;EAAI,UAAU;EAAK,WAAW;CAAI;AAC9D,CAAA;AAGD,SAAgB,0BAA0B,UAAyC,CAAA,GAAE;CACnF,OAAO,yBAAyB,CAC9B;EACE,SAAS;EACT,UAAU;GACR,SAAS,QAAQ,WAAW;GAC5B,UAAU,QAAQ,YAAY;GAC9B,WAAW,QAAQ,aAAa;EACF;CACjC,CACF,CAAA;AACH;AAGA,SAAgB,kBAAkB,UAAgB;CAChD,MAAM,UAAU,SAAS,KAAI,CAAE,CAAC,QAAQ,cAAc,EAAE;CACxD,OAAO,UAAU,IAAI,YAAY;AACnC;AAIA,IAAa,qBAAb,MAAa,mBAAkB;CACZ,UAAU,OAAO,qBAAqB;CAC9C,OAAO,kBAAkB,KAAK,QAAQ,QA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AAY,KAAK,WAAW;EAAC;EACjF;GAAE,IAAI;GAAU,OAAO;GAAU,MAAM;GAAiB,YAAY,KAAK,QAAQ;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAa,YAAY,KAAK,WAAW;EAAC;EACvF;GAAE,IAAI;GAAS,OAAO;GAAS,MAAM;GAAQ,YAAY,KAAK,OAAO;EAAC;EACtE;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAwB,YAAY,KAAK,UAAU;EAAC;EAC/F;GAAE,IAAI;GAAiB,OAAO;GAAiB,MAAM;GAAY,YAAY,KAAK,eAAe;EAAC;EAClG;GAAE,IAAI;GAAU,OAAO;GAAU,MAAM;GAAa,YAAY,KAAK,QAAQ;EAAC;EAC9E;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAY,YAAY,KAAK,WAAW;EAAC;EACtF;GAAE,IAAI;GAAY,OAAO;GAAY,MAAM;GAAW,YAAY,KAAK,UAAU;EAAC;EAClF;GAAE,IAAI;GAAa,OAAO;GAAa,MAAM;GAAS,YAAY,KAAK,WAAW;EAAC;CACpF,CAAA,CAAC,KAAK,MAAM,WAAW;EAAE,GAAG;EAAM,OAAO,QAAQ;CAAK,EAAG;AAC5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice-js/observability",
3
- "version": "1.1.0-alpha.28",
3
+ "version": "1.1.0-alpha.29",
4
4
  "description": "Juice Observability pages (services, traces, topology, logs, metrics, resources, alerts, rules) for an Angular app on juice-layout",
5
5
  "author": "jack@creatorflow.io",
6
6
  "license": "MIT",
@@ -266,6 +266,29 @@ export interface AgentAction {
266
266
  parameters: ActionParameter[];
267
267
  permitted: boolean | null;
268
268
  limits: string[];
269
+ /** Low, Medium or High. */
270
+ risk: string;
271
+ /** What the platform's policy needs before it runs: None, Admin or SecondPerson. */
272
+ approval: string;
273
+ }
274
+ /** A request to run an action, under the approval policy for its risk. `state` is Pending, Issued, Rejected, Cancelled or Expired. */
275
+ export interface ActionRequest {
276
+ id: string;
277
+ agentId: string;
278
+ hostname: string;
279
+ action: string;
280
+ parameters: Record<string, unknown>;
281
+ risk: string;
282
+ policy: string;
283
+ reason: string;
284
+ requestedBy: string;
285
+ requestedAt: string;
286
+ expiresAt: string;
287
+ state: string;
288
+ decidedBy: string | null;
289
+ decidedAt: string | null;
290
+ comment: string | null;
291
+ command: AgentCommand | null;
269
292
  }
270
293
  export interface AgentActions {
271
294
  reportedAt: string | null;
@@ -719,6 +742,12 @@ export declare class ApiService {
719
742
  agentPackages(): Observable<Page<AgentPackage>>;
720
743
  /** Idempotent: a repeated click or a lost response signs one command, not two. */
721
744
  issueCommand(id: string, action: string, parameters: Record<string, unknown>): Observable<AgentCommand>;
745
+ /** Asks for an action under its approval policy: issued at once when nobody else needs to approve, otherwise waiting. */
746
+ requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string): Observable<ActionRequest>;
747
+ actionRequests(query?: Query): Observable<Page<ActionRequest>>;
748
+ approveRequest(id: string, comment: string): Observable<ActionRequest>;
749
+ rejectRequest(id: string, comment: string): Observable<ActionRequest>;
750
+ cancelRequest(id: string): Observable<ActionRequest>;
722
751
  agentCommands(id: string, cursor?: string | null): Observable<Page<AgentCommand>>;
723
752
  alertNotifications(id: string): Observable<AlertNotifications>;
724
753
  /** One page of alerts, newest first; pass the previous page's `nextCursor` as `cursor` for the next. */
@@ -1 +0,0 @@
1
- {"version":3,"file":"juice-js-observability-agent.page-VsTEvbSN.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 { ContextService } from '../core/context.service';\nimport { ActionParameter, AgentAction, AgentCommand, EnrollmentToken } from '../core/models';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AgoPipe, ReasonPipe, copyText } 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};\nconst PARAMETER_LABELS: Record<string, string> = { pathPrefix: 'Only under this path', host: 'Host', port: 'Port', timeoutMs: 'Wait (ms)' };\n\nfunction formatBytes(bytes: number | null | undefined): string {\n if (bytes === null || bytes === undefined) return '—';\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n let value = bytes;\n let unit = 0;\n while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit++; }\n return `${value < 10 && unit > 0 ? value.toFixed(1) : Math.round(value)} ${units[unit]}`;\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 <div class=\"jc-form-actions\">\n <button mat-flat-button type=\"submit\" data-testid=\"command-issue\" [disabled]=\"issuing() || selected()?.permitted === false\">{{ action() === 'agent.update' ? 'Update' : 'Run' }}</button>\n @if (issueError()) { <span class=\"jc-error\" data-testid=\"command-error\">{{ issueError() }}</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 }}@if (s.changing) { Admins only. }</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 <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 @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 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 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.\n effect(onCleanup => {\n if (!this.allCommands().some(c => this.waiting(c))) return;\n const timer = setTimeout(() => { this.commands.reload(); this.agent.reload(); }, 2000);\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 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 protected issue() {\n const action = this.action();\n this.issuing.set(true);\n this.issueError.set('');\n this.api.issueCommand(this.id(), action, this.parameters()).subscribe({\n next: () => { this.issuing.set(false); this.commands.reload(); },\n error: e => {\n this.issuing.set(false);\n this.issueError.set((e as { status?: number }).status === 403\n ? action === 'agent.update' ? 'Updating an agent needs the admin role.' : 'Asking an agent needs the operator or admin role.'\n : problemText(e));\n },\n });\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 }\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