Skip to content

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

DarshanaVenkatesh
Copy link
Collaborator

@DarshanaVenkatesh DarshanaVenkatesh commented Aug 13, 2025

Description

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

Copy link
Collaborator

@gribnoysup gribnoysup left a 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

@DarshanaVenkatesh DarshanaVenkatesh changed the title COMPASS-9700 feat(compass-aggregations, compass-indexes): add confirm banner for edit pipeline and new banners COMPASS-9700 Aug 18, 2025
@DarshanaVenkatesh DarshanaVenkatesh added feat no release notes Fix or feature not for release notes labels Aug 18, 2025
@DarshanaVenkatesh DarshanaVenkatesh marked this pull request as ready for review August 20, 2025 08:02
@Copilot Copilot AI review requested due to automatic review settings August 20, 2025 08:02
@DarshanaVenkatesh DarshanaVenkatesh requested a review from a team as a code owner August 20, 2025 08:02
Copy link
Contributor

@Copilot 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 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>
Copy link
Preview

Copilot AI Aug 20, 2025

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.

Suggested change
<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;
Copy link
Preview

Copilot AI Aug 20, 2025

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.

Suggested change
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 => {
Copy link
Collaborator

@gribnoysup gribnoysup Aug 20, 2025

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

Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat no release notes Fix or feature not for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants