Compare commits
11 Commits
8341503a39
...
fc12ab31a4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc12ab31a4 | ||
|
|
63f5790d39 | ||
|
|
4f97697d56 | ||
|
|
ab1a20a61a | ||
|
|
d473611d8c | ||
|
|
e757f9b113 | ||
|
|
bcaa526a69 | ||
|
|
14b3dab88b | ||
|
|
b97f4f0668 | ||
|
|
d5a85c4ed0 | ||
|
|
7eaf736fc4 |
@@ -1,99 +1,58 @@
|
|||||||
<!-- ============================================================================
|
|
||||||
Agent Card — Final Integration (CUB-45)
|
|
||||||
Assembles: AgentStatusBadge, TaskProgressBar, QuickJumpButton
|
|
||||||
Layout: left-border accent, aria-labels, role="article"
|
|
||||||
========================================================================== -->
|
|
||||||
|
|
||||||
<article
|
<article
|
||||||
class="agent-card"
|
class="agent-card"
|
||||||
[class]="'agent-card--' + status()"
|
[class]="'agent-card--' + status()"
|
||||||
[attr.aria-label]="'Agent card: ' + status() + ' status, task: ' + (task() || 'none')"
|
role="article"
|
||||||
[attr.role]="'article'"
|
[attr.aria-label]="'Agent card: ' + statusLabel() + ' status'"
|
||||||
[style.--agent-status-color]="statusColorVar()"
|
[style.--agent-status-color]="statusColorVar()"
|
||||||
[style.--agent-status-bg]="statusBgVar()"
|
[style.--agent-status-bg]="statusBgVar()"
|
||||||
>
|
>
|
||||||
<!-- Left border accent (4px, matching status color) -->
|
<!-- Left border accent (4px, matching status color) -->
|
||||||
<div
|
<div class="agent-card__accent"></div>
|
||||||
class="agent-card__accent"
|
|
||||||
[attr.aria-hidden]="'true'"
|
|
||||||
></div>
|
|
||||||
|
|
||||||
<!-- Card body -->
|
<!-- Card body -->
|
||||||
<div class="agent-card__body">
|
<div class="agent-card__body">
|
||||||
|
<!-- Header row: status badge + channel + last activity -->
|
||||||
<!-- Header row: Status Badge + channel + last activity -->
|
|
||||||
<div class="agent-card__header">
|
<div class="agent-card__header">
|
||||||
<div class="agent-card__status-row">
|
<div class="agent-card__status-row">
|
||||||
<!-- Sub-component: Agent Status Badge -->
|
<!-- Agent Status Badge (CUB-48) -->
|
||||||
<app-agent-status-badge
|
<app-agent-status-badge
|
||||||
[status]="status()"
|
[status]="status()"
|
||||||
[attr.aria-label]="status() + ' status'"
|
[showLabel]="true"
|
||||||
/>
|
></app-agent-status-badge>
|
||||||
</div>
|
</div>
|
||||||
<div class="agent-card__meta">
|
<div class="agent-card__meta">
|
||||||
@if (channel()) {
|
@if (channel()) {
|
||||||
<span
|
<span class="agent-card__channel text-mono">
|
||||||
class="agent-card__channel text-mono"
|
<mat-icon class="agent-card__channel-icon" fontIcon="forum" [inline]="true"></mat-icon>
|
||||||
[attr.aria-label]="'Channel: ' + channel()"
|
|
||||||
>
|
|
||||||
<mat-icon
|
|
||||||
class="agent-card__channel-icon"
|
|
||||||
fontIcon="forum"
|
|
||||||
[inline]="true"
|
|
||||||
[attr.aria-hidden]="'true'"
|
|
||||||
></mat-icon>
|
|
||||||
{{ channel() }}
|
{{ channel() }}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
<span
|
<span class="agent-card__last-activity text-mono">{{ lastActivityText() }}</span>
|
||||||
class="agent-card__last-activity text-mono"
|
|
||||||
[attr.aria-label]="'Last activity: ' + lastActivityText()"
|
|
||||||
>
|
|
||||||
{{ lastActivityText() }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Task description -->
|
<!-- Task description -->
|
||||||
@if (task()) {
|
@if (task()) {
|
||||||
<p
|
<p class="agent-card__task">{{ task() }}</p>
|
||||||
class="agent-card__task"
|
|
||||||
[attr.aria-label]="'Current task: ' + task()"
|
|
||||||
>
|
|
||||||
{{ task() }}
|
|
||||||
</p>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- Sub-component: Task Progress Bar -->
|
<!-- Task Progress Bar (CUB-44) -->
|
||||||
@if (showProgress()) {
|
@if (showProgress()) {
|
||||||
<div
|
|
||||||
class="agent-card__progress"
|
|
||||||
[attr.aria-label]="'Task progress: ' + progress() + '%'"
|
|
||||||
>
|
|
||||||
<app-task-progress-bar
|
<app-task-progress-bar
|
||||||
[progress]="progress()"
|
[progress]="progress()"
|
||||||
[showElapsed]="showElapsed()"
|
[showElapsed]="false"
|
||||||
/>
|
></app-task-progress-bar>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- Footer: session key (truncated) + Quick-Jump button -->
|
<!-- Footer: session key (truncated) + Quick-Jump Button (CUB-46) -->
|
||||||
<div class="agent-card__footer">
|
<div class="agent-card__footer">
|
||||||
<span
|
<span class="agent-card__session text-mono" [matTooltip]="sessionKey()">
|
||||||
class="agent-card__session text-mono"
|
{{ sessionKey().length > 28 ? sessionKey().substring(0, 28) + '…' : sessionKey() }}
|
||||||
[matTooltip]="sessionKey()"
|
|
||||||
[attr.aria-label]="'Session key: ' + sessionKey()"
|
|
||||||
>
|
|
||||||
{{ truncatedSessionKey() }}
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- Sub-component: Quick-Jump Button -->
|
|
||||||
<app-quick-jump-button
|
<app-quick-jump-button
|
||||||
[sessionKey]="sessionKey()"
|
[sessionKey]="sessionKey()"
|
||||||
(jumpClick)="onJumpClick($event)"
|
(jumpClick)="jumpClick.emit($event)"
|
||||||
[attr.aria-label]="'Jump to agent session'"
|
></app-quick-jump-button>
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Agent Card Styles — M3 Tactical Dark (CUB-45 Final Integration)
|
// Agent Card Styles — M3 Tactical Dark (Final Integration, CUB-45)
|
||||||
// Assembles: AgentStatusBadge, TaskProgressBar, QuickJumpButton
|
// Uses sub-components:
|
||||||
// Uses CUB-47 dark mode CSS variables.
|
// - AgentStatusBadge (CUB-48) for status display
|
||||||
|
// - TaskProgressBar (CUB-44) for progress
|
||||||
|
// - QuickJumpButton (CUB-46) for navigation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -41,12 +43,6 @@
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Left-border accent (4px, matching status color)
|
// Left-border accent (4px, matching status color)
|
||||||
// Uses --agent-status-color set via [style.--agent-status-color] binding
|
|
||||||
// in the template. Color map:
|
|
||||||
// Active → --status-active (#38BDF8)
|
|
||||||
// Idle → --status-idle (#2DD4BF)
|
|
||||||
// Thinking → --status-thinking (#A78BFA)
|
|
||||||
// Error → --status-error (#F87171)
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
.agent-card__accent {
|
.agent-card__accent {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -124,13 +120,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Progress Bar Container
|
// Task Progress Bar (CUB-44 sub-component)
|
||||||
// Overrides the sub-component's bar to use the agent's status color
|
// Override the sub-component's progress bar colors to match status color
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
.agent-card__progress {
|
:host ::ng-deep .task-progress-bar .mat-mdc-progress-bar,
|
||||||
// Override TaskProgressBar's active indicator to match agent status color
|
.agent-card .mat-mdc-progress-bar {
|
||||||
--mat-progress-bar-active-indicator-color: var(--agent-status-color);
|
--mdc-linear-progress-active-indicator-color: var(--agent-status-color);
|
||||||
--mat-progress-bar-track-color: var(--agent-status-bg);
|
--mdc-linear-progress-track-color: var(--agent-status-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,46 +1,47 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Agent Card Component — Final Integration (CUB-45)
|
// Agent Card Component — Final Integration
|
||||||
// Assembles: AgentStatusBadge, TaskProgressBar, QuickJumpButton
|
// Per CUB-45: Compose AgentCard from all sub-components.
|
||||||
|
// - AgentStatusBadge (CUB-48) for status display
|
||||||
|
// - TaskProgressBar (CUB-44) for progress indication
|
||||||
|
// - QuickJumpButton (CUB-46) for session navigation
|
||||||
// Layout: left-border accent, aria-labels, role="article"
|
// Layout: left-border accent, aria-labels, role="article"
|
||||||
// Uses tactical dark mode CSS variables from CUB-47.
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
import { ChangeDetectionStrategy, Component, EventEmitter, Output, input, computed } from '@angular/core';
|
||||||
import {
|
|
||||||
ChangeDetectionStrategy,
|
|
||||||
Component,
|
|
||||||
EventEmitter,
|
|
||||||
Output,
|
|
||||||
computed,
|
|
||||||
input,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
|
||||||
|
// Sub-components (CUB-48, CUB-44, CUB-46)
|
||||||
|
import { AgentStatusBadgeComponent } from '../agent-status-badge';
|
||||||
|
import { TaskProgressBarComponent } from '../task-progress-bar';
|
||||||
|
import { QuickJumpButtonComponent } from '../quick-jump-button';
|
||||||
|
|
||||||
import { AgentStatus } from '../../models';
|
import { AgentStatus } from '../../models';
|
||||||
import { AgentStatusBadgeComponent } from '../agent-status-badge/agent-status-badge.component';
|
|
||||||
import { TaskProgressBarComponent } from '../task-progress-bar/task-progress-bar.component';
|
|
||||||
import { QuickJumpButtonComponent } from '../quick-jump-button/quick-jump-button.component';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AgentCard displays a single agent's status in the Command Hub grid.
|
* AgentCard displays a single agent's status in the Command Hub grid.
|
||||||
*
|
*
|
||||||
* Composes three sub-components:
|
* Composes three sub-components:
|
||||||
* - AgentStatusBadge — colored pill with pulse animation
|
* - AgentStatusBadge: colored pill with pulse animation (CUB-48)
|
||||||
* - TaskProgressBar — determinate progress with optional elapsed time
|
* - TaskProgressBar: determinate progress with optional elapsed time (CUB-44)
|
||||||
* - QuickJumpButton — M3 FilledTonalIconButton for session navigation
|
* - QuickJumpButton: M3 FilledTonal icon button for session navigation (CUB-46)
|
||||||
*
|
*
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* - status: AgentStatus — current agent status (required)
|
* - status: AgentStatus — current agent status
|
||||||
* - task: string — current task description
|
* - task: string — current task description
|
||||||
* - progress: number — task progress percentage (0–100)
|
* - progress: number — task progress percentage (0–100)
|
||||||
* - sessionKey: string — full session key (required)
|
* - sessionKey: string — full session key
|
||||||
* - channel: string — communication channel (e.g., "telegram")
|
* - channel: string — communication channel (e.g., "telegram")
|
||||||
* - lastActivity: Date — timestamp of last activity
|
* - lastActivity: Date — timestamp of last activity
|
||||||
*
|
*
|
||||||
|
* Outputs:
|
||||||
|
* - jumpClick: string — emitted when Quick-Jump button is clicked, carries sessionKey
|
||||||
|
*
|
||||||
* Accessibility:
|
* Accessibility:
|
||||||
* - role="article" on the card element
|
* - role="article" on the card element
|
||||||
* - aria-labels for status badge, progress bar, and jump button
|
* - aria-label on the card summarizing status
|
||||||
|
* - aria-label on the progress bar (via TaskProgressBar)
|
||||||
|
* - aria-label on the Quick-Jump button (via QuickJumpButton)
|
||||||
* - focus-visible outlines for keyboard navigation
|
* - focus-visible outlines for keyboard navigation
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
@@ -50,6 +51,7 @@ import { QuickJumpButtonComponent } from '../quick-jump-button/quick-jump-button
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
|
// Sub-components
|
||||||
AgentStatusBadgeComponent,
|
AgentStatusBadgeComponent,
|
||||||
TaskProgressBarComponent,
|
TaskProgressBarComponent,
|
||||||
QuickJumpButtonComponent,
|
QuickJumpButtonComponent,
|
||||||
@@ -60,29 +62,25 @@ import { QuickJumpButtonComponent } from '../quick-jump-button/quick-jump-button
|
|||||||
})
|
})
|
||||||
export class AgentCardComponent {
|
export class AgentCardComponent {
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Required Inputs
|
// Inputs (all 6 required by CUB-45 definition of done)
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Current agent status — drives left-border accent color and badge. */
|
/** Current agent status */
|
||||||
readonly status = input.required<AgentStatus>();
|
readonly status = input.required<AgentStatus>();
|
||||||
|
|
||||||
/** Full session key — displayed subtly and passed to QuickJumpButton. */
|
/** Current task description */
|
||||||
readonly sessionKey = input.required<string>();
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Optional Inputs
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Current task description, e.g. "Reviewing PR #42". */
|
|
||||||
readonly task = input<string>('');
|
readonly task = input<string>('');
|
||||||
|
|
||||||
/** Task progress percentage (0–100). Shown when status is active/thinking. */
|
/** Task progress percentage (0–100) */
|
||||||
readonly progress = input<number>(0);
|
readonly progress = input<number>(0);
|
||||||
|
|
||||||
/** Communication channel, e.g. "telegram". */
|
/** Full session key */
|
||||||
|
readonly sessionKey = input.required<string>();
|
||||||
|
|
||||||
|
/** Communication channel (e.g., "telegram") */
|
||||||
readonly channel = input<string>('');
|
readonly channel = input<string>('');
|
||||||
|
|
||||||
/** Timestamp of last activity. Formatted as relative time. */
|
/** Timestamp of last activity */
|
||||||
readonly lastActivity = input<Date>(new Date());
|
readonly lastActivity = input<Date>(new Date());
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -90,14 +88,13 @@ export class AgentCardComponent {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Emitted when the Quick-Jump button is clicked with the session key. */
|
/** Emitted when the Quick-Jump button is clicked with the session key. */
|
||||||
@Output()
|
@Output() readonly jumpClick = new EventEmitter<string>();
|
||||||
readonly jumpClick = new EventEmitter<string>();
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Computed Values
|
// Computed values
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
/** Map status to CSS custom property for dynamic left-border accent color. */
|
/** Map status to CSS custom property name for dynamic color binding */
|
||||||
readonly statusColorVar = computed(() => {
|
readonly statusColorVar = computed(() => {
|
||||||
const map: Record<AgentStatus, string> = {
|
const map: Record<AgentStatus, string> = {
|
||||||
active: 'var(--status-active)',
|
active: 'var(--status-active)',
|
||||||
@@ -109,7 +106,7 @@ export class AgentCardComponent {
|
|||||||
return map[this.status()];
|
return map[this.status()];
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Map status to background tint CSS variable. */
|
/** Map status to background tint CSS variable */
|
||||||
readonly statusBgVar = computed(() => {
|
readonly statusBgVar = computed(() => {
|
||||||
const map: Record<AgentStatus, string> = {
|
const map: Record<AgentStatus, string> = {
|
||||||
active: 'var(--status-active-bg)',
|
active: 'var(--status-active-bg)',
|
||||||
@@ -121,7 +118,19 @@ export class AgentCardComponent {
|
|||||||
return map[this.status()];
|
return map[this.status()];
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Format last activity as relative time string. */
|
/** Human-readable status label (delegates to AgentStatusBadgeComponent) */
|
||||||
|
readonly statusLabel = computed(() => {
|
||||||
|
const map: Record<AgentStatus, string> = {
|
||||||
|
active: 'Active',
|
||||||
|
idle: 'Idle',
|
||||||
|
thinking: 'Thinking',
|
||||||
|
error: 'Error',
|
||||||
|
offline: 'Offline',
|
||||||
|
};
|
||||||
|
return map[this.status()];
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Format last activity as relative time string */
|
||||||
readonly lastActivityText = computed(() => {
|
readonly lastActivityText = computed(() => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const then = this.lastActivity().getTime();
|
const then = this.lastActivity().getTime();
|
||||||
@@ -134,27 +143,9 @@ export class AgentCardComponent {
|
|||||||
return `${Math.floor(diffHr / 24)}d ago`;
|
return `${Math.floor(diffHr / 24)}d ago`;
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Whether to show the progress bar — visible for active/thinking with progress > 0. */
|
/** Whether to show progress bar */
|
||||||
readonly showProgress = computed(() => {
|
readonly showProgress = computed(() => {
|
||||||
const s = this.status();
|
const s = this.status();
|
||||||
return (s === 'active' || s === 'thinking') && this.progress() > 0;
|
return (s === 'active' || s === 'thinking') && this.progress() > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Whether to show the elapsed time on the progress bar. */
|
|
||||||
readonly showElapsed = computed(() => this.showProgress());
|
|
||||||
|
|
||||||
/** Truncate session key for display. */
|
|
||||||
readonly truncatedSessionKey = computed(() => {
|
|
||||||
const key = this.sessionKey();
|
|
||||||
return key.length > 28 ? key.substring(0, 28) + '…' : key;
|
|
||||||
});
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Event Handlers
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Forward QuickJumpButton's jump event with the session key. */
|
|
||||||
onJumpClick(sessionKey: string): void {
|
|
||||||
this.jumpClick.emit(sessionKey);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Agent Card — Barrel Export (CUB-45)
|
// Agent Card — Barrel Export
|
||||||
|
// CUB-45: Final integration with sub-components
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
export { AgentCardComponent } from './agent-card.component';
|
export { AgentCardComponent } from './agent-card.component';
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Component Barrel Exports
|
// Components Barrel Export
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
export * from './agent-card/index';
|
|
||||||
export * from './agent-status-badge/index';
|
export * from './agent-card';
|
||||||
export * from './quick-jump-button/quick-jump-button.component';
|
export * from './agent-status-badge';
|
||||||
export * from './task-progress-bar/index';
|
export * from './task-progress-bar';
|
||||||
|
export * from './quick-jump-button';
|
||||||
6
frontend/src/app/components/quick-jump-button/index.ts
Normal file
6
frontend/src/app/components/quick-jump-button/index.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// ============================================================================
|
||||||
|
// Quick-Jump Button — Barrel Export
|
||||||
|
// CUB-46
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
export { QuickJumpButtonComponent } from './quick-jump-button.component';
|
||||||
@@ -20,13 +20,13 @@ import { MatIcon } from '@angular/material/icon';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class QuickJumpButtonComponent {
|
export class QuickJumpButtonComponent {
|
||||||
/** Emitted when the button is clicked, carrying the session key for navigation. */
|
|
||||||
@Output() jumpClick = new EventEmitter<string>();
|
|
||||||
|
|
||||||
/** The session key to navigate to. Set by the parent agent card. */
|
/** The session key to navigate to. Set by the parent agent card. */
|
||||||
@Input()
|
@Input()
|
||||||
sessionKey = '';
|
sessionKey = '';
|
||||||
|
|
||||||
|
/** Emitted when the button is clicked, carrying the session key for navigation. */
|
||||||
|
@Output() jumpClick = new EventEmitter<string>();
|
||||||
|
|
||||||
onJumpClick(): void {
|
onJumpClick(): void {
|
||||||
this.jumpClick.emit(this.sessionKey);
|
this.jumpClick.emit(this.sessionKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,88 @@
|
|||||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
||||||
|
import { AgentCardComponent } from '../../components/agent-card/agent-card.component';
|
||||||
|
import { AgentCardData } from '../../models/agent.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-hub-page',
|
selector: 'app-hub-page',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [],
|
imports: [AgentCardComponent],
|
||||||
template: `
|
template: `
|
||||||
<div class="hub-page">
|
<div class="hub-page">
|
||||||
<p class="hub-page__placeholder">Command Hub — Fleet status grid will render here</p>
|
<div class="hub-page__grid">
|
||||||
|
@for (agent of agents(); track agent.id) {
|
||||||
|
<app-agent-card
|
||||||
|
[status]="agent.status"
|
||||||
|
[task]="agent.currentTask ?? ''"
|
||||||
|
[progress]="agent.taskProgress ?? 0"
|
||||||
|
[sessionKey]="agent.sessionKey"
|
||||||
|
[channel]="agent.channel"
|
||||||
|
[lastActivity]="agent.lastActivity"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
styles: [`
|
styles: [`
|
||||||
.hub-page {
|
.hub-page {
|
||||||
display: flex;
|
padding: var(--cc-section-padding, 24px);
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
min-height: 400px;
|
|
||||||
}
|
}
|
||||||
.hub-page__placeholder {
|
|
||||||
color: var(--cc-on-surface-variant);
|
.hub-page__grid {
|
||||||
font-size: 16px;
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(var(--cc-card-min-width, 320px), 1fr));
|
||||||
|
gap: var(--cc-card-gap, 16px);
|
||||||
}
|
}
|
||||||
`],
|
`],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class HubPageComponent {}
|
export class HubPageComponent {
|
||||||
|
/** Demo agents for development — will be replaced by SignalR data */
|
||||||
|
protected readonly agents = signal<AgentCardData[]>([
|
||||||
|
{
|
||||||
|
id: 'otto',
|
||||||
|
displayName: 'Otto',
|
||||||
|
role: 'Orchestrator',
|
||||||
|
status: 'active',
|
||||||
|
currentTask: 'Reviewing PR #42',
|
||||||
|
taskProgress: 65,
|
||||||
|
taskElapsed: '04m 12s',
|
||||||
|
sessionKey: 'agent:otto:telegram:direct:8787451565',
|
||||||
|
channel: 'telegram',
|
||||||
|
lastActivity: new Date(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'rex',
|
||||||
|
displayName: 'Rex',
|
||||||
|
role: 'Frontend Specialist',
|
||||||
|
status: 'thinking',
|
||||||
|
currentTask: 'Building AgentCard component',
|
||||||
|
taskProgress: 30,
|
||||||
|
taskElapsed: '02m 45s',
|
||||||
|
sessionKey: 'agent:rex:subagent:0cdbf600',
|
||||||
|
channel: 'telegram',
|
||||||
|
lastActivity: new Date(Date.now() - 120000),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'dex',
|
||||||
|
displayName: 'Dex',
|
||||||
|
role: 'Backend Engineer',
|
||||||
|
status: 'idle',
|
||||||
|
sessionKey: 'agent:dex:slack:channel:C01234567',
|
||||||
|
channel: 'slack',
|
||||||
|
lastActivity: new Date(Date.now() - 300000),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'hex',
|
||||||
|
displayName: 'Hex',
|
||||||
|
role: 'Database Architect',
|
||||||
|
status: 'error',
|
||||||
|
currentTask: 'Migration failed — rollback',
|
||||||
|
taskProgress: 0,
|
||||||
|
taskElapsed: '00m 00s',
|
||||||
|
sessionKey: 'agent:hex:slack:channel:C01234568',
|
||||||
|
channel: 'slack',
|
||||||
|
lastActivity: new Date(Date.now() - 1800000),
|
||||||
|
errorMessage: 'Connection timeout',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user