-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(my-queries): support for multiple connections for my-queries CO…
- Loading branch information
1 parent
ce5a318
commit 69f7964
Showing
21 changed files
with
1,783 additions
and
620 deletions.
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 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 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
52 changes: 52 additions & 0 deletions
52
packages/compass-saved-aggregations-queries/src/components/no-active-connections-modal.tsx
This file contains 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,52 @@ | ||
import React from 'react'; | ||
import { | ||
type MapDispatchToProps, | ||
type MapStateToProps, | ||
connect, | ||
} from 'react-redux'; | ||
import { type RootState } from '../stores'; | ||
import { closeModal } from '../stores/open-item'; | ||
import { Banner, InfoModal } from '@mongodb-js/compass-components'; | ||
|
||
type NoActiveConnectionsModalProps = { | ||
isOpened: boolean; | ||
onClose(): void; | ||
}; | ||
|
||
const NoActiveConnectionsModal: React.FunctionComponent< | ||
NoActiveConnectionsModalProps | ||
> = ({ isOpened, onClose }) => { | ||
return ( | ||
<InfoModal | ||
title="Connect to a cluster" | ||
open={isOpened} | ||
onClose={onClose} | ||
showCloseButton={false} | ||
data-testid="no-active-connection-modal" | ||
> | ||
<Banner variant="warning"> | ||
It appears that you are not connected to a cluster. Establish a | ||
connection first. | ||
</Banner> | ||
</InfoModal> | ||
); | ||
}; | ||
|
||
const mapState: MapStateToProps< | ||
Pick<NoActiveConnectionsModalProps, 'isOpened'>, | ||
Record<string, never>, | ||
RootState | ||
> = ({ openItem: { openedModal } }) => { | ||
return { | ||
isOpened: openedModal === 'no-active-connections-modal', | ||
}; | ||
}; | ||
|
||
const mapDispatch: MapDispatchToProps< | ||
Pick<NoActiveConnectionsModalProps, 'onClose'>, | ||
Record<string, never> | ||
> = { | ||
onClose: closeModal, | ||
}; | ||
|
||
export default connect(mapState, mapDispatch)(NoActiveConnectionsModal); |
Oops, something went wrong.