-
Notifications
You must be signed in to change notification settings - Fork 239
feat(compass-collection): Connect schema redux state to modal and filter collections based on nesting depth - CLOUDP-342665 #7283
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
Changes from 1 commit
a298132
a3052fc
fb8505b
031c2a3
4050da7
5a4fbfc
a133e0a
0a0ab7b
18c4d75
932193f
fc34475
137267c
73e7a45
73cb0b1
e37fc16
e0c9a0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -13,15 +13,18 @@ import { MockDataGeneratorStep } from '../components/mock-data-generator-modal/t | |||
| import type { Collection } from '@mongodb-js/compass-app-stores/provider'; | ||||
| import type { ActivateHelpers } from '@mongodb-js/compass-app-registry'; | ||||
| import type { workspacesServiceLocator } from '@mongodb-js/compass-workspaces/provider'; | ||||
| import type { experimentationServiceLocator } from '@mongodb-js/compass-telemetry/provider'; | ||||
| import type { ExperimentationServices } from '@mongodb-js/compass-telemetry/provider'; | ||||
| import type { connectionInfoRefLocator } from '@mongodb-js/compass-connections/provider'; | ||||
| import type { Logger } from '@mongodb-js/compass-logging/provider'; | ||||
| import type { AtlasAiService } from '@mongodb-js/compass-generative-ai/provider'; | ||||
| import { | ||||
| isAIFeatureEnabled, | ||||
| type PreferencesAccess, | ||||
| } from 'compass-preferences-model/provider'; | ||||
| import { ExperimentTestName } from '@mongodb-js/compass-telemetry/provider'; | ||||
| import { | ||||
| ExperimentTestName, | ||||
| ExperimentTestGroup, | ||||
| } from '@mongodb-js/compass-telemetry/provider'; | ||||
| import { SCHEMA_ANALYSIS_STATE_INITIAL } from '../schema-analysis-types'; | ||||
|
|
||||
| export type CollectionTabOptions = { | ||||
|
|
@@ -46,7 +49,7 @@ export type CollectionTabServices = { | |||
| localAppRegistry: AppRegistry; | ||||
| atlasAiService: AtlasAiService; | ||||
| workspaces: ReturnType<typeof workspacesServiceLocator>; | ||||
| experimentationServices: ReturnType<typeof experimentationServiceLocator>; | ||||
| experimentationServices: ExperimentationServices; | ||||
| connectionInfoRef: ReturnType<typeof connectionInfoRefLocator>; | ||||
| logger: Logger; | ||||
| preferences: PreferencesAccess; | ||||
|
|
@@ -153,8 +156,37 @@ export function activatePlugin( | |||
| } | ||||
|
|
||||
| if (!metadata.isReadonly && !metadata.isTimeSeries) { | ||||
| // TODO: Consider checking experiment variant | ||||
| void store.dispatch(analyzeCollectionSchema()); | ||||
| // Check experiment variant before running schema analysis | ||||
| // Only run schema analysis if user is in treatment variant | ||||
| const shouldRunSchemaAnalysis = async () => { | ||||
| try { | ||||
| const assignment = await experimentationServices.getAssignment( | ||||
| ExperimentTestName.mockDataGenerator, | ||||
| false // Don't track "Experiment Viewed" event here | ||||
| ); | ||||
| return ( | ||||
| assignment?.assignmentData?.variant === | ||||
| ExperimentTestGroup.mockDataGeneratorVariant | ||||
| ); | ||||
| } catch (error) { | ||||
| // On error, default to not running schema analysis | ||||
| logger.debug( | ||||
| 'Failed to get Mock Data Generator experiment assignment', | ||||
| { | ||||
| experiment: ExperimentTestName.mockDataGenerator, | ||||
| namespace: namespace, | ||||
| error: error instanceof Error ? error.message : String(error), | ||||
| } | ||||
| ); | ||||
| return false; | ||||
| } | ||||
| }; | ||||
|
|
||||
| void shouldRunSchemaAnalysis().then((shouldRun) => { | ||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want to cancel or skip the analysis if the tab is closed / plugin is Here's an example:
|
||||
| if (shouldRun) { | ||||
| void store.dispatch(analyzeCollectionSchema()); | ||||
| } | ||||
| }); | ||||
| } | ||||
| }); | ||||
|
|
||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.