Skip to content

Commit f484042

Browse files
committed
fix
1 parent 208a602 commit f484042

File tree

5 files changed

+87
-55
lines changed

5 files changed

+87
-55
lines changed

packages/compass-preferences-model/src/compass-web-preferences-access.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const editablePreferences: (keyof UserPreferences)[] = [
1818
'enableGenAIFeaturesAtlasOrg',
1919
'enableGenAIFeaturesAtlasProject',
2020
'enableDataModeling',
21+
'enableMyQueries',
2122
];
2223

2324
export class CompassWebPreferencesAccess implements PreferencesAccess {

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export type FeatureFlags = {
2424
showDisabledConnections: boolean;
2525
enableGlobalWrites: boolean;
2626
enableDataModeling: boolean;
27+
enableMyQueries: boolean;
2728
enableIndexesGuidanceExp: boolean;
2829
showIndexesGuidanceVariant: boolean;
2930
enableContextMenus: boolean;
@@ -126,6 +127,16 @@ export const featureFlags: Required<{
126127
},
127128
},
128129

130+
/**
131+
* Enable My Queries feature in Data Explorer
132+
*/
133+
enableMyQueries: {
134+
stage: 'development',
135+
description: {
136+
short: 'Save and manage favorite queries and aggregations',
137+
},
138+
},
139+
129140
/**
130141
* Feature flags for Early Journey Indexes Guidance & Awareness | Jira Epic: CLOUDP-239367
131142
* These are passed from MMS and not editable by user

packages/compass-web/src/entrypoint.tsx

Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ import { WebWorkspaceTab as WelcomeWorkspaceTab } from '@mongodb-js/compass-welc
5656
import { useCompassWebPreferences } from './preferences';
5757
import { DataModelingWorkspaceTab as DataModelingWorkspace } from '@mongodb-js/compass-data-modeling';
5858
import { DataModelStorageServiceProviderInMemory } from '@mongodb-js/compass-data-modeling/web';
59+
import { WorkspaceTab as MyQueriesWorkspace } from '@mongodb-js/compass-saved-aggregations-queries';
60+
import {
61+
FavoriteQueryStorageProvider,
62+
RecentQueryStorageProvider,
63+
compassFavoriteQueryStorageAccess,
64+
compassRecentQueryStorageAccess,
65+
} from '@mongodb-js/my-queries-storage';
5966
import {
6067
CompassAssistantDrawer,
6168
CompassAssistantProvider,
@@ -173,61 +180,66 @@ function CompassWorkspace({
173180
onOpenConnectViaModal,
174181
}: CompassWorkspaceProps) {
175182
return (
176-
<WorkspacesProvider
177-
value={[
178-
WelcomeWorkspaceTab,
179-
DatabasesWorkspaceTab,
180-
CollectionsWorkspaceTab,
181-
CollectionWorkspace,
182-
DataModelingWorkspace,
183-
]}
184-
>
185-
<CollectionTabsProvider
186-
queryBar={CompassQueryBarPlugin}
187-
tabs={[
188-
CompassDocumentsPlugin,
189-
CompassAggregationsPlugin,
190-
CompassSchemaPlugin,
191-
CompassIndexesPlugin,
192-
CompassSchemaValidationPlugin,
193-
CompassGlobalWritesPlugin,
194-
]}
195-
modals={[
196-
ExplainPlanCollectionTabModal,
197-
ExportToLanguageCollectionTabModal,
198-
]}
199-
>
200-
<div
201-
data-testid="compass-web-connected"
202-
className={connectedContainerStyles}
183+
<FavoriteQueryStorageProvider value={compassFavoriteQueryStorageAccess}>
184+
<RecentQueryStorageProvider value={compassRecentQueryStorageAccess}>
185+
<WorkspacesProvider
186+
value={[
187+
WelcomeWorkspaceTab,
188+
DatabasesWorkspaceTab,
189+
CollectionsWorkspaceTab,
190+
CollectionWorkspace,
191+
DataModelingWorkspace,
192+
MyQueriesWorkspace,
193+
]}
203194
>
204-
<WorkspacesPlugin
205-
initialWorkspaceTabs={initialWorkspaceTabs}
206-
openOnEmptyWorkspace={{ type: 'Welcome' }}
207-
onActiveWorkspaceTabChange={onActiveWorkspaceTabChange}
208-
renderSidebar={() => {
209-
return (
210-
<CompassSidebarPlugin
211-
onOpenConnectViaModal={onOpenConnectViaModal}
212-
isCompassWeb={true}
213-
></CompassSidebarPlugin>
214-
);
215-
}}
216-
renderModals={() => {
217-
return (
218-
<>
219-
<CreateViewPlugin></CreateViewPlugin>
220-
<CreateNamespacePlugin></CreateNamespacePlugin>
221-
<DropNamespacePlugin></DropNamespacePlugin>
222-
<RenameCollectionPlugin></RenameCollectionPlugin>
223-
<CompassAssistantDrawer />
224-
</>
225-
);
226-
}}
227-
></WorkspacesPlugin>
228-
</div>
229-
</CollectionTabsProvider>
230-
</WorkspacesProvider>
195+
<CollectionTabsProvider
196+
queryBar={CompassQueryBarPlugin}
197+
tabs={[
198+
CompassDocumentsPlugin,
199+
CompassAggregationsPlugin,
200+
CompassSchemaPlugin,
201+
CompassIndexesPlugin,
202+
CompassSchemaValidationPlugin,
203+
CompassGlobalWritesPlugin,
204+
]}
205+
modals={[
206+
ExplainPlanCollectionTabModal,
207+
ExportToLanguageCollectionTabModal,
208+
]}
209+
>
210+
<div
211+
data-testid="compass-web-connected"
212+
className={connectedContainerStyles}
213+
>
214+
<WorkspacesPlugin
215+
initialWorkspaceTabs={initialWorkspaceTabs}
216+
openOnEmptyWorkspace={{ type: 'Welcome' }}
217+
onActiveWorkspaceTabChange={onActiveWorkspaceTabChange}
218+
renderSidebar={() => {
219+
return (
220+
<CompassSidebarPlugin
221+
onOpenConnectViaModal={onOpenConnectViaModal}
222+
isCompassWeb={true}
223+
></CompassSidebarPlugin>
224+
);
225+
}}
226+
renderModals={() => {
227+
return (
228+
<>
229+
<CreateViewPlugin></CreateViewPlugin>
230+
<CreateNamespacePlugin></CreateNamespacePlugin>
231+
<DropNamespacePlugin></DropNamespacePlugin>
232+
<RenameCollectionPlugin></RenameCollectionPlugin>
233+
<CompassAssistantDrawer />
234+
</>
235+
);
236+
}}
237+
></WorkspacesPlugin>
238+
</div>
239+
</CollectionTabsProvider>
240+
</WorkspacesProvider>
241+
</RecentQueryStorageProvider>
242+
</FavoriteQueryStorageProvider>
231243
);
232244
}
233245

packages/my-queries-storage/src/compass-query-storage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ export abstract class CompassQueryStorage<TSchema extends z.Schema> {
1515
protected readonly folder: string,
1616
protected readonly options: QueryStorageOptions
1717
) {
18-
// TODO: logic for whether we're in compass web or compass desktop
18+
// Simple implementation - use FileUserData for now
19+
// The use-atlas-user-data branch will add proper Atlas integration
1920
this.userData = new FileUserData(schemaValidator, folder, {
2021
basePath: options.basepath,
2122
serialize: (content) => EJSON.stringify(content, undefined, 2),

packages/my-queries-storage/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export {
1515
} from './compass-query-storage';
1616
export type { RecentQuery, FavoriteQuery } from './query-storage-schema';
1717

18+
// Export providers for use in applications
19+
export {
20+
FavoriteQueryStorageProvider,
21+
RecentQueryStorageProvider,
22+
PipelineStorageProvider,
23+
} from './provider';
24+
1825
// These are exported to aid in testing
1926
export const compassFavoriteQueryStorageAccess: FavoriteQueryStorageAccess = {
2027
getStorage() {

0 commit comments

Comments
 (0)