@juice-js/observability 1.1.0-alpha.29 → 1.1.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{juice-js-observability-agent.page-D6nP3YbF.mjs → juice-js-observability-agent.page-CKcuCUVP.mjs} +46 -10
- package/fesm2022/juice-js-observability-agent.page-CKcuCUVP.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-agents.page-C9WjP1nl.mjs → juice-js-observability-agents.page-Ch-tBwQO.mjs} +2 -2
- package/fesm2022/{juice-js-observability-agents.page-C9WjP1nl.mjs.map → juice-js-observability-agents.page-Ch-tBwQO.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-alert.page-79qA1Wqg.mjs → juice-js-observability-alert.page-BNlH9IdQ.mjs} +2 -2
- package/fesm2022/{juice-js-observability-alert.page-79qA1Wqg.mjs.map → juice-js-observability-alert.page-BNlH9IdQ.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-alerts.page-DVqDxYSq.mjs → juice-js-observability-alerts.page-BNmez0Ak.mjs} +2 -2
- package/fesm2022/{juice-js-observability-alerts.page-DVqDxYSq.mjs.map → juice-js-observability-alerts.page-BNmez0Ak.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-approvals.page-DXi3O9Ol.mjs → juice-js-observability-approvals.page-DBLw-vl1.mjs} +9 -5
- package/fesm2022/juice-js-observability-approvals.page-DBLw-vl1.mjs.map +1 -0
- package/fesm2022/{juice-js-observability-incident.page-CayeZdF_.mjs → juice-js-observability-incident.page-C2ZK3MRh.mjs} +2 -2
- package/fesm2022/{juice-js-observability-incident.page-CayeZdF_.mjs.map → juice-js-observability-incident.page-C2ZK3MRh.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-incidents.page-Bx7afoIh.mjs → juice-js-observability-incidents.page-DhC3BkBo.mjs} +2 -2
- package/fesm2022/{juice-js-observability-incidents.page-Bx7afoIh.mjs.map → juice-js-observability-incidents.page-DhC3BkBo.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-load-runs.page-ByWrvCra.mjs → juice-js-observability-load-runs.page-DVuO4zFp.mjs} +3 -3
- package/fesm2022/{juice-js-observability-load-runs.page-ByWrvCra.mjs.map → juice-js-observability-load-runs.page-DVuO4zFp.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-logs.page-DMRfXnA-.mjs → juice-js-observability-logs.page-PXWQMcvL.mjs} +3 -3
- package/fesm2022/{juice-js-observability-logs.page-DMRfXnA-.mjs.map → juice-js-observability-logs.page-PXWQMcvL.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-metrics.page-D3xK5mgs.mjs → juice-js-observability-metrics.page-Ctm_EEFb.mjs} +3 -3
- package/fesm2022/{juice-js-observability-metrics.page-D3xK5mgs.mjs.map → juice-js-observability-metrics.page-Ctm_EEFb.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-notifications.page-BvUjV46Y.mjs → juice-js-observability-notifications.page-CtcV3Ei4.mjs} +2 -2
- package/fesm2022/{juice-js-observability-notifications.page-BvUjV46Y.mjs.map → juice-js-observability-notifications.page-CtcV3Ei4.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-overview.page-56xVtAo2.mjs → juice-js-observability-overview.page-BRGpTOyc.mjs} +3 -3
- package/fesm2022/{juice-js-observability-overview.page-56xVtAo2.mjs.map → juice-js-observability-overview.page-BRGpTOyc.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resource.page-CRSA-zpR.mjs → juice-js-observability-resource.page-O4GGdirR.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resource.page-CRSA-zpR.mjs.map → juice-js-observability-resource.page-O4GGdirR.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-resources.page-BW7W5Wy2.mjs → juice-js-observability-resources.page-B_AVPpes.mjs} +2 -2
- package/fesm2022/{juice-js-observability-resources.page-BW7W5Wy2.mjs.map → juice-js-observability-resources.page-B_AVPpes.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-rules.page-uKeK44Iz.mjs → juice-js-observability-rules.page-CWaADAe4.mjs} +3 -3
- package/fesm2022/{juice-js-observability-rules.page-uKeK44Iz.mjs.map → juice-js-observability-rules.page-CWaADAe4.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-service.page-D7-Wbc5P.mjs → juice-js-observability-service.page-DRj1GO0Q.mjs} +2 -2
- package/fesm2022/{juice-js-observability-service.page-D7-Wbc5P.mjs.map → juice-js-observability-service.page-DRj1GO0Q.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-services.page-CNarlAgr.mjs → juice-js-observability-services.page-BbFbbvyH.mjs} +3 -3
- package/fesm2022/{juice-js-observability-services.page-CNarlAgr.mjs.map → juice-js-observability-services.page-BbFbbvyH.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-silences.page-DBBZBZ0a.mjs → juice-js-observability-silences.page-CoTqfGxY.mjs} +2 -2
- package/fesm2022/{juice-js-observability-silences.page-DBBZBZ0a.mjs.map → juice-js-observability-silences.page-CoTqfGxY.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-telemetry-B98lekF2.mjs → juice-js-observability-telemetry-DVwUTHSz.mjs} +2 -2
- package/fesm2022/{juice-js-observability-telemetry-B98lekF2.mjs.map → juice-js-observability-telemetry-DVwUTHSz.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-timeline.page-DhU78o_M.mjs → juice-js-observability-timeline.page-CFSigOgk.mjs} +2 -2
- package/fesm2022/{juice-js-observability-timeline.page-DhU78o_M.mjs.map → juice-js-observability-timeline.page-CFSigOgk.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-topology.page-CVdoBph4.mjs → juice-js-observability-topology.page-BDfNpiql.mjs} +2 -2
- package/fesm2022/{juice-js-observability-topology.page-CVdoBph4.mjs.map → juice-js-observability-topology.page-BDfNpiql.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-trace.page-C-icZvAo.mjs → juice-js-observability-trace.page-CdW09ADY.mjs} +2 -2
- package/fesm2022/{juice-js-observability-trace.page-C-icZvAo.mjs.map → juice-js-observability-trace.page-CdW09ADY.mjs.map} +1 -1
- package/fesm2022/{juice-js-observability-traces.page-c8CoI2AY.mjs → juice-js-observability-traces.page-CMuItN_m.mjs} +3 -3
- package/fesm2022/{juice-js-observability-traces.page-c8CoI2AY.mjs.map → juice-js-observability-traces.page-CMuItN_m.mjs.map} +1 -1
- package/fesm2022/juice-js-observability.mjs +259 -121
- package/fesm2022/juice-js-observability.mjs.map +1 -1
- package/package.json +1 -1
- package/types/juice-js-observability.d.ts +63 -3
- package/fesm2022/juice-js-observability-agent.page-D6nP3YbF.mjs.map +0 -1
- package/fesm2022/juice-js-observability-approvals.page-DXi3O9Ol.mjs.map +0 -1
|
@@ -14,9 +14,14 @@ export interface ObservabilityOptions {
|
|
|
14
14
|
* `id => ['/audit/traces', id]`. A string is an external URL. Without it, no link.
|
|
15
15
|
*/
|
|
16
16
|
auditLink?: ((traceId: string) => unknown[] | string | null) | null;
|
|
17
|
+
/** Show on the Approvals menu entry how many action requests wait for the signed-in user. On unless false. */
|
|
18
|
+
approvalCount?: boolean;
|
|
17
19
|
}
|
|
18
20
|
export declare const OBSERVABILITY_OPTIONS: InjectionToken<ObservabilityOptions>;
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Configures the pages: where the API is, where the host mounted the routes, and where a trace's audit records open. Also shows the count
|
|
23
|
+
* of requests waiting for approval on the Approvals menu entry, unless `approvalCount: false`.
|
|
24
|
+
*/
|
|
20
25
|
export declare function provideJuiceObservability(options?: Partial<ObservabilityOptions>): EnvironmentProviders;
|
|
21
26
|
/** `/observability/` → `/observability`; `` and `/` → `/`. */
|
|
22
27
|
export declare function normalizeBasePath(basePath: string): string;
|
|
@@ -271,6 +276,17 @@ export interface AgentAction {
|
|
|
271
276
|
/** What the platform's policy needs before it runs: None, Admin or SecondPerson. */
|
|
272
277
|
approval: string;
|
|
273
278
|
}
|
|
279
|
+
/** A health subject an action should make healthy: Service or Application (with environmentId), Instance or Host. */
|
|
280
|
+
export interface ActionTarget {
|
|
281
|
+
type: string;
|
|
282
|
+
id: string;
|
|
283
|
+
environmentId?: string | null;
|
|
284
|
+
}
|
|
285
|
+
/** Requests waiting for a decision: all of them, and those the signed-in user can decide. */
|
|
286
|
+
export interface ActionRequestsWaiting {
|
|
287
|
+
total: number;
|
|
288
|
+
forYou: number;
|
|
289
|
+
}
|
|
274
290
|
/** A request to run an action, under the approval policy for its risk. `state` is Pending, Issued, Rejected, Cancelled or Expired. */
|
|
275
291
|
export interface ActionRequest {
|
|
276
292
|
id: string;
|
|
@@ -288,6 +304,13 @@ export interface ActionRequest {
|
|
|
288
304
|
decidedBy: string | null;
|
|
289
305
|
decidedAt: string | null;
|
|
290
306
|
comment: string | null;
|
|
307
|
+
/** The alert that prompted it, and what it should make healthy: checked before it runs, watched for recovery after. */
|
|
308
|
+
alertId?: string | null;
|
|
309
|
+
target?: ActionTarget | null;
|
|
310
|
+
/** None without a target; Verifying until health from telemetry newer than the action says Verified, or NotVerified. */
|
|
311
|
+
verification?: string;
|
|
312
|
+
verificationNote?: string | null;
|
|
313
|
+
verifiedAt?: string | null;
|
|
291
314
|
command: AgentCommand | null;
|
|
292
315
|
}
|
|
293
316
|
export interface AgentActions {
|
|
@@ -319,7 +342,8 @@ export interface AgentCommand {
|
|
|
319
342
|
}
|
|
320
343
|
export interface Delivery {
|
|
321
344
|
id: string;
|
|
322
|
-
alertId: string;
|
|
345
|
+
alertId: string | null;
|
|
346
|
+
actionRequestId?: string | null;
|
|
323
347
|
event: string;
|
|
324
348
|
status: string;
|
|
325
349
|
attempts: number;
|
|
@@ -693,6 +717,8 @@ export type Query = Record<string, string | number | boolean | string[] | null |
|
|
|
693
717
|
export declare class ApiService {
|
|
694
718
|
private readonly http;
|
|
695
719
|
private readonly base;
|
|
720
|
+
/** Set once a page has fetched the caller's tenant: the user is signed in, so background calls such as {@link ApprovalCount}'s may start. */
|
|
721
|
+
readonly tenantKnown: import("@angular/core").WritableSignal<boolean>;
|
|
696
722
|
/** The caller's tenant, fetched once. */
|
|
697
723
|
readonly tenant$: Observable<Tenant>;
|
|
698
724
|
private get;
|
|
@@ -743,8 +769,10 @@ export declare class ApiService {
|
|
|
743
769
|
/** Idempotent: a repeated click or a lost response signs one command, not two. */
|
|
744
770
|
issueCommand(id: string, action: string, parameters: Record<string, unknown>): Observable<AgentCommand>;
|
|
745
771
|
/** 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>;
|
|
772
|
+
requestAction(agentId: string, action: string, parameters: Record<string, unknown>, reason: string, target?: ActionTarget | null): Observable<ActionRequest>;
|
|
747
773
|
actionRequests(query?: Query): Observable<Page<ActionRequest>>;
|
|
774
|
+
/** How many requests wait, and how many of them the signed-in user can decide. */
|
|
775
|
+
waitingRequests(): Observable<ActionRequestsWaiting>;
|
|
748
776
|
approveRequest(id: string, comment: string): Observable<ActionRequest>;
|
|
749
777
|
rejectRequest(id: string, comment: string): Observable<ActionRequest>;
|
|
750
778
|
cancelRequest(id: string): Observable<ActionRequest>;
|
|
@@ -811,6 +839,38 @@ export declare class ContextService {
|
|
|
811
839
|
static ɵfac: i0.ɵɵFactoryDeclaration<ContextService, never>;
|
|
812
840
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
813
841
|
}
|
|
842
|
+
/**
|
|
843
|
+
* How many action requests wait for the signed-in user to decide, refreshed every 30 seconds from whatever page is open, and at once
|
|
844
|
+
* when a page made or decided one ({@link refresh}). It starts only once a page has fetched the tenant: before that the user may still be
|
|
845
|
+
* signing in, and an early call would fail, along with the page's own call sharing it. It stops on an error (signed out, or no rights)
|
|
846
|
+
* until the next navigation, so a signed-out tab doesn't keep asking.
|
|
847
|
+
*/
|
|
848
|
+
export declare class ApprovalCount {
|
|
849
|
+
static readonly Every = 30000;
|
|
850
|
+
private readonly api;
|
|
851
|
+
private polling;
|
|
852
|
+
/** Requests the signed-in user can approve or reject now. */
|
|
853
|
+
readonly forYou: import("@angular/core").WritableSignal<number>;
|
|
854
|
+
constructor();
|
|
855
|
+
/** Asks again now, for a page that just changed what waits. */
|
|
856
|
+
refresh(): void;
|
|
857
|
+
private start;
|
|
858
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApprovalCount, never>;
|
|
859
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Shows {@link ApprovalCount} on the Approvals entry of juice-layout's side menu, found by its icon. juice-layout's menu has no badge of its
|
|
863
|
+
* own, so this adds one beside the label and puts it back whenever the menu is drawn again.
|
|
864
|
+
*/
|
|
865
|
+
export declare class ApprovalMenuBadge {
|
|
866
|
+
static readonly Icon = "approval";
|
|
867
|
+
private readonly count;
|
|
868
|
+
private observer;
|
|
869
|
+
constructor();
|
|
870
|
+
private apply;
|
|
871
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApprovalMenuBadge, never>;
|
|
872
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
873
|
+
}
|
|
814
874
|
/**
|
|
815
875
|
* The pages, investigation first (Console requirements §4): services, traces, topology, logs and metrics; alerts and
|
|
816
876
|
* rules after. Detail pages are deep links (§17) and carry the environment and time range in their query parameters.
|
|
@@ -1 +0,0 @@
|
|
|
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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A,MAAtK;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAc;IAAQ,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAA0I;IAAO,MAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAU,MAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAiN1L,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAnNrB,MAAA;EAAU,MAAA,CAAA;GACT,iBAAiB,wBAAwB;GACzC,SAAS;IAAC;IAAU;IAAY;IAAU;IAAa;IAAiB;IAAmB;IAAoB;IAAgB;IAAsB;IAAiB;IAAY;IAAS;GAAU;GACrM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+MX,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAA,EAAA,WAAA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