Skip to content

Comments

feat: implement export functionality#1

Merged
TarasKovalenko merged 3 commits intomainfrom
Taras/export-to-json-csv
Feb 20, 2026
Merged

feat: implement export functionality#1
TarasKovalenko merged 3 commits intomainfrom
Taras/export-to-json-csv

Conversation

@TarasKovalenko
Copy link
Owner

@TarasKovalenko TarasKovalenko commented Feb 20, 2026

This pull request introduces a new, robust export feature for secret metadata, along with supporting tests and updates to dependencies. The most significant improvements are the addition of a flexible export handler that supports both download and clipboard fallback, user feedback for export actions, and comprehensive unit tests for export logic.

Export feature enhancements

  • Added a new secretsExport.ts module, which provides buildSecretMetadata and exportSecretMetadata functions to export secret metadata in JSON or CSV format, handling download and clipboard fallback, and reporting errors or success.
  • Updated SecretsList.tsx to use the new export handler, including user feedback messages for export actions and improved export logic with clipboard fallback and error handling. [1] [2] [3] [4]

Testing improvements

  • Added comprehensive unit tests for export logic in secretsExport.test.ts, covering metadata construction, download and clipboard fallback, and error handling scenarios.
  • Updated vitest.config.ts to include the new export module and its tests in coverage and test runs.

Dependency updates

  • Updated several dependencies in package.json to their latest versions, including React, Fluent UI, Tanstack Query, ESLint, and Vitest, ensuring compatibility and improved stability.

Summary by CodeRabbit

  • New Features

    • Enhanced export functionality with real-time status messages showing successful or failed export attempts.
    • Added automatic fallback to clipboard when file download is unavailable.
  • Tests

    • Added comprehensive test coverage for export functionality.
  • Chores

    • Updated dependencies including React, TypeScript, ESLint, and Vite to latest versions for improved stability.

feat: add downloadExport function to SecretsList for exporting secrets in JSON and CSV formats
@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

 _________________________________________________________
< Eliminate bugs. Ship early. Sleep well. Pick all three. >
 ---------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Taras/export-to-json-csv

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @TarasKovalenko, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the application by introducing a robust export functionality for secret metadata. It provides users with the ability to export secret details in either JSON or CSV format, incorporating a resilient mechanism that prioritizes direct downloads but gracefully falls back to clipboard copying. The changes also include clear user feedback for export operations and thorough testing to ensure reliability.

Highlights

  • New Export Feature: Implemented a new export feature for secret metadata, supporting JSON and CSV formats.
  • Flexible Export Handler: Introduced a flexible export handler with automatic fallback to clipboard if direct download fails.
  • User Feedback: Added user-facing feedback messages for successful exports or encountered errors.
  • Comprehensive Unit Tests: Included comprehensive unit tests for the new export logic, covering various scenarios.
  • Dependency Updates: Updated several project dependencies to their latest versions for improved stability and compatibility.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added 'coverage/' to ignore coverage reports.
  • package.json
    • Updated '@fluentui/react-components' from '^9.72.11' to '^9.73.0'.
    • Updated '@fluentui/react-icons' from '^2.0.318' to '^2.0.319'.
    • Updated '@tanstack/react-query' from '^5.90.20' to '^5.90.21'.
    • Updated 'react' from '^19.2.0' to '^19.2.4'.
    • Updated 'react-dom' from '^19.2.0' to '^19.2.4'.
    • Updated '@eslint/js' from '^9.39.1' to '^10.0.1'.
    • Updated '@types/node' from '^24.10.1' to '^25.3.0'.
    • Updated '@types/react' from '^19.2.7' to '^19.2.14'.
    • Updated '@vitejs/plugin-react' from '^5.1.1' to '^5.1.4'.
    • Updated '@vitest/coverage-v8' from '^3.2.4' to '^4.0.18'.
    • Updated 'eslint' from '^9.39.1' to '^10.0.0'.
    • Updated 'eslint-plugin-react-refresh' from '^0.4.24' to '^0.5.0'.
    • Updated 'globals' from '^16.5.0' to '^17.3.0'.
    • Updated 'typescript-eslint' from '^8.48.0' to '^8.56.0'.
    • Updated 'vitest' from '^3.2.4' to '^4.0.18'.
  • src/components/secrets/SecretsList.tsx
    • Imported 'exportSecretMetadata' and 'ExportFormat'.
    • Added 'exportMessage' and 'exportMessageTone' state variables.
    • Memoized 'allSecrets' using 'useMemo' for performance.
    • Implemented a 'useEffect' hook to automatically clear export messages after a delay.
    • Introduced a 'downloadExport' helper function for client-side file downloads.
    • Refactored 'handleExport' to utilize the new 'exportSecretMetadata' module, including callbacks for download, clipboard, error, and success handling.
    • Added a UI element to display export success or error messages.
  • src/components/secrets/secretsExport.test.ts
    • Added a new test file containing unit tests for 'buildSecretMetadata' and 'exportSecretMetadata'.
    • Tested metadata construction, successful download, clipboard fallback on download failure, and error reporting for various scenarios.
  • src/components/secrets/secretsExport.ts
    • Added a new module for secret export functionality.
    • Defined 'ExportFormat' type and function types for dependencies.
    • Introduced 'SecretExportMetadata' interface for structured export data.
    • Implemented 'buildSecretMetadata' to transform 'SecretItem' into exportable metadata.
    • Developed 'exportSecretMetadata' to orchestrate the export process, handling backend calls, download attempts, clipboard fallback, and reporting outcomes.
  • vitest.config.ts
    • Updated 'test.include' to include all '.test.ts' files in 'src/components/secrets/'.
    • Updated 'coverage.include' to add 'src/components/secrets/secretsExport.ts' for coverage reporting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@TarasKovalenko TarasKovalenko merged commit 1296772 into main Feb 20, 2026
6 checks passed
@TarasKovalenko TarasKovalenko deleted the Taras/export-to-json-csv branch February 20, 2026 10:00
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new, robust export feature for secret metadata, along with supporting tests and updates to dependencies. The addition of a flexible export handler that supports both download and clipboard fallback is a significant improvement. The new logic is well-encapsulated and tested. My review includes one suggestion to improve the implementation in SecretsList.tsx by following React best practices for performance.

Comment on lines +196 to +208
const downloadExport = (content: string, format: ExportFormat) => {
const mimeType = format === 'json' ? 'application/json' : 'text/csv;charset=utf-8';
const blob = new Blob([content], { type: mimeType });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `azvault-secrets-${Date.now()}.${format}`;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The downloadExport function is defined inside the SecretsList component, which causes it to be recreated on every render. Since this function does not depend on any component props or state, it can be moved outside the component's scope. This is a React best practice that improves performance by avoiding unnecessary function re-creations and makes the component's rendering logic cleaner.

Copy link

Copilot AI left a 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 pull request adds a comprehensive export feature for secret metadata (not secret values) with robust error handling and clipboard fallback support. The implementation introduces a dedicated export module with unit tests achieving 100% coverage requirements, integrates user feedback messaging into the UI, and updates several dependencies to their latest versions.

Changes:

  • Added new secretsExport.ts module with buildSecretMetadata and exportSecretMetadata functions supporting JSON/CSV export with download and clipboard fallback
  • Updated SecretsList.tsx to integrate the new export functionality with user feedback messages (success/error) that auto-dismiss after 3 seconds
  • Added comprehensive unit tests in secretsExport.test.ts covering all export scenarios including error cases
  • Updated test configuration to include new export module in coverage and expanded test inclusion pattern
  • Updated multiple dependencies (React, Fluent UI, ESLint, Vitest, TypeScript tooling) to latest versions
  • Added coverage/ directory to .gitignore

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vitest.config.ts Updated test inclusion pattern from single file to wildcard and added secretsExport.ts to coverage targets
src/components/secrets/secretsExport.ts New export module implementing metadata extraction, export formatting, and download/clipboard fallback logic
src/components/secrets/secretsExport.test.ts New comprehensive test suite covering all export scenarios with 100% coverage target
src/components/secrets/SecretsList.tsx Integrated export functionality with user feedback UI, replaced inline export logic with module-based approach
package.json Updated dependencies to latest versions including ESLint 10.0.0, Vitest 4.0.18, and React 19.2.4
package-lock.json Lock file updates corresponding to package.json changes
.gitignore Added coverage directory to ignore list
Comments suppressed due to low confidence (1)

src/components/secrets/secretsExport.test.ts:149

  • The test suite does not include a test case for when clipboard write fails after download fails. Consider adding a test that verifies the error handling path when both download and clipboard operations fail (download throws, clipboard is provided but also throws). This would ensure the outer catch block at line 60 in secretsExport.ts properly handles this scenario.
});

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant