-
Notifications
You must be signed in to change notification settings - Fork 291
Add CSV export functionality for metrics data in API response tab #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: karpikpl <[email protected]>
Co-authored-by: karpikpl <[email protected]>
|
@copilot |
…pilotMetrics CSV export Co-authored-by: karpikpl <[email protected]>
I've addressed your feedback by removing the unused
The Full CSV flattens all nested metrics data by day, including:
This provides users with comprehensive access to all the detailed metrics data in a flat CSV format for analysis. The implementation includes proper TypeScript typing, comprehensive tests, and maintains backward compatibility. Commit: 806eb72 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CSV export capabilities for both summary and full metrics data, including utility functions, UI integration, and tests.
- Introduces
convertMetricsToCSV,convertCopilotMetricsToCSV, anddownloadCSVutilities for CSV generation and download - Updates the API response component to include two new download buttons with handlers
- Adds comprehensive unit tests for CSV export functions
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/csvExport.nuxt.spec.ts | New unit tests covering summary and full CSV export edge cases |
| app/utils/csvExport.ts | Implements CSV conversion and browser download functionality |
| app/components/ApiResponse.vue | Adds "Download CSV" buttons and corresponding methods |
| app/model/MetricsToUsageConverter.ts | Enhances conversion from CopilotMetrics to Metrics |
| app/model/MetricsValidator.ts | Improves validation of continuous dates and invalid entries |
| app/model/Copilot_Metrics.ts | Expands and types Copilot metrics model classes |
Comments suppressed due to low confidence (2)
app/model/MetricsToUsageConverter.ts:4
- [nitpick] The function name
convertToMetricsis ambiguous—consider renaming it toconvertCopilotMetricsToMetricsor similar to clearly convey its purpose.
export const convertToMetrics = (copilotMetrics: CopilotMetrics[]): Metrics[] => {
app/model/MetricsToUsageConverter.ts:4
- The converter references
MetricsandBreakdownDatabut they are not imported in this module, resulting in a compile error. Addimport { Metrics, BreakdownData } from '@/model/Metrics';at the top.
export const convertToMetrics = (copilotMetrics: CopilotMetrics[]): Metrics[] => {
| console.error('Error generating CSV:', error); | ||
| } | ||
| this.showCopyMessage = true; |
Copilot
AI
Jul 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The showCopyMessage flag is reused for download notifications, which may overlap with copy-to-clipboard messages. Consider introducing a separate state (e.g., showDownloadMessage) for download success/error to improve clarity.
| if (prevDate && currDate) { | ||
| const diffDays = (currDate.getTime() - prevDate.getTime()) / (1000 * 60 * 60 * 24); | ||
|
|
||
| if (diffDays > 1) { | ||
| for (let d = 1; d < diffDays; d++) { | ||
| const missingDate = new Date(prevDate.getTime() + d * (1000 * 60 * 60 * 24)); | ||
| const dateString = missingDate.toISOString().split('T')[0]; | ||
| if (dateString) { | ||
| missingDates.push(dateString); | ||
| } |
Copilot
AI
Jul 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Since the dates array only contains valid Date objects, the prevDate and currDate null checks are redundant. You can simplify the loop by removing this guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot can you fix this?
This PR implements CSV export functionality that allows users to download GitHub Copilot metrics data in CSV format directly from the API response tab.
Changes Made
New Features
app/utils/csvExport.tsto convert metrics data to properly formatted CSVcopilot-metrics-2025-01-07.csv)CSV Format
The exported CSV includes all essential metrics with user-friendly headers:
Example CSV output:
User Experience
Testing
Technical Implementation
Metricsdata for consistent formattingThis enhancement makes it easy for users to export GitHub Copilot metrics for analysis in Excel, Google Sheets, or other data analysis tools, addressing a common user need for data portability.
Fixes #223.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.fontshare.comnode (vitest)(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev(dns block)api.fontsource.orgnode (vitest)(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev(dns block)fonts.bunny.netnode (vitest)(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev(dns block)fonts.google.comnode (vitest)(dns block)node /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/.bin/nuxt build(dns block)/usr/local/bin/node --enable-source-maps /home/REDACTED/work/copilot-metrics-viewer/copilot-metrics-viewer/node_modules/@nuxt/cli/bin/nuxi.mjs _dev(dns block)fonts.googleapis.comnode (vitest 2)(dns block)node (vitest 1)(dns block)node (vitest 3)(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.