-
Notifications
You must be signed in to change notification settings - Fork 229
feat: update atlas cluster states COMPASS-8228 #6884
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 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3b30da4
init
syn-zhu e12899d
refactor
syn-zhu 82b9518
Update base-navigation-item.tsx
syn-zhu 8f1a3f1
Update connections-store-redux.ts
syn-zhu b96fb95
Refactor
syn-zhu 6b232a9
Update connection-storage.tsx
syn-zhu 2860e70
refactor
syn-zhu 68b30a4
Update base-navigation-item.tsx
syn-zhu 2a14569
remove unused'
syn-zhu dd54676
Revert "remove unused'"
syn-zhu 01cf00a
comments
syn-zhu 2bce9f0
Update connections-store-redux.ts
syn-zhu 8a70b1c
Update connections-store-redux.ts
syn-zhu 291d6cf
fix tests
syn-zhu 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
refactor
- Loading branch information
commit 2860e70bbed9fe96db6aca0ce3a3797ba79f60fe
There are no files selected for viewing
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
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,34 @@ | ||
import { useSelector, useStore } from '../stores/store-context'; | ||
import { useRef, useState } from 'react'; | ||
import { connectable } from '../utils/connection-supports'; | ||
|
||
export function useConnectable(connectionId: string): boolean { | ||
return useSelector((state) => { | ||
const connection = state.connections.byId[connectionId]; | ||
|
||
if (!connection) { | ||
return false; | ||
} | ||
|
||
return connectable(connection.info); | ||
}); | ||
} | ||
|
||
export function useConnectableRef(): { | ||
getConnectable(this: void, connectionId: string): boolean; | ||
} { | ||
const storeRef = useRef(useStore()); | ||
const [ref] = useState(() => { | ||
return { | ||
getConnectable(connectionId: string) { | ||
const conn = storeRef.current.getState().connections.byId[connectionId]; | ||
if (!conn) { | ||
return false; | ||
} | ||
|
||
return connectable(conn.info); | ||
}, | ||
}; | ||
}); | ||
return ref; | ||
} |
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
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.
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.
Would this be a cleaner way to write this?
Fine as is too I think.
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.
Ah, would that have the same outcome?