import { DeesElement, customElement, html, css, cssManager, property } from '@design.estate/dees-element'; import { formatDate, formatDuration } from '../utils.js'; @customElement('cloudly-execution-details') export class CloudlyExecutionDetails extends DeesElement { @property({ type: Object }) execution: any; public static styles = [ cssManager.defaultStyles, css` .execution-details h3, .execution-details h4 { margin: 8px 0; } .metrics { display: flex; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #333; } .metric { display: flex; flex-direction: column; } .metric-label { color: #666; font-size: 0.85em; } .metric-value { color: #fff; font-size: 1.1em; font-weight: 600; } .execution-logs { background: #0a0a0a; border: 1px solid #333; border-radius: 6px; padding: 16px; margin-top: 16px; max-height: 400px; overflow-y: auto; } .log-entry { font-family: monospace; font-size: 0.9em; margin-bottom: 8px; padding: 4px 8px; border-radius: 4px; } .log-info { color: #2196f3; } .log-warning { color: #ff9800; background: rgba(255, 152, 0, 0.1); } .log-error { color: #f44336; background: rgba(244, 67, 54, 0.1); } .log-success { color: #4caf50; background: rgba(76, 175, 80, 0.1); } `, ]; public render() { const execution = this.execution; if (!execution) return html``; return html`

Execution Details: ${execution.data.taskName}

Started ${formatDate(execution.data.startedAt)}
${execution.data.completedAt ? html`
Completed ${formatDate(execution.data.completedAt)}
` : ''} ${execution.data.duration ? html`
Duration ${formatDuration(execution.data.duration)}
` : ''}
Triggered By ${execution.data.triggeredBy}
${execution.data.logs && execution.data.logs.length > 0 ? html`

Logs

${execution.data.logs.map((log: any) => html`
${formatDate(log.timestamp)} - ${log.message}
`)}
` : ''} ${execution.data.metrics ? html`

Metrics

${Object.entries(execution.data.metrics).map(([key, value]) => html`
${key} ${typeof value === 'object' ? JSON.stringify(value) : value}
`)}
` : ''} ${execution.data.error ? html`

Error

${execution.data.error.message} ${execution.data.error.stack ? html`
${execution.data.error.stack}
` : ''}
` : ''}
`; } } declare global { interface HTMLElementTagNameMap { 'cloudly-execution-details': CloudlyExecutionDetails; } }