Skip to content

Commit a8a9a66

Browse files
committed
cleanup and banner
1 parent 688c672 commit a8a9a66

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
@@ -29,8 +29,6 @@ function promoteMongoErrorCode(err?: Error & { code?: unknown }) {
2929
return new Error('Unknown error');
3030
}
3131

32-
console.log({ name: err.name, code: err.code });
33-
3432
if (err.name === 'MongoError' && err.code !== undefined) {
3533
err.code = JSON.parse(JSON.stringify(err.code));
3634
}
@@ -83,7 +81,6 @@ export const analyzeSchema = async (
8381
ns,
8482
error: err.message,
8583
});
86-
console.log('FAILED', err);
8784
if (dataService.isCancelError(err)) {
8885
debug('caught background operation terminated error', err);
8986
return;

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

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

122118
return {

0 commit comments

Comments
 (0)