import * as vscode from 'vscode'; import { StreamInfo } from './types'; export class StreamListItem extends vscode.TreeItem { constructor( public readonly stream: StreamInfo, public readonly logCount: number, public readonly isActive: boolean ) { super(stream.name, vscode.TreeItemCollapsibleState.None); this.description = `${logCount} logs`; this.iconPath = new vscode.ThemeIcon( 'radio-tower', isActive ? new vscode.ThemeColor('charts.green') : new vscode.ThemeColor('charts.grey') ); this.contextValue = stream.enabled ? 'streamListItem-enabled' : 'streamListItem-disabled'; this.id = `stream-list-${stream.id}`; this.tooltip = this.getTooltip(); this.command = { command: 'dsl-agent-logs.selectStream', title: 'Select Stream', arguments: [stream.id] }; } private getTooltip(): string { const enabled = this.stream.enabled ? 'Enabled' : 'Disabled'; return `Stream: ${this.stream.name}\nState: ${enabled}\nLogs: ${this.logCount}`; } get streamId(): string { return this.stream.id; } }