mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-21 08:15:23 -04:00
[PR #238] [MERGED] Add Analytics Dashboard and Template Management System #259
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/238
Author: @asdek
Created: 4/7/2026
Status: ✅ Merged
Merged: 4/7/2026
Merged by: @asdek
Base:
main← Head:feature/frontend📝 Commits (4)
53ea23efeat: dashboardfe9ba1afeat: update terminal445f131chore: remove unused frontend Dockerfile, entrypoint script, and Nginx configuration files089dcb3feat: implement flow templates management📊 Changes
88 files changed (+8368 additions, -1744 deletions)
View changed files
📝
.gitignore(+2 -0)➕
backend/migrations/sql/20260325_120000_flow_templates.sql(+49 -0)📝
backend/pkg/database/converter/converter.go(+19 -0)➕
backend/pkg/database/flow_templates.sql.go(+153 -0)📝
backend/pkg/database/models.go(+9 -0)📝
backend/pkg/database/querier.go(+5 -0)📝
backend/pkg/graph/generated.go(+1963 -591)📝
backend/pkg/graph/model/models_gen.go(+19 -0)📝
backend/pkg/graph/schema.graphqls(+35 -0)📝
backend/pkg/graph/schema.resolvers.go(+241 -0)📝
backend/pkg/graph/subscriptions/controller.go(+12 -0)📝
backend/pkg/graph/subscriptions/publisher.go(+12 -0)📝
backend/pkg/graph/subscriptions/subscriber.go(+12 -0)📝
backend/pkg/server/router.go(+2 -0)➕
backend/sqlc/models/flow_templates.sql(+32 -0)📝
frontend/graphql-schema.graphql(+59 -0)📝
frontend/package-lock.json(+551 -84)📝
frontend/package.json(+14 -8)📝
frontend/src/app.tsx(+115 -97)📝
frontend/src/components/layouts/main-layout.tsx(+1 -1)...and 68 more files
📄 Description
Description of the Change
Problem
Users lacked visibility into system resource usage and operational efficiency:
No Analytics Dashboard:
Manual Flow Creation:
Outdated Dependencies:
Solution
Analytics Dashboard with Dual Perspectives:
Template Management System:
Modern UI Stack:
Backend GraphQL Extensions:
usageStatsTotal,usageStatsByPeriod,usageStatsByProvider,usageStatsByModel,usageStatsByAgentTypetoolcallsStatsTotal,toolcallsStatsByPeriod,toolcallsStatsByFunctionflowsStatsTotal,flowsStatsByPeriod,flowsExecutionStatsByPeriodNavigation Improvements:
/and/flows)Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
/dashboard, verify Analytics tab displays charts for tokens, costs, tool calls, and flow execution with Week/Month/Quarter period selection/templates/new, create custom template with title and text, verify Monaco editor functionality, save template/redirects to/dashboard), sidebar shows Dashboard and Templates sectionsTest Results
npm run lintpassedSecurity Considerations
No Security Impact:
Performance Impact
Improvements:
Overhead:
Optimization Notes:
createdAt,userId,providerName,agentTypeDocumentation Updates
Deployment Notes
No Special Requirements:
Deployment Steps:
docker compose builddocker compose up -dCompatibility:
Post-Deployment:
/dashboard/to/dashboard/templates/flowsroute still accessible via sidebarChecklist
Code Quality
go fmtandgo vet(for Go code)npm run lint(for TypeScript/JavaScript code)Security
Compatibility
Documentation
Additional Notes
Key Changes by Category
Dashboard System (New)
Analytics Tab - Time-series data visualization:
frontend/src/pages/dashboard/dashboard-analytics.tsx(467 lines)Overview Tab - Aggregate statistics:
frontend/src/pages/dashboard/dashboard-overview.tsx(237 lines)Utilities:
frontend/src/pages/dashboard/format-utils.ts(57 lines)formatTokenCount(K/M/B suffixes),formatCost($0.00),formatDuration(Xh Ym Zs),formatNumber(comma-separated)Template Management System (New)
Template Editor:
frontend/src/pages/templates/template.tsx(346 lines)Template List:
frontend/src/pages/templates/templates.tsx(303 lines)Template Provider:
frontend/src/providers/templates-provider.tsx(new)pentagi-templates)createTemplate,getTemplate,updateTemplate,deleteTemplate,listTemplatesUI/UX Improvements
Navigation Overhaul:
frontend/src/app.tsx,frontend/src/components/layouts/main-sidebar.tsxFlowMenuItemcomponent)Component Library Updates:
Backend GraphQL API Extensions
Usage Statistics Queries (new):
usageStatsTotal: Aggregate all-time usage statisticsusageStatsByPeriod(period: UsageStatsPeriod!): Time-series data (WEEK/MONTH/QUARTER)usageStatsByProvider: Breakdown by LLM provider (OpenAI, Anthropic, etc.)usageStatsByModel: Breakdown by specific model (GPT-4, Claude Sonnet, etc.)usageStatsByAgentType: Breakdown by agent role (Primary, Pentester, Coder, etc.)Tool Call Statistics Queries (new):
toolcallsStatsTotal: Total tool call count and durationtoolcallsStatsByPeriod(period: UsageStatsPeriod!): Time-series tool call datatoolcallsStatsByFunction: Function-level breakdown (terminal, file, search, etc.)Flow Statistics Queries (new):
flowsStatsTotal: Total flow count, average duration, status distributionflowsStatsByPeriod(period: UsageStatsPeriod!): Time-series flow creation dataflowsExecutionStatsByPeriod(period: UsageStatsPeriod!): Daily execution metricsGraphQL Types (new):
UsageStatsFragmentFragment: Token counts (in/out/cacheIn/cacheOut) and costsUsageStatsPeriod: Enum (WEEK, MONTH, QUARTER)ToolCallStats,FlowStats, etc.Database Optimization:
createdAt,userId,providerName,agentTypeDependency Updates
Frontend:
User-Facing Benefits
For Penetration Testers
For Product Teams
Files Changed Summary
Frontend (65+ files):
dashboard/,templates/app.tsx,main-sidebar.tsx, route configurationBackend:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.