-
Notifications
You must be signed in to change notification settings - Fork 229
feat(compass-aggregations, compass-indexes): add confirm banner for edit pipeline and new banners COMPASS-9700 #7198
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
base: main
Are you sure you want to change the base?
Conversation
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.
Please use showConfirmation
method from @mongodb-js/compass-components
instead of this custom built confirmation modal logic
289879a
to
f5f1030
Compare
1f65dc7
to
894cb50
Compare
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 confirmation banners and validation for editing pipelines and creating search indexes on views. It introduces a new utility function to determine if a view's pipeline is compatible with search indexes and implements confirmation dialogs when modifying views that have existing search indexes.
- Adds
isPipelineSearchQueryable
utility function to validate view pipeline compatibility with search indexes - Implements confirmation dialogs when updating views with existing search indexes
- Disables search index creation buttons and shows warnings for incompatible view pipelines
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/compass-utils/src/view-search-queryable.ts | New utility function to check if a pipeline is search index compatible |
packages/compass-utils/src/view-search-queryable.spec.ts | Test coverage for the new utility function |
packages/compass-utils/src/index.ts | Exports the new utility function |
packages/compass-utils/package.json | Adds mongodb dependency for Document type |
packages/compass-indexes/src/modules/collection-stats.ts | Extends collection stats to include pipeline data |
packages/compass-indexes/src/components/view-version-incompatible-banners/ | Adds test ID to existing banner component |
packages/compass-indexes/src/components/search-indexes-table/ | Adds pipeline validation and disables buttons for incompatible views |
packages/compass-indexes/src/components/indexes/ | Implements new banner for pipeline incompatibility warnings |
packages/compass-indexes/src/components/indexes-toolbar/ | Disables create index button for incompatible pipelines |
packages/compass-indexes/package.json | Adds compass-utils dependency |
packages/compass-aggregations/src/modules/update-view.ts | Implements confirmation dialog when updating views with search indexes |
packages/compass-aggregations/src/modules/update-view.spec.ts | Test coverage for update view confirmation logic |
packages/compass-aggregations/src/modules/search-indexes.ts | Adds optional namespace parameter to fetchIndexes function |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
$addFields, $set or $match stages with the $expr operator are compatible | ||
with search indexes.{' '} | ||
{!hasNoSearchIndexes && 'Edit the view to rebuild search indexes.'}{' '} | ||
<Link href={''} hideExternalIcon> |
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.
The Link component has an empty href attribute, which will result in a broken link. This should point to the actual documentation URL.
<Link href={''} hideExternalIcon> | |
<Link href="https://www.mongodb.com/docs/atlas/atlas-search/" hideExternalIcon> |
Copilot uses AI. Check for mistakes.
@@ -73,6 +76,8 @@ export const dismissViewError = (): DismissViewUpdateErrorAction => ({ | |||
type: DISMISS_VIEW_UPDATE_ERROR, | |||
}); | |||
|
|||
//Exporting this for test only to stub it and set its value | |||
export const showConfirmation = showConfirmationModal; |
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] This comment indicates test-specific code in production. Consider using dependency injection or a more robust testing pattern instead of exporting functions solely for testing purposes.
export const showConfirmation = showConfirmationModal; |
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,30 @@ | |||
import type { Document } from 'mongodb'; | |||
|
|||
export const isPipelineSearchQueryable = (pipeline: Document[]): boolean => { |
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.
This is not immediately obvious from the code, sorry for that, but this package is too generic for something like this helper. If this is metadata related to stages, we should probably add this logic to the @mongodb-js/mongodb-constants (or at least that's the best place I can think of that's thematically appropriate) package in devtools-shared repo and import it from there
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.
Added to devprod-shared! Is this what you had in mine/am I missing anything here: mongodb-js/devtools-shared#567
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes