import * as plugins from '../../../plugins.js'; import * as appstate from '../../../appstate.js'; import { viewHostCss } from '../../shared/index.js'; import { DeesElement, customElement, html, state, css, cssManager, type TemplateResult, } from '@design.estate/dees-element'; @customElement('gitops-view-overview') export class GitopsViewOverview extends DeesElement { @state() accessor connectionsState: appstate.IConnectionsState = { connections: [], activeConnectionId: null, }; @state() accessor dataState: appstate.IDataState = { projects: [], groups: [], secrets: [], pipelines: [], pipelineJobs: [], currentJobLog: '', }; constructor() { super(); const connSub = appstate.connectionsStatePart .select((s) => s) .subscribe((s) => { this.connectionsState = s; }); this.rxSubscriptions.push(connSub); const dataSub = appstate.dataStatePart .select((s) => s) .subscribe((s) => { this.dataState = s; }); this.rxSubscriptions.push(dataSub); } public static styles = [ cssManager.defaultStyles, viewHostCss, css` .stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; } .stat-card { background: #1a1a2e; border: 1px solid #333; border-radius: 8px; padding: 20px; text-align: center; } .stat-value { font-size: 36px; font-weight: 700; color: #00acff; margin-bottom: 8px; } .stat-label { font-size: 14px; color: #999; text-transform: uppercase; letter-spacing: 1px; } `, ]; public render(): TemplateResult { const connCount = this.connectionsState.connections.length; const projCount = this.dataState.projects.length; const groupCount = this.dataState.groups.length; const pipelineCount = this.dataState.pipelines.length; const failedPipelines = this.dataState.pipelines.filter((p) => p.status === 'failed').length; return html`
Overview
GitOps dashboard - manage your Gitea and GitLab instances
${connCount}
Connections
${projCount}
Projects
${groupCount}
Groups
${pipelineCount}
Pipelines
${failedPipelines}
Failed Pipelines
`; } }