Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3cf163e
implement raw schema confirmation screen
kpamaran Sep 8, 2025
b4d1784
Merge branch 'main' into mock-data-generator-raw-schema-confirmation-…
kpamaran Sep 8, 2025
7fbb335
shorthand schema render logic in confirmation step
kpamaran Sep 9, 2025
2dfa720
nit
kpamaran Sep 9, 2025
0518349
move tests
kpamaran Sep 9, 2025
be20bc1
revert
kpamaran Sep 9, 2025
7873b6e
nit
kpamaran Sep 9, 2025
780c398
Merge branch 'main' into mock-data-generator-raw-schema-confirmation-…
kpamaran Sep 9, 2025
3ce421a
nit
kpamaran Sep 9, 2025
adf4eac
nit
kpamaran Sep 9, 2025
05aa795
address smaller feedback
kpamaran Sep 10, 2025
5c8e35c
nit
kpamaran Sep 10, 2025
cf25bab
rename
kpamaran Sep 10, 2025
c13f44b
define and handle unsupported state
kpamaran Sep 10, 2025
833fd37
nit
kpamaran Sep 10, 2025
78e3f5a
downgrade log severity
kpamaran Sep 10, 2025
ef9dfc8
add compass-crud as a dep to compass-collection
kpamaran Sep 10, 2025
f0d817a
Merge branch 'main' into mock-data-generator-raw-schema-confirmation-…
kpamaran Sep 10, 2025
65b9a9e
remove validation
kpamaran Sep 10, 2025
e411dd9
avoid cyclical dep
kpamaran Sep 11, 2025
df6c2a6
increase readability given multipel tooltip messages
kpamaran Sep 11, 2025
2b2cc7d
Merge branch 'main' into mock-data-generator-raw-schema-confirmation-…
kpamaran Sep 11, 2025
3634213
add className prop to HadronDocument
kpamaran Sep 12, 2025
d178f00
fix grammar
kpamaran Sep 12, 2025
90ef737
Remove error handling branch
kpamaran Sep 15, 2025
a74d752
Merge branch 'main' into mock-data-generator-raw-schema-confirmation-…
kpamaran Sep 15, 2025
e0181f0
fix sentence
kpamaran Sep 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/compass-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"@mongodb-js/compass-app-stores": "^7.59.0",
"@mongodb-js/compass-components": "^1.51.0",
"@mongodb-js/compass-connections": "^1.73.0",
"@mongodb-js/compass-crud": "^13.72.1",
"@mongodb-js/compass-generative-ai": "^0.53.0",
"@mongodb-js/compass-logging": "^1.7.14",
"@mongodb-js/compass-telemetry": "^1.15.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ const collectionHeaderActionsStyles = css({
gap: spacing[200],
});

const tooltipMessageStyles = css({
display: 'block',
marginBottom: spacing[100],
'&:last-child': {
marginBottom: 0,
},
});

function buildChartsUrl(
groupId: string,
clusterName: string,
Expand Down Expand Up @@ -150,13 +158,28 @@ const CollectionHeaderActions: React.FunctionComponent<
>
{/* TODO(CLOUDP-333853): update disabled open-modal button
tooltip to communicate if schema analysis is incomplete */}
{exceedsMaxNestingDepth &&
'At this time we are unable to generate mock data for collections that have deeply nested documents'}
{isCollectionEmpty &&
'Please add data to your collection to generate similar mock documents'}
{schemaAnalysisError &&
schemaAnalysisError.errorType === 'unsupportedState' &&
'This collection has a field with a name that contains a ".", which mock data generation does not support at this time.'}
<>
{exceedsMaxNestingDepth && (
<span className={tooltipMessageStyles}>
At this time we are unable to generate mock data for collections
that have deeply nested documents.
</span>
)}
{isCollectionEmpty && (
<span className={tooltipMessageStyles}>
Please add data to your collection to generate similar mock
documents.
</span>
)}
{schemaAnalysisError &&
schemaAnalysisError.errorType === 'unsupportedState' && (
<span className={tooltipMessageStyles}>
This collection has a field with a name that contains a
&quot.&quot, which mock data generation does not support at
this time.
</span>
)}
</>
</Tooltip>
)}
{atlasMetadata && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ import {
Banner,
BannerVariant,
Body,
DocumentList,
} from '@mongodb-js/compass-components';

import { usePreference } from 'compass-preferences-model/provider';
import toSimplifiedFieldInfo from './to-simplified-field-info';
import type { CollectionState } from '../../modules/collection-tab';
import type { SchemaAnalysisState } from '../../schema-analysis-types';
import type { MockDataGeneratorState } from './types';
import { Document } from '@mongodb-js/compass-crud';
import HadronDocument from 'hadron-document';

interface RawSchemaConfirmationScreenProps {
schemaAnalysis: SchemaAnalysisState;
fakerSchemaGenerationStatus: MockDataGeneratorState['status'];
}

const documentContainerStyles = css({
backgroundColor: palette.gray.light3,
border: `1px solid ${palette.gray.light2}`,
borderRadius: spacing[400],
});
// note: the "> div" selector works around the lack of a className prop on HadronDocument
const documentContainerStyles = css`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer object notation over template literals, do you mind changing this back? Also if you want to add a className prop support to the component, feel free to do so

Copy link
Collaborator Author

@kpamaran kpamaran Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

went the className prop route

background-color: ${palette.gray.light3};
border: 1px solid ${palette.gray.light2};
border-radius: ${spacing[400]}px;

> div {
padding: ${spacing[400]}px ${spacing[900]}px;
}
`;

const descriptionStyles = css({
marginBottom: spacing[200],
Expand Down Expand Up @@ -65,12 +71,14 @@ const RawSchemaConfirmationScreen = ({
</Body>
<Body className={descriptionStyles}>{descriptionText}</Body>
<div className={documentContainerStyles}>
<Document
<DocumentList.Document
editable={false}
doc={
enableSampleDocumentPassing
? schemaAnalysis.sampleDocument
: toSimplifiedFieldInfo(schemaAnalysis.processedSchema)
value={
new HadronDocument(
enableSampleDocumentPassing
? schemaAnalysis.sampleDocument
: toSimplifiedFieldInfo(schemaAnalysis.processedSchema)
)
}
/>
</div>
Expand Down
Loading