-
Notifications
You must be signed in to change notification settings - Fork 238
feat(compass-web): add the AtlasUserData class to save user data COMPASS-9565 #7152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 32 commits
e04e887
6e7876b
b28596b
669f626
c00749f
c41114e
10b0bc1
d22cebc
eb9c0c2
b3612a7
0e9d6dc
6a3f59d
4c6bb7c
817d4c5
f0db6d0
d18cd15
6161d84
6bd8634
e397192
e9850ba
d678af0
dd868db
ed227d6
2c69698
2020afa
ae63fac
194430d
8c8519f
ad739f5
1986cca
663f992
7809ed8
d99d1b1
f1c3ac1
834454f
953fa73
0c38299
fc98fd8
18c3f4a
f57e87c
860bbae
110ee91
3176131
412c700
08c9f20
765c77e
6bc78e2
c406f40
7b79c0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -78,6 +78,16 @@ export class AtlasService { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// https://github.com/10gen/mms/blob/9f858bb987aac6aa80acfb86492dd74c89cbb862/client/packages/project/common/ajaxPrefilter.ts#L34-L49 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return this.cloudEndpoint(path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tempEndpoint(path?: string): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return `https://cluster-connection.cloud-dev.mongodb.com${normalizePath( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
userDataEndpoint(path?: string): string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return `https://cluster-connection.cloud-dev.mongodb.com/userData${normalizePath( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
return `https://cluster-connection.cloud-dev.mongodb.com${normalizePath( | |
path | |
)}`; | |
} | |
userDataEndpoint(path?: string): string { | |
return `https://cluster-connection.cloud-dev.mongodb.com/userData${normalizePath( | |
path | |
)}`; | |
if (!this.config.tempBaseUrl) { | |
throw new Error('tempBaseUrl is not configured'); | |
} | |
return `${this.config.tempBaseUrl}${normalizePath(path)}`; | |
} | |
userDataEndpoint(path?: string): string { | |
if (!this.config.tempBaseUrl) { | |
throw new Error('tempBaseUrl is not configured'); | |
} | |
return `${this.config.tempBaseUrl}/userData${normalizePath(path)}`; |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be fixed in follow up pr
Outdated
Copilot
AI
Sep 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded development endpoint URL in production code poses security risks. This should be configurable or removed from production builds.
return `https://cluster-connection.cloud-dev.mongodb.com${normalizePath( | |
path | |
)}`; | |
} | |
userDataEndpoint(path?: string): string { | |
return `https://cluster-connection.cloud-dev.mongodb.com/userData${normalizePath( | |
path | |
)}`; | |
if (!this.config.tempEndpointBaseUrl) { | |
throw new Error('tempEndpointBaseUrl is not configured'); | |
} | |
return `${this.config.tempEndpointBaseUrl}${normalizePath(path)}`; | |
} | |
userDataEndpoint(path?: string): string { | |
if (!this.config.userDataEndpointBaseUrl) { | |
throw new Error('userDataEndpointBaseUrl is not configured'); | |
} | |
return `${this.config.userDataEndpointBaseUrl}${normalizePath(path)}`; |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Hard to leave a comment about this in more relevant place) Because we now doing cross origin authenticated requests through AtlasService, we need to allow fetch to include cookies in the request when possible. This is how you do it:
headers, | |
headers, | |
credentials: 'include', |
But we should probably do this only for authenticatedFetch below
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,3 +126,17 @@ export function withPreferences< | |
return createElement(component, { ...prefs, ...props }); | ||
}; | ||
} | ||
|
||
/** | ||
* Hook to check if the My Queries Data Explorer feature is enabled. | ||
* This controls access to: | ||
* - Saved queries and aggregations | ||
* - Recent queries autocomplete | ||
* - Favorite queries/aggregations | ||
*/ | ||
export function useMyQueriesFeature(): boolean { | ||
|
||
const enableMyQueries = usePreference('enableMyQueries'); | ||
|
||
// Default to true to match the preference schema default | ||
return enableMyQueries ?? true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be coming from the config property
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I was going to do this in a followup PR for this ticket: https://jira.mongodb.org/browse/COMPASS-9663
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super small nit for the future, if you already have a TODO like that in mind, it's super helpful to add it in the code to clarify that something is out of scope for the particular change being up for review 🙂