Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
211 changes: 205 additions & 6 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,6 +8,7 @@ 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';
Expand Down Expand Up @@ -112,7 +113,10 @@ export const PipelineHeader: React.FunctionComponent<PipelineHeaderProps> = ({
}) => {
// 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 pipelineStorageAvailable = !!usePipelineStorage();
Copy link
Collaborator

Choose a reason for hiding this comment

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

if I'm not mistaken we can now replace this check with the new flag. tagging @gribnoysup to confirm that the check was for compass-web and not some other case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yep, should replace this with a preference if we have one now

const isMyQueriesEnabled = usePreference('enableMyQueries');
const isSavingAggregationsEnabled =
pipelineStorageAvailable && isMyQueriesEnabled;
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 @@ -11,6 +11,7 @@ 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 @@ -49,7 +50,10 @@ export const PipelineSettings: React.FunctionComponent<
}) => {
// 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 pipelineStorageAvailable = !!usePipelineStorage();
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

const isMyQueriesEnabled = usePreference('enableMyQueries');
const enableSavedAggregationsQueries =
pipelineStorageAvailable && isMyQueriesEnabled;
const isPipelineNameDisplayed =
!editViewName && !!enableSavedAggregationsQueries;

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
Loading
Loading