Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
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
24 changes: 14 additions & 10 deletions package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
InteractivePopover,
} from '@mongodb-js/compass-components';
import { connect } from 'react-redux';
import { usePreference } from 'compass-preferences-model/provider';

import PipelineStages from './pipeline-stages';
import PipelineActions from './pipeline-actions';
import SavedPipelines from '../../saved-pipelines/saved-pipelines';
import type { RootState } from '../../../modules';
import { usePipelineStorage } from '@mongodb-js/my-queries-storage/provider';

const containerStyles = css({
display: 'flex',
Expand Down Expand Up @@ -110,9 +110,7 @@ export const PipelineHeader: React.FunctionComponent<PipelineHeaderProps> = ({
isOptionsVisible,
isOpenPipelineVisible,
}) => {
// TODO: remove direct check for storage existing, breaks single source of
// truth rule and exposes services to UI, this breaks the rules for locators
const isSavingAggregationsEnabled = !!usePipelineStorage();
const isSavingAggregationsEnabled = usePreference('enableMyQueries');
return (
<div className={containerStyles} data-testid="pipeline-header">
{isOpenPipelineVisible && isSavingAggregationsEnabled && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';
import { Button, Icon, css, spacing } from '@mongodb-js/compass-components';
import { Button, css, Icon, spacing } from '@mongodb-js/compass-components';
import { exportToLanguage } from '../../../modules/export-to-language';
import { SaveMenu } from './pipeline-menus';
import PipelineName from './pipeline-name';
Expand All @@ -10,7 +10,8 @@ import { getIsPipelineInvalidFromBuilderState } from '../../../modules/pipeline-
import { confirmNewPipeline } from '../../../modules/is-new-pipeline-confirm';
import { hiddenOnNarrowPipelineToolbarStyles } from '../pipeline-toolbar-container';
import ModifySourceBanner from '../../modify-source-banner';
import { usePipelineStorage } from '@mongodb-js/my-queries-storage/provider';

import { usePreference } from 'compass-preferences-model/provider';

const containerStyles = css({
display: 'flex',
Expand Down Expand Up @@ -47,9 +48,7 @@ export const PipelineSettings: React.FunctionComponent<
onExportToLanguage,
onCreateNewPipeline,
}) => {
// TODO: remove direct check for storage existing, breaks single source of
// truth rule and exposes services to UI, this breaks the rules for locators
const enableSavedAggregationsQueries = !!usePipelineStorage();
const enableSavedAggregationsQueries = usePreference('enableMyQueries');
const isPipelineNameDisplayed =
!editViewName && !!enableSavedAggregationsQueries;

Expand Down
2 changes: 1 addition & 1 deletion packages/compass-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@mongodb-js/compass-workspaces": "^0.53.1",
"@mongodb-js/connection-info": "^0.18.0",
"@mongodb-js/mongodb-constants": "^0.14.0",
"bson": "^6.10.1",
"bson": "^6.10.4",
Copy link
Member

Choose a reason for hiding this comment

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

Is this related?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops taken out now

"compass-preferences-model": "^2.52.1",
"hadron-document": "^8.10.0",
"mongodb": "^6.19.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const editablePreferences: (keyof UserPreferences)[] = [
'enableGenAIFeaturesAtlasOrg',
'enableGenAIFeaturesAtlasProject',
'enableDataModeling',
'enableMyQueries',
];

export class CompassWebPreferencesAccess implements PreferencesAccess {
Expand Down
13 changes: 13 additions & 0 deletions packages/compass-preferences-model/src/preferences-schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export type UserConfigurablePreferences = PermanentFeatureFlags &
enableExplainPlan: boolean;
enableAtlasSearchIndexes: boolean;
enableImportExport: boolean;
enableMyQueries: boolean;
enableAggregationBuilderRunPipeline: boolean;
enableAggregationBuilderExtraOptions: boolean;
enableGenAISampleDocumentPassing: boolean;
Expand Down Expand Up @@ -851,6 +852,18 @@ export const storedUserPreferencesProps: Required<{
type: 'boolean',
},

enableMyQueries: {
ui: true,
cli: true,
global: true,
description: {
short:
'Enable My Queries feature to save and manage favorite queries and aggregations',
},
validator: z.boolean().default(true),
type: 'boolean',
},

enableAggregationBuilderRunPipeline: {
ui: true,
cli: true,
Expand Down
10 changes: 8 additions & 2 deletions packages/compass-query-bar/src/components/query-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import {
createAIPlaceholderHTMLPlaceholder,
} from '@mongodb-js/compass-generative-ai';
import { connect } from '../stores/context';
import { useIsAIFeatureEnabled } from 'compass-preferences-model/provider';
import {
useIsAIFeatureEnabled,
usePreference,
} from 'compass-preferences-model/provider';
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';

import {
Expand Down Expand Up @@ -202,8 +205,11 @@ export const QueryBar: React.FunctionComponent<QueryBarProps> = ({

const favoriteQueryStorageAvailable = !!useFavoriteQueryStorageAccess();
const recentQueryStorageAvailable = !!useRecentQueryStorageAccess();
const isMyQueriesEnabled = usePreference('enableMyQueries');
const enableSavedAggregationsQueries =
favoriteQueryStorageAvailable && recentQueryStorageAvailable;
favoriteQueryStorageAvailable &&
recentQueryStorageAvailable &&
isMyQueriesEnabled;

return (
<form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ export function Navigation({
const { openMyQueriesWorkspace, openDataModelingWorkspace } =
useOpenWorkspace();
const isDataModelingEnabled = usePreference('enableDataModeling');
const isMyQueriesEnabled = usePreference('enableMyQueries');
return (
<div>
{hasWorkspacePlugin('My Queries') && (
{hasWorkspacePlugin('My Queries') && isMyQueriesEnabled && (
<NavigationItem
onClick={openMyQueriesWorkspace}
glyph="CurlyBraces"
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-user-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@mongodb-js/compass-logging": "^1.7.13",
"@mongodb-js/compass-utils": "^0.9.12",
"write-file-atomic": "^5.0.1",
"zod": "^3.25.17"
"zod": "^3.25.76"
Copy link
Member

Choose a reason for hiding this comment

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

Same q as the bson dep, totally for my own understanding, happy to have drive by updates in prs, although it can make it easier if we have them in a separate one to make things simple if we ever need to revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops taken out now

},
"devDependencies": {
"@mongodb-js/eslint-config-compass": "^1.4.8",
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"@mongodb-js/compass-indexes": "^5.71.1",
"@mongodb-js/compass-logging": "^1.7.13",
"@mongodb-js/compass-query-bar": "^8.73.1",
"@mongodb-js/compass-saved-aggregations-queries": "^1.72.1",
"@mongodb-js/compass-schema": "^6.73.1",
"@mongodb-js/compass-schema-validation": "^6.72.1",
"@mongodb-js/compass-sidebar": "^5.72.1",
Expand All @@ -100,6 +101,7 @@
"@mongodb-js/devtools-proxy-support": "^0.5.2",
"@mongodb-js/eslint-config-compass": "^1.4.8",
"@mongodb-js/mocha-config-compass": "^1.7.1",
"@mongodb-js/my-queries-storage": "^0.39.1",
"@mongodb-js/prettier-config-compass": "^1.2.8",
"@mongodb-js/testing-library-compass": "^1.3.11",
"@mongodb-js/tsconfig-compass": "^1.2.10",
Expand Down
5 changes: 3 additions & 2 deletions packages/compass-web/sandbox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useCallback, useLayoutEffect, useRef } from 'react';
import ReactDOM from 'react-dom';
import {
resetGlobalCSS,
css,
Body,
css,
openToast,
resetGlobalCSS,
Copy link
Member

Choose a reason for hiding this comment

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

Alphabetical 🙌 big fan.

} from '@mongodb-js/compass-components';
import type { AllPreferences } from 'compass-preferences-model';
import { CompassWeb } from '../src/index';
Expand Down Expand Up @@ -137,6 +137,7 @@ const App = () => {
isAtlas && !!enableGenAIFeaturesAtlasOrg,
optInGenAIFeatures: isAtlas && !!optInGenAIFeatures,
enableDataModeling: true,
enableMyQueries: true,
}}
onTrack={sandboxTelemetry.track}
onDebug={sandboxLogger.debug}
Expand Down
Loading
Loading