File tree Expand file tree Collapse file tree 7 files changed +29
-10
lines changed
compass-generative-ai/src Expand file tree Collapse file tree 7 files changed +29
-10
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import { EJSON } from 'bson';
1212import { signIntoAtlasWithModalPrompt } from './store/atlas-signin-reducer' ;
1313import { getStore } from './store/atlas-ai-store' ;
1414import { optIntoGenAIWithModalPrompt } from './store/atlas-optin-reducer' ;
15- import { throwIfNotOk } from '../../atlas-service/src/util' ;
1615
1716type GenerativeAiInput = {
1817 userInput : string ;
@@ -452,15 +451,14 @@ export class AtlasAiService {
452451 {
453452 method : 'POST' ,
454453 body : JSON . stringify ( {
455- isEnabled : true ,
454+ value : true ,
456455 } ) ,
457456 headers : {
458457 'Content-Type' : 'application/json' ,
459458 Accept : 'application/json' ,
460459 } ,
461460 }
462461 ) ;
463- await throwIfNotOk ( res ) ;
464462 await this . preferences . savePreferences ( {
465463 optInDataExplorerGenAIFeatures : true ,
466464 } ) ;
Original file line number Diff line number Diff line change 44 Body ,
55 Link ,
66 MarketingModal ,
7+ SpinLoader ,
78 css ,
89 spacing ,
910 useDarkMode ,
@@ -64,7 +65,22 @@ const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
6465 }
6566 open = { isOptInModalVisible }
6667 onClose = { onOptInModalClose }
67- buttonText = "Opt In to Generative AI Features"
68+ // @ts -expect-error leafygreen only allows strings, but we need to pass
69+ // icons
70+ buttonText = {
71+ < >
72+ Opt in to Atlas to enable
73+ { isOptInInProgress && (
74+ < >
75+
76+ < SpinLoader
77+ // Marketing modal button is always bright, spin loader in dark mode gets lost
78+ darkMode = { false }
79+ > </ SpinLoader >
80+ </ >
81+ ) }
82+ </ >
83+ }
6884 onButtonClick = { ( ) => {
6985 // We can't control buttons in marketing modal, so instead we just do
7086 // nothing when button is clicked and sign in is in progress
@@ -88,7 +104,7 @@ export default connect(
88104 ( state : AtlasOptInState ) => {
89105 return {
90106 isOptInModalVisible : state . optInReducer . isModalOpen ,
91- isOptInInProgress : state . state === 'in-progress' ,
107+ isOptInInProgress : state . optInReducer . state === 'in-progress' ,
92108 } ;
93109 } ,
94110 { onOptInModalClose : closeOptInModal , onOptInClick : optIn }
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export default connect(
103103 ( state : AtlasSignInState ) => {
104104 return {
105105 isSignInModalVisible : state . signInReducer . isModalOpen ,
106- isSignInInProgress : state . state === 'in-progress' ,
106+ isSignInInProgress : state . signInReducer . state === 'in-progress' ,
107107 } ;
108108 } ,
109109 { onSignInModalClose : closeSignInModal , onSignInClick : signIn }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { atlasAuthServiceLocator } from '@mongodb-js/atlas-service/provider';
44import { activatePlugin } from './store/atlas-ai-store' ;
55import { AtlasAiPlugin } from './components' ;
66import { atlasAiServiceLocator } from './provider' ;
7+ import { preferencesLocator } from 'compass-preferences-model/provider' ;
78
89export const CompassGenerativeAIPlugin = registerHadronPlugin (
910 {
@@ -14,6 +15,7 @@ export const CompassGenerativeAIPlugin = registerHadronPlugin(
1415 {
1516 atlasAuthService : atlasAuthServiceLocator ,
1617 atlasAiService : atlasAiServiceLocator ,
18+ preferences : preferencesLocator ,
1719 }
1820) ;
1921
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export function getStore() {
1919 return store ;
2020}
2121const reducer = combineReducers ( {
22- signInReducer,
23- optInReducer,
22+ signIn : signInReducer ,
23+ optIn : optInReducer ,
2424} ) ;
2525
2626export type CompassGenerativeAIExtraArgs = {
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export function getAttempt(id?: number | null): AttemptState {
115115 const attemptState = AttemptStateMap . get ( id ) ;
116116 if ( ! attemptState ) {
117117 throw new Error (
118- 'Trying to get the state for a non-existing sign in attempt'
118+ 'Trying to get the state for a non-existing opt in attempt'
119119 ) ;
120120 }
121121 return attemptState ;
@@ -297,7 +297,7 @@ export const closeOptInModal = (
297297
298298export const cancelOptIn = ( reason ?: any ) : GenAIAtlasOptInThunkAction < void > => {
299299 return ( dispatch , getState ) => {
300- // Can't cancel sign in after the flow was finished indicated by current
300+ // Can't cancel opt in after the flow was finished indicated by current
301301 // attempt id being set to null.
302302 if ( getState ( ) . attemptId === null ) {
303303 return ;
Original file line number Diff line number Diff line change @@ -270,6 +270,9 @@ const CompassWeb = ({
270270 enableAggregationBuilderExtraOptions : true ,
271271 enableImportExport : false ,
272272 enableGenAIFeatures : true ,
273+ enableGenAIFeaturesAtlasProject : false ,
274+ enableGenAISampleDocumentPassingOnAtlasProject : false ,
275+ enableGenAIFeaturesAtlasOrg : false ,
273276 enableMultipleConnectionSystem : true ,
274277 enablePerformanceAdvisorBanner : true ,
275278 cloudFeatureRolloutAccess : {
You can’t perform that action at this time.
0 commit comments