-
Notifications
You must be signed in to change notification settings - Fork 245
feat(databases-collections): handle non-existent namespaces COMPASS-5750 #6664
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
Merged
Merged
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
95e2ed1
setup data for the feature
mabaasit 4678b4d
update sidebar
mabaasit 8c3489b
update database-collection
mabaasit ad89873
correct icon
mabaasit a387b72
update workspace tabs
mabaasit 32f9ae5
rename property
mabaasit 52bfd4f
fetch collstats only if db exists
mabaasit f421be4
clean up
mabaasit f7c760f
checks and lint
mabaasit 1d245e5
Merge branch 'main' into COMPASS-5750-non-existent-ns
mabaasit 8e3506e
fix log id and message
mabaasit 1d119f7
tests
mabaasit 6d132b2
correcct comment
mabaasit 9e31ef5
correct color on grid
mabaasit 4cf633a
rename prop
mabaasit 79e2ca7
also handle non-existent collections
mabaasit 5a0ec67
fix check
mabaasit 731ac2d
react to changes
mabaasit fdcfb42
do mix with adapt ns info
mabaasit bd05401
border on hover
mabaasit 3740848
Merge branch 'main' into COMPASS-5750-non-existent-ns
mabaasit 6b44ac1
use spacing nums
mabaasit c671c7c
Merge branch 'COMPASS-5750-non-existent-ns' of https://github.com/mon…
mabaasit 523154c
text change
mabaasit fab0289
Merge branch 'main' into COMPASS-5750-non-existent-ns
mabaasit df696e1
Merge remote-tracking branch 'origin' into COMPASS-5750-non-existent-ns
mabaasit dc52d8e
install
mabaasit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
packages/compass-connections-navigation/src/navigation-item-icon.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import React from 'react'; | ||
| import type { SidebarTreeItem } from './tree-data'; | ||
| import { css, Icon, ServerIcon, Tooltip } from '@mongodb-js/compass-components'; | ||
| 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 = | ||
| 'You have privileges to this namespace, but it is not in your list of current namespaces'; | ||
|
|
||
| const tooltipTriggerStyles = css({ | ||
| display: 'flex', | ||
| }); | ||
| const IconWithTooltip = ({ | ||
| text, | ||
| glyph, | ||
| }: { | ||
| text: string; | ||
| glyph: GlyphName; | ||
| }) => { | ||
| return ( | ||
| <Tooltip | ||
| align="bottom" | ||
| justify="start" | ||
| trigger={ | ||
| <div className={tooltipTriggerStyles}> | ||
| <Icon glyph={glyph} /> | ||
| </div> | ||
| } | ||
| > | ||
| {text} | ||
| </Tooltip> | ||
| ); | ||
| }; | ||
|
|
||
| export const NavigationItemIcon = ({ item }: { item: SidebarTreeItem }) => { | ||
| if (item.type === 'database') { | ||
| if (item.isNonExistent) { | ||
| return ( | ||
| <IconWithTooltip | ||
| text={NON_EXISTANT_NAMESPACE_TEXT} | ||
| glyph="EmptyDatabase" | ||
| /> | ||
| ); | ||
| } | ||
| return <Icon glyph="Database" />; | ||
| } | ||
| if (item.type === 'collection') { | ||
| if (item.isNonExistent) { | ||
| return ( | ||
| <IconWithTooltip | ||
| text={NON_EXISTANT_NAMESPACE_TEXT} | ||
| glyph="EmptyFolder" | ||
| /> | ||
| ); | ||
| } | ||
| return <Icon glyph="Folder" />; | ||
| } | ||
| if (item.type === 'view') { | ||
| return <Icon glyph="Visibility" />; | ||
| } | ||
| if (item.type === 'timeseries') { | ||
| return <Icon glyph="TimeSeries" />; | ||
| } | ||
| if (item.type === 'connection') { | ||
| const isFavorite = item.connectionInfo.savedConnectionType === 'favorite'; | ||
| if (isFavorite) { | ||
| return ( | ||
| <WithStatusMarker status={item.connectionStatus}> | ||
| <Icon glyph="Favorite" /> | ||
| </WithStatusMarker> | ||
| ); | ||
| } | ||
| if (isLocalhost(item.connectionInfo.connectionOptions.connectionString)) { | ||
| return ( | ||
| <WithStatusMarker status={item.connectionStatus}> | ||
| <Icon glyph="Laptop" /> | ||
| </WithStatusMarker> | ||
| ); | ||
| } | ||
| return ( | ||
| <WithStatusMarker status={item.connectionStatus}> | ||
| <ServerIcon /> | ||
| </WithStatusMarker> | ||
| ); | ||
| } | ||
| return null; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if this is the right place for this, but if you feel it does not belong here, let me know