-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Filter connections list on source or destination item pages #21027
Merged
krishnaglick
merged 13 commits into
master
from
kc/filter-connections-on-source-and-destination-list-item-pages
Jan 18, 2023
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e6f8433
Adds filtering to the source and destination item pages, as well as c…
krishnaglick 2c29234
Don't need the Partial<>
krishnaglick 12b77d3
console.log cleanup
krishnaglick af421b7
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick f894714
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick 2d19b36
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick ce03820
We need to load sources and destinations here so the add source/desti…
krishnaglick 9284969
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick 0b4654a
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick 8df0581
Merge branch 'master' of github.com:airbytehq/airbyte into kc/filter-…
krishnaglick 333861d
Fixing build w/ master merged in
krishnaglick 08aa990
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick 3f6dd74
Merge branch 'master' into kc/filter-connections-on-source-and-destin…
krishnaglick 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
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
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -12,35 +12,30 @@ import { useGetDestination } from "hooks/services/useDestinationHook"; | |||||
import { useSourceList } from "hooks/services/useSourceHook"; | ||||||
import { DestinationPaths } from "pages/routePaths"; | ||||||
import { useDestinationDefinition } from "services/connector/DestinationDefinitionService"; | ||||||
import { useSourceDefinitionList } from "services/connector/SourceDefinitionService"; | ||||||
import { getIcon } from "utils/imageUtils"; | ||||||
|
||||||
export const DestinationOverviewPage = () => { | ||||||
const params = useParams() as { "*": StepsTypes | ""; id: string }; | ||||||
const { sources } = useSourceList(); | ||||||
const navigate = useNavigate(); | ||||||
|
||||||
const destination = useGetDestination(params.id); | ||||||
const destinationDefinition = useDestinationDefinition(destination.destinationDefinitionId); | ||||||
const { connections } = useConnectionList(); | ||||||
const { sourceDefinitions } = useSourceDefinitionList(); | ||||||
// We load only connections attached to this destination to be shown in the connections grid | ||||||
const { connections } = useConnectionList({ destinationId: [destination.destinationId] }); | ||||||
|
||||||
const connectionsWithDestination = connections.filter( | ||||||
({ destination: { destinationId } }) => destinationId === destination.destinationId | ||||||
); | ||||||
|
||||||
const sourceDropdownOptions: DropdownMenuOptionType[] = useMemo( | ||||||
// We load all sources so the add source button has a pre-filled list of options. | ||||||
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.
Suggested change
|
||||||
const { sources } = useSourceList(); | ||||||
const sourceDropdownOptions = useMemo<DropdownMenuOptionType[]>( | ||||||
() => | ||||||
sources.map((item) => { | ||||||
const sourceDef = sourceDefinitions.find((sd) => sd.sourceDefinitionId === item.sourceDefinitionId); | ||||||
sources.map((source) => { | ||||||
return { | ||||||
as: "button", | ||||||
icon: <ConnectorIcon icon={sourceDef?.icon} />, | ||||||
icon: <ConnectorIcon icon={source.icon} />, | ||||||
iconPosition: "right", | ||||||
displayName: item.name, | ||||||
value: item.sourceId, | ||||||
displayName: source.name, | ||||||
value: source.sourceId, | ||||||
}; | ||||||
}), | ||||||
[sources, sourceDefinitions] | ||||||
[sources] | ||||||
); | ||||||
|
||||||
const onSelect = (data: DropdownMenuOptionType) => { | ||||||
|
@@ -64,11 +59,11 @@ export const DestinationOverviewPage = () => { | |||||
onSelect={onSelect} | ||||||
entityName={destination.name} | ||||||
entity={destination.destinationName} | ||||||
entityIcon={destinationDefinition.icon ? getIcon(destinationDefinition.icon) : null} | ||||||
entityIcon={destination.icon} | ||||||
releaseStage={destinationDefinition.releaseStage} | ||||||
/> | ||||||
{connectionsWithDestination.length ? ( | ||||||
<DestinationConnectionTable connections={connectionsWithDestination} /> | ||||||
{connections.length ? ( | ||||||
<DestinationConnectionTable connections={connections} /> | ||||||
) : ( | ||||||
<Placeholder resource={ResourceTypes.Sources} /> | ||||||
)} | ||||||
|
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.