-
Notifications
You must be signed in to change notification settings - Fork 245
feat: add inferNamespacesFromPrivileges, default to true COMPASS-9572 #7153
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 6 commits
cbddf11
dcbbf1f
0e57da6
ac16b4d
3038293
6a86eb2
8ad6dd0
c480905
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
|---|---|---|
|
|
@@ -5,8 +5,8 @@ import type { GlyphName } from '@mongodb-js/compass-components'; | |
| import { WithStatusMarker } from './with-status-marker'; | ||
| import { isLocalhost } from 'mongodb-build-info'; | ||
|
|
||
| const NON_EXISTANT_NAMESPACE_TEXT = | ||
| 'Your privileges grant you access to this namespace, but it does not currently exist'; | ||
| const INFERRED_FROM_PRIVILEGES_TEXT = | ||
| 'Your privileges grant you access to this namespace, but it might not currently exist'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't know if these collections exist if the user didn't have access to listDatabases or listCollections. We don't record whether they had access or not and therefore we can't know at this point. (If they DID have access to those commands then we can probably safely say that these don't exist. But right now we don't know that.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Arguably we could also change the code in dataService to only infer namespaces from privileges if the corresponding listDatabases() or listCollections() call failed due to not having access. That would simplify matters a bit.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess inside dataService's listCollections() or listDatabases() calls we can immediately tell if the corresponding call worked or not and then have different booleans for dbs that definitely don't exist and that may or may not exist 🤔
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a follow-up ticket COMPASS-9641.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also need to update this bit in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! Updated. |
||
|
|
||
| const tooltipTriggerStyles = css({ | ||
| display: 'flex', | ||
|
|
@@ -35,21 +35,21 @@ const IconWithTooltip = ({ | |
|
|
||
| export const NavigationItemIcon = ({ item }: { item: SidebarTreeItem }) => { | ||
| if (item.type === 'database') { | ||
| if (item.isNonExistent) { | ||
| if (item.inferredFromPrivileges) { | ||
| return ( | ||
| <IconWithTooltip | ||
| text={NON_EXISTANT_NAMESPACE_TEXT} | ||
| text={INFERRED_FROM_PRIVILEGES_TEXT} | ||
| glyph="EmptyDatabase" | ||
| /> | ||
| ); | ||
| } | ||
| return <Icon glyph="Database" />; | ||
| } | ||
| if (item.type === 'collection') { | ||
| if (item.isNonExistent) { | ||
| if (item.inferredFromPrivileges) { | ||
| return ( | ||
| <IconWithTooltip | ||
| text={NON_EXISTANT_NAMESPACE_TEXT} | ||
| text={INFERRED_FROM_PRIVILEGES_TEXT} | ||
| glyph="EmptyFolder" | ||
| /> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.