-
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a298132
WIP
jcobis a3052fc
WIP
jcobis fb8505b
Merge branch 'main' into CLOUDP-342665
jcobis 031c2a3
Merge branch 'main' into CLOUDP-342665
jcobis 4050da7
Handle undefined
jcobis 5a4fbfc
Comments
jcobis a133e0a
Move tests
jcobis 0a0ab7b
Address comment
jcobis 18c4d75
Merge branch 'main' into CLOUDP-342665
jcobis 932193f
Merge branch 'main' into CLOUDP-342665
jcobis fc34475
Add getAssignment to experimentation interface
jcobis 137267c
Dependency updates
jcobis 73e7a45
Hide button tooltip while analysis in progress
jcobis 73cb0b1
Merge branch 'main' into CLOUDP-342665
jcobis e37fc16
Address comment to add tooltip
jcobis e0c9a0a
Add thunk action abort signal cancellation
jcobis 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,11 @@ import { | |
| ExperimentTestGroup, | ||
| } from '@mongodb-js/compass-telemetry/provider'; | ||
|
|
||
| /** | ||
| * Maximum allowed nesting depth for collections to show Mock Data Generator | ||
| */ | ||
| const MAX_COLLECTION_NESTING_DEPTH = 4; | ||
|
|
||
| const collectionHeaderActionsStyles = css({ | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
|
|
@@ -47,6 +52,8 @@ type CollectionHeaderActionsProps = { | |
| sourceName?: string; | ||
| sourcePipeline?: unknown[]; | ||
| onOpenMockDataModal: () => void; | ||
| hasSchemaAnalysisData: boolean; | ||
| analyzedSchemaDepth: number; | ||
| }; | ||
|
|
||
| const CollectionHeaderActions: React.FunctionComponent< | ||
|
|
@@ -58,6 +65,8 @@ const CollectionHeaderActions: React.FunctionComponent< | |
| sourceName, | ||
| sourcePipeline, | ||
| onOpenMockDataModal, | ||
| hasSchemaAnalysisData, | ||
| analyzedSchemaDepth, | ||
| }: CollectionHeaderActionsProps) => { | ||
| const connectionInfo = useConnectionInfo(); | ||
| const { id: connectionId, atlasMetadata } = connectionInfo; | ||
|
|
@@ -84,10 +93,8 @@ const CollectionHeaderActions: React.FunctionComponent< | |
| isInMockDataTreatmentVariant && | ||
| atlasMetadata && // Only show in Atlas | ||
| !isReadonly && // Don't show for readonly collections (views) | ||
| !sourceName; // sourceName indicates it's a view | ||
| // TODO: CLOUDP-337090: also filter out overly nested collections | ||
|
|
||
| const hasData = true; // TODO: CLOUDP-337090 | ||
| !sourceName && // sourceName indicates it's a view | ||
| analyzedSchemaDepth < MAX_COLLECTION_NESTING_DEPTH; // Filter out overly nested collections | ||
|
||
|
|
||
| return ( | ||
| <div | ||
|
|
@@ -111,13 +118,13 @@ const CollectionHeaderActions: React.FunctionComponent< | |
| )} | ||
| {shouldShowMockDataButton && ( | ||
| <Tooltip | ||
| enabled={!hasData} | ||
| enabled={!hasSchemaAnalysisData} | ||
Anemy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| trigger={ | ||
| <div> | ||
| <Button | ||
| data-testid="collection-header-generate-mock-data-button" | ||
| size={ButtonSize.Small} | ||
| disabled={!hasData} | ||
| disabled={!hasSchemaAnalysisData} | ||
| onClick={onOpenMockDataModal} | ||
| leftGlyph={<Icon glyph="Sparkle" />} | ||
| > | ||
|
|
||
Oops, something went wrong.
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.
q - Do we care about observing when
analyzedSchemaDepth < MAX_COLLECTION_NESTING_DEPTH? If so, might be worth doing this check in the thunk and logging it 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.
Interesting thought. I can ask analytics
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.
In the meantime, if we do decide on this, how about we include this change as part of the analytics ticket?