Skip to content

Commit 36a5c11

Browse files
authored
fix: global writes feature flag COMPAS-8524 (#6539)
fix: global writes feture flag COMPAS-8524
1 parent 77c23bf commit 36a5c11

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

packages/compass-collection/src/components/collection-tab.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
useConnectionInfoRef,
1919
useConnectionSupports,
2020
} from '@mongodb-js/compass-connections/provider';
21+
import { usePreference } from 'compass-preferences-model/provider';
2122

2223
type CollectionSubtabTrackingId = Lowercase<CollectionSubtab> extends infer U
2324
? U extends string
@@ -119,13 +120,17 @@ function WithErrorBoundary({
119120
function useCollectionTabs(props: CollectionMetadata) {
120121
const pluginTabs = useCollectionSubTabs();
121122
const connectionInfoRef = useConnectionInfoRef();
123+
const isGlobalWritesEnabled = usePreference('enableGlobalWrites');
122124
const isGlobalWritesSupported =
123125
useConnectionSupports(connectionInfoRef.current.id, 'globalWrites') &&
124126
!props.isReadonly &&
125127
!toNS(props.namespace).specialish;
126128
return pluginTabs
127129
.filter((x) => {
128-
if (x.name === 'GlobalWrites' && !isGlobalWritesSupported) {
130+
if (
131+
x.name === 'GlobalWrites' &&
132+
(!isGlobalWritesEnabled || !isGlobalWritesSupported)
133+
) {
129134
return false;
130135
}
131136
return true;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type FeatureFlags = {
2121
enableQueryHistoryAutocomplete: boolean;
2222
enableProxySupport: boolean;
2323
enableRollingIndexes: boolean;
24+
enableGlobalWrites: boolean;
2425
};
2526

2627
export const featureFlags: Required<{
@@ -92,4 +93,11 @@ export const featureFlags: Required<{
9293
short: 'Enable creating indexes with the rolling build in Atlas Cloud',
9394
},
9495
},
96+
97+
enableGlobalWrites: {
98+
stage: 'development',
99+
description: {
100+
short: 'Enable Global Writes tab in Atlas Cloud',
101+
},
102+
},
95103
};

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export type InternalUserPreferences = {
8888
telemetryAnonymousId?: string;
8989
telemetryAtlasUserId?: string;
9090
userCreatedAt: number;
91-
enableGlobalWrites: boolean;
9291
};
9392

9493
// UserPreferences contains all preferences stored to disk.
@@ -877,15 +876,6 @@ export const storedUserPreferencesProps: Required<{
877876
validator: z.boolean().default(true),
878877
type: 'boolean',
879878
},
880-
881-
enableGlobalWrites: {
882-
ui: false,
883-
cli: false,
884-
global: false,
885-
description: null,
886-
validator: z.boolean().default(false),
887-
type: 'boolean',
888-
},
889879
enableGenAIFeaturesAtlasProject: {
890880
ui: false,
891881
cli: true,

0 commit comments

Comments
 (0)