-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Added the ignore for the collection nested folders #8725
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
Open
ravindra-bruno
wants to merge
3
commits into
usebruno:main
Choose a base branch
from
ravindra-bruno:feat/bru-3462
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
...rc/components/Sidebar/Collections/Collection/CollectionItem/IgnoreCollectionItem/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import React from 'react'; | ||
| import Modal from 'components/Modal'; | ||
| import { useSelector, useDispatch } from 'react-redux'; | ||
| import { ignoreFolder, closeTabs } from 'providers/ReduxStore/slices/collections/actions'; | ||
| import { recursivelyGetAllItemUids } from 'utils/collections'; | ||
| import toast from 'react-hot-toast'; | ||
|
|
||
| const IgnoreCollectionItem = ({ onClose, item, collectionUid }) => { | ||
| const dispatch = useDispatch(); | ||
| const collection = useSelector((state) => state.collections.collections?.find((c) => c.uid === collectionUid)); | ||
| const isYamlCollection = collection?.format === 'yml' || Boolean(collection?.brunoConfig?.opencollection); | ||
| const configFileName = isYamlCollection ? 'opencollection.yml' : 'bruno.json'; | ||
|
|
||
| const onConfirm = () => { | ||
| dispatch(ignoreFolder(item.uid, collectionUid)) | ||
| .then(() => { | ||
| const tabUids = [...recursivelyGetAllItemUids(item.items), item.uid]; | ||
| dispatch(closeTabs({ tabUids })); | ||
| toast.success('Folder ignored'); | ||
| }) | ||
| .catch((error) => { | ||
| console.error('Error ignoring folder', error); | ||
| toast.error(error?.message || 'Error ignoring folder'); | ||
| }); | ||
| onClose(); | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal | ||
| size="md" | ||
| title="Ignore Folder" | ||
| confirmText="Ignore" | ||
| handleConfirm={onConfirm} | ||
| handleCancel={onClose} | ||
| > | ||
| Ignoring <span className="font-medium">{item.name}</span> will hide it from this | ||
| {' '} | ||
| {isYamlCollection ? 'opencollection (YAML)' : 'Bruno (JSON)'} | ||
| {' '} | ||
| collection by adding it to the | ||
| {' '} | ||
| <span className="font-medium">ignore</span> | ||
| {' '} | ||
| list in | ||
| {' '} | ||
| <span className="font-medium">{configFileName}</span> | ||
| . The folder and its files are not deleted. To restore it later, remove the entry from the | ||
| {' '} | ||
| <span className="font-medium">ignore</span> | ||
| {' '} | ||
| list in | ||
| {' '} | ||
| <span className="font-medium">{configFileName}</span> | ||
| . | ||
| </Modal> | ||
| ); | ||
| }; | ||
|
|
||
| export default IgnoreCollectionItem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Avoid mutating the config returned to Redux.
transformBrunoConfigBeforeSavemutates BRU configs (version→ schema marker andcollectionVersion). This handler returns that same object, so a subsequent ignore can overwrite the real collection version with'1'. Deep-clone before transforming for persistence.Proposed fix
Based on the supplied
transformBrunoConfigBeforeSavedefinition, the transform mutates its argument.Also applies to: 1760-1764
🤖 Prompt for AI Agents