Skip to content

Commit acf4d32

Browse files
Merge remote-tracking branch 'origin/main' into beta-releases
2 parents 86fdc9d + 6200824 commit acf4d32

File tree

10 files changed

+146
-56
lines changed

10 files changed

+146
-56
lines changed

.evergreen/functions.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,8 @@ functions:
805805
return_code=$?
806806
set -e
807807
808+
echo
809+
808810
# Runs for all the commits on main, including nightly builds:
809811
if [[ "$EVERGREEN_IS_PATCH" != "true" ]] && [[ "${project}" == "10gen-compass-main" ]]; then
810812
export JIRA_BASE_URL="https://jira.mongodb.org"
@@ -816,6 +818,8 @@ functions:
816818
cat .sbom/vulnerability-report.md
817819
fi
818820
821+
echo
822+
819823
# Fails if the report failed and is not a patch, including release branches:
820824
if [[ "$EVERGREEN_IS_PATCH" != "true" ]]; then
821825
exit $return_code

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The following third-party software is used by and included in **Mongodb Compass**.
2-
This document was automatically generated on Thu Mar 07 2024.
2+
This document was automatically generated on Sun Mar 10 2024.
33

44
## List of dependencies
55

packages/compass-e2e-tests/index.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,21 @@ function cleanup() {
107107
removeUserDataDir();
108108

109109
const disableStartStop = process.argv.includes('--disable-start-stop');
110+
const shouldTestCompassWeb = process.argv.includes('--test-compass-web');
110111

111112
if (!disableStartStop) {
112-
debug('Stopping compass-web');
113-
try {
114-
if (compassWeb.pid) {
115-
debug(`killing compass-web [${compassWeb.pid}]`);
116-
kill(compassWeb.pid);
117-
} else {
118-
debug('no pid for compass-web');
113+
if (shouldTestCompassWeb) {
114+
debug('Stopping compass-web');
115+
try {
116+
if (compassWeb.pid) {
117+
debug(`killing compass-web [${compassWeb.pid}]`);
118+
kill(compassWeb.pid);
119+
} else {
120+
debug('no pid for compass-web');
121+
}
122+
} catch (e) {
123+
debug('Failed to stop compass-web', e);
119124
}
120-
} catch (e) {
121-
debug('Failed to stop compass-web', e);
122125
}
123126

124127
debug('Stopping MongoDB server');

packages/compass-indexes/src/components/indexes/indexes.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ const AtlasIndexesBanner = () => {
4242
<Banner variant="info">
4343
<Body weight="medium">Looking for search indexes?</Body>
4444
These indexes can be created and viewed under{' '}
45+
{/* todo: COMPASS-7701 add correct link */}
46+
{/* #/clusters/atlasSearch/{clusterName} */}
4547
<Link href={'#/clusters/atlasSearch'} target="_blank" hideExternalIcon>
46-
Atlas Search
48+
Atlas Search.
4749
</Link>
48-
.
4950
</Banner>
5051
);
5152
};

packages/compass-preferences-model/src/feature-flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const featureFlags: Required<{
8080
* Feature flag for the rename collection modal.
8181
*/
8282
enableRenameCollectionModal: {
83-
stage: 'development',
83+
stage: 'released',
8484
description: {
8585
short: 'Enables renaming a collection',
8686
long: 'Allows users to rename a collection from the sidebar',

packages/compass-preferences-model/src/preferences-schema.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ export type UserConfigurablePreferences = PermanentFeatureFlags &
5454
enableImportExport: boolean;
5555
enableAggregationBuilderRunPipeline: boolean;
5656
enableAggregationBuilderExtraOptions: boolean;
57+
enableHackoladeBanner: boolean;
58+
enablePerformanceAdvisorBanner: boolean;
5759
};
5860

5961
export type InternalUserPreferences = {
@@ -703,6 +705,29 @@ export const storedUserPreferencesProps: Required<{
703705
type: 'boolean',
704706
},
705707

708+
enableHackoladeBanner: {
709+
ui: true,
710+
cli: true,
711+
global: true,
712+
description: {
713+
short:
714+
'Show Hackolade banner to users for data modeling and schema design',
715+
},
716+
validator: z.boolean().default(true),
717+
type: 'boolean',
718+
},
719+
720+
enablePerformanceAdvisorBanner: {
721+
ui: true,
722+
cli: true,
723+
global: true,
724+
description: {
725+
short: 'Show performance advisor banner to users for performance tuning',
726+
},
727+
validator: z.boolean().default(false),
728+
type: 'boolean',
729+
},
730+
706731
...allFeatureFlagsProps,
707732
};
708733

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

Lines changed: 79 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,48 @@ import {
2424
useDarkMode,
2525
WorkspaceContainer,
2626
lighten,
27+
Banner,
28+
Body,
29+
Badge,
30+
Icon,
2731
} from '@mongodb-js/compass-components';
2832
import { HackoladePromoBanner } from './promo-banner';
2933
import type { configureActions } from '../actions';
34+
import { usePreference } from 'compass-preferences-model/provider';
3035

31-
const rootStyles = css`
32-
width: 100%;
33-
height: 100%;
34-
display: flex;
35-
flex-direction: column;
36-
align-items: stretch;
37-
flex-grow: 1;
38-
flex-shrink: 1;
39-
`;
36+
const rootStyles = css({
37+
width: '100%',
38+
height: '100%',
39+
display: 'flex',
40+
flexDirection: 'column',
41+
alignItems: 'stretch',
42+
flexGrow: 1,
43+
flexShrink: 1,
44+
});
4045

41-
const loaderStyles = css`
42-
height: 100%;
43-
display: flex;
44-
justify-content: center;
45-
`;
46+
const loaderStyles = css({
47+
height: '100%',
48+
display: 'flex',
49+
justifyContent: 'center',
50+
});
4651

47-
const schemaStyles = css`
48-
width: 100%;
49-
padding: 0 ${spacing[3]}px;
50-
flex-grow: 1;
51-
overflow: auto;
52-
`;
52+
const schemaStyles = css({
53+
width: '100%',
54+
flexGrow: 1,
55+
overflow: 'auto',
56+
});
57+
58+
const contentStyles = css({
59+
paddingLeft: spacing[3],
60+
paddingRight: spacing[3],
61+
display: 'flex',
62+
flexDirection: 'column',
63+
gap: spacing[3],
64+
});
65+
66+
const insightsBadgeStyles = css({
67+
verticalAlign: 'middle',
68+
});
5369

5470
const minichartStyles = (darkMode: boolean) => {
5571
const mcBlue0 = palette.blue.light1;
@@ -314,6 +330,27 @@ const FieldList: React.FunctionComponent<{
314330
);
315331
};
316332

333+
const nbsp = '\u00a0';
334+
const PerformanceAdvisorBanner = () => {
335+
return (
336+
<Banner variant="info">
337+
<Body weight="medium">Looking for schema anti-patterns?</Body>
338+
In its place, you may refer to Data Explorer’s performance insights{' '}
339+
<Badge className={insightsBadgeStyles} variant="blue">
340+
<Icon glyph="Bulb" size="small" />
341+
Insight
342+
</Badge>
343+
{nbsp}or{nbsp}
344+
{/* todo: COMPASS-7701 add correct link */}
345+
{/* #/metrics/replicaSet/{clusterId}/advisor */}
346+
{/* #/serverless/advisor/{clusterName}/createIndexes */}
347+
<Link href="#/" target="_blank" hideExternalIcon>
348+
Atlas’ Performance Advisor.
349+
</Link>
350+
</Banner>
351+
);
352+
};
353+
317354
const Schema: React.FunctionComponent<{
318355
actions: ReturnType<typeof configureActions>;
319356
analysisState: AnalysisState;
@@ -351,6 +388,11 @@ const Schema: React.FunctionComponent<{
351388
actions.startAnalysis();
352389
}, [actions]);
353390

391+
const enableHackoladeBanner = usePreference('enableHackoladeBanner');
392+
const enablePerformanceAdvisorBanner = usePreference(
393+
'enablePerformanceAdvisorBanner'
394+
);
395+
354396
return (
355397
<div className={rootStyles}>
356398
<WorkspaceContainer
@@ -366,20 +408,23 @@ const Schema: React.FunctionComponent<{
366408
/>
367409
}
368410
>
369-
<HackoladePromoBanner></HackoladePromoBanner>
370-
{analysisState === ANALYSIS_STATE_INITIAL && (
371-
<InitialScreen onApplyClicked={onApplyClicked} />
372-
)}
373-
{analysisState === ANALYSIS_STATE_ANALYZING && (
374-
<AnalyzingScreen onCancelClicked={onCancelClicked} />
375-
)}
376-
{analysisState === ANALYSIS_STATE_COMPLETE && (
377-
<FieldList
378-
schema={schema}
379-
analysisState={analysisState}
380-
actions={actions}
381-
/>
382-
)}
411+
<div className={contentStyles}>
412+
{enablePerformanceAdvisorBanner && <PerformanceAdvisorBanner />}
413+
{enableHackoladeBanner && <HackoladePromoBanner />}
414+
{analysisState === ANALYSIS_STATE_INITIAL && (
415+
<InitialScreen onApplyClicked={onApplyClicked} />
416+
)}
417+
{analysisState === ANALYSIS_STATE_ANALYZING && (
418+
<AnalyzingScreen onCancelClicked={onCancelClicked} />
419+
)}
420+
{analysisState === ANALYSIS_STATE_COMPLETE && (
421+
<FieldList
422+
schema={schema}
423+
analysisState={analysisState}
424+
actions={actions}
425+
/>
426+
)}
427+
</div>
383428
</WorkspaceContainer>
384429
</div>
385430
);

packages/compass-schema/src/components/promo-banner.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ const bannerBodyStyles = css({
2121
paddingLeft: spacing[3],
2222
paddingRight: spacing[3],
2323
borderRadius: '12px',
24-
marginLeft: spacing[3],
25-
marginRight: spacing[3],
26-
'&:not(:last-child)': {
27-
marginBottom: spacing[4],
28-
},
2924
});
3025

3126
const bannerBodyLightModeStyles = css({

packages/compass-web/src/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ const CompassWeb = ({
220220
enableAtlasSearchIndexes: false,
221221
enableImportExport: false,
222222
enableGenAIFeatures: false,
223+
enableHackoladeBanner: false,
224+
enablePerformanceAdvisorBanner: true,
223225
cloudFeatureRolloutAccess: {
224226
GEN_AI_COMPASS: false,
225227
},

scripts/snyk-test.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@ const { glob } = require('glob');
66
const { promisify } = require('util');
77
const execFile = promisify(childProcess.execFile);
88

9+
async function fileExists(filePath) {
10+
try {
11+
await fs.access(filePath);
12+
return true;
13+
} catch {
14+
return false;
15+
}
16+
}
17+
918
async function snykTest(cwd) {
1019
const tmpPath = path.join(os.tmpdir(), 'tempfile-' + Date.now());
1120

1221
let execErr;
1322

1423
try {
24+
if (!(await fileExists(path.join(cwd, `package.json`)))) {
25+
return;
26+
}
27+
1528
console.info(`testing ${cwd} ...`);
1629
await fs.mkdir(path.join(cwd, `node_modules`), { recursive: true });
1730

@@ -26,7 +39,10 @@ async function snykTest(cwd) {
2639
'--dev',
2740
`--json-file-output=${tmpPath}`,
2841
],
29-
{ cwd }
42+
{
43+
cwd,
44+
maxBuffer: 50 /* MB */ * 1024 * 1024, // default is 1 MB
45+
}
3046
);
3147
} catch (err) {
3248
execErr = err;
@@ -36,9 +52,8 @@ async function snykTest(cwd) {
3652
console.info(`testing ${cwd} done.`);
3753
return res;
3854
} catch (err) {
39-
console.error(
40-
`testing ${cwd} failed. ${err.message}. Exec error: ${execErr}`
41-
);
55+
console.error(`Snyk failed to create a json report for ${cwd}:`, execErr);
56+
throw new Error(`Testing ${cwd} failed.`);
4257
} finally {
4358
try {
4459
await fs.rm(tmpPath);

0 commit comments

Comments
 (0)