Skip to content

feat: integrate import/export modals and refactor environment handling#6346

Merged
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:fix/export-env
Dec 8, 2025
Merged

feat: integrate import/export modals and refactor environment handling#6346
bijin-bruno merged 1 commit intousebruno:mainfrom
naman-bruno:fix/export-env

Conversation

@naman-bruno
Copy link
Collaborator

@naman-bruno naman-bruno commented Dec 8, 2025

Description

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features
    • Added environment export functionality accessible from the environments sidebar
    • Implemented modal-based interfaces for importing and exporting environments
    • Enhanced environment management workflow with improved UI organization

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Adds export functionality to the environment management UI by introducing modal components for import and export workflows. Replaces existing ImportEnvironment component with ImportEnvironmentModal, adds an Export button to EnvironmentList, and manages modal visibility through state props passed from parent to child components.

Changes

Cohort / File(s) Summary
Environment List UI Enhancement
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js
Added setShowExportModal prop to EnvironmentList component signature; introduced handleExportClick handler and Export button with IconUpload; replaced ImportEnvironment with ImportEnvironmentModal component import
Environment Workspace Modal Integration
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js
Replaced inline ImportEnvironment with ImportEnvironmentModal and ExportEnvironmentModal imports; added local showExportModal state; passed setShowExportModal to EnvironmentList; conditionally rendered ExportEnvironmentModal with onClose and environment props; simplified DefaultTab implementation

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify prop threading of setShowExportModal is consistent between parent and EnvironmentList child component
  • Confirm modal lifecycle (open/close) is properly wired via onClose callback and state management
  • Check that IconUpload import is available and the Export button integrates cleanly with existing environment actions

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

🚀 Environments now take flight,
Export modals shining bright!
Props dance down the component tree,
Modal states flow wild and free.
Upload icons standing tall,
Environment workflows answer the call! 📤

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: integrating import/export modals and refactoring environment handling logic across the environment components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js (1)

29-29: Export modal wiring looks correct; minor naming consistency nit

showExportModal state and the conditional <ExportEnvironmentModal> render are wired correctly and safely closed via onClose. For readability, you might align naming with other booleans (e.g. openExportModal or isExportModalOpen) to match patterns like openCreateModal elsewhere.

Also applies to: 58-66

packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js (1)

15-15: Make export button truly optional-safe when setShowExportModal is absent

You’ve made handleExportClick guard on setShowExportModal, but the Export button still renders even when the prop isn’t provided, making clicks a no-op in those contexts. Consider hiding the button unless the setter is passed.

Example refactor:

-const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironment, setSelectedEnvironment, isModified, setIsModified, collection, setShowExportModal }) => {
+const EnvironmentList = ({ environments, activeEnvironmentUid, selectedEnvironment, setSelectedEnvironment, isModified, setIsModified, collection, setShowExportModal }) => {
   ...
-              <button className="btn-action" onClick={() => handleExportClick()} title="Export environment">
-                <IconUpload size={16} strokeWidth={1.5} />
-              </button>
+              {setShowExportModal && (
+                <button className="btn-action" onClick={() => handleExportClick()} title="Export environment">
+                  <IconUpload size={16} strokeWidth={1.5} />
+                </button>
+              )}

This keeps the UX clean in any future call sites that don’t support export yet.

Also applies to: 299-301

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc107f8 and 0f25787.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js (4 hunks)
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js
🧬 Code graph analysis (2)
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js (1)
packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/index.js (1)
  • ImportEnvironmentModal (14-164)
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js (2)
packages/bruno-app/src/components/Environments/Common/ImportEnvironmentModal/index.js (1)
  • ImportEnvironmentModal (14-164)
packages/bruno-app/src/components/Environments/Common/ExportEnvironmentModal/index.js (1)
  • ExportEnvironmentModal (10-267)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
🔇 Additional comments (6)
packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/index.js (3)

7-8: Use of shared import/export modals is appropriate

Reusing the common ImportEnvironmentModal and ExportEnvironmentModal keeps import/export logic centralized and consistent; imports look correct and follow existing patterns.


10-23: DefaultTab wiring to tab state is clean

The empty-state DefaultTab cleanly drives the tab state into the existing create/import branches, with simple, readable JSX and no extra local state.


40-40: Import tab now correctly uses ImportEnvironmentModal

Using <ImportEnvironmentModal type="global" onClose={() => setTab('default')} /> matches the modal’s API (no collection required for global) and keeps the UX consistent with the previous import tab.

packages/bruno-app/src/components/WorkspaceHome/WorkspaceEnvironments/EnvironmentList/index.js (3)

5-5: Icon imports remain consistent with usage

Adding IconUpload into the existing @tabler/icons import keeps icon usage centralized and matches the new export button.


8-8: Switch to ImportEnvironmentModal keeps import flow centralized

Using the shared ImportEnvironmentModal with type="global" in the list aligns this flow with the rest of the app and keeps import behavior in one place.

Also applies to: 279-279


261-265: Export ignores isModified, potentially exporting stale data

Create/import actions respect isModified and route through the confirm-switch flow, but export currently does not. That means a user can export while there are unsaved edits in EnvironmentDetails, and the exported data may not match what they see.

Consider reusing the same guard:

-  const handleExportClick = () => {
-    if (setShowExportModal) {
-      setShowExportModal(true);
-    }
-  };
+  const handleExportClick = () => {
+    if (isModified) {
+      setSwitchEnvConfirmClose(true);
+      return;
+    }
+    if (setShowExportModal) {
+      setShowExportModal(true);
+    }
+  };

This keeps export behavior consistent with other actions when there are unsaved changes.

Also applies to lines 299-301.

Copy link
Collaborator

@bijin-bruno bijin-bruno left a comment

Choose a reason for hiding this comment

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

@naman-bruno Need some follow up changes

  1. After importing collections it's auto selecting the last among newly imported envs
  2. It shows changes save when clicking on save multiple times. It used to show "nothing to save". I feel we can improvise the experience with a draft indicator and prevent writing when there are no changes.

@bijin-bruno bijin-bruno merged commit 4016754 into usebruno:main Dec 8, 2025
10 of 11 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 18, 2025
6 tasks
@coderabbitai coderabbitai bot mentioned this pull request Feb 2, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants