Skip to content

Commit af983fd

Browse files
committed
cleanup and banner
1 parent 0205fb4 commit af983fd

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

packages/compass-schema/src/components/schema-toolbar/schema-toolbar.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, { useMemo } from 'react';
22
import {
3+
Banner,
4+
BannerVariant,
35
Body,
46
Button,
57
ErrorSummary,
@@ -45,10 +47,6 @@ const schemaToolbarActionBarRightStyles = css({
4547
});
4648

4749
const ERROR_WARNING = 'An error occurred during schema analysis';
48-
const COMPLEXITY_ABORT_MESSAGE = `
49-
Analysis was aborted due to: Fields count above 1000.
50-
Consider breaking up your data into more collections with smaller documents, and using references to consolidate the data you need.
51-
`;
5250
const INCREASE_MAX_TIME_MS_HINT_MESSAGE =
5351
'Operation exceeded time limit. Please try increasing the maxTimeMS for the query in the filter options.';
5452
const OUTDATED_WARNING_MESSAGE =
@@ -61,7 +59,7 @@ const SCHEMA_ANALYSIS_DOCS_LINK =
6159

6260
type SchemaToolbarProps = {
6361
analysisState: AnalysisState;
64-
error: SchemaAnalysisError;
62+
error?: SchemaAnalysisError;
6563
isOutdated: boolean;
6664
onAnalyzeSchemaClicked: () => void;
6765
onExportSchemaClicked: () => void;
@@ -141,10 +139,18 @@ const SchemaToolbar: React.FunctionComponent<SchemaToolbarProps> = ({
141139
<WarningSummary warnings={[INCREASE_MAX_TIME_MS_HINT_MESSAGE]} />
142140
)}
143141
{error?.errorType === 'HIGH_COMPLEXITY' && (
144-
<ErrorSummary
142+
<Banner
143+
variant={BannerVariant.Danger}
145144
data-testid="schema-toolbar-complexity-abort-message"
146-
errors={[COMPLEXITY_ABORT_MESSAGE]}
147-
/>
145+
dismissible={true}
146+
>
147+
Analysis was aborted due to: Fields count above 1000. Consider
148+
breaking up your data into more collections with smaller documents,
149+
and using references to consolidate the data you need.&nbsp;
150+
<Link href="https://www.mongodb.com/cloud/atlas/lp/search-1">
151+
Learn more
152+
</Link>
153+
</Banner>
148154
)}
149155
{analysisState === ANALYSIS_STATE_COMPLETE && isOutdated && (
150156
<WarningSummary warnings={[OUTDATED_WARNING_MESSAGE]} />

packages/compass-schema/src/modules/schema-analysis.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ function promoteMongoErrorCode(err?: Error & { code?: unknown }) {
1919
return new Error('Unknown error');
2020
}
2121

22-
console.log({ name: err.name, code: err.code });
23-
2422
if (err.name === 'MongoError' && err.code !== undefined) {
2523
err.code = JSON.parse(JSON.stringify(err.code));
2624
}
@@ -73,7 +71,6 @@ export const analyzeSchema = async (
7371
ns,
7472
error: err.message,
7573
});
76-
console.log('FAILED', err);
7774
if (dataService.isCancelError(err)) {
7875
debug('caught background operation terminated error', err);
7976
return;

packages/compass-schema/src/stores/schema-analysis-reducer.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ function getErrorDetails(error: Error): SchemaAnalysisError {
116116
errorType = 'TIMEOUT';
117117
} else if (error.message.includes('Schema analysis aborted: Fields count')) {
118118
errorType = 'HIGH_COMPLEXITY';
119-
// return {
120-
// description: COMPLEXITY_ABORT_MESSAGE,
121-
// actionElement: `<a href="https://www.mongodb.com/cloud/atlas/lp/search-1">Learn more</a>`,
122-
// };
123119
}
124120

125121
return {

0 commit comments

Comments
 (0)