-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(React): Ownership component of user profile (#2173)
Co-authored-by: Brendan Sun <[email protected]>
- Loading branch information
1 parent
7043138
commit e3ad0ed
Showing
3 changed files
with
79 additions
and
8 deletions.
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
46 changes: 46 additions & 0 deletions
46
datahub-web-react/src/utils/customGraphQL/useGetAllEntitySearchResults.ts
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,46 @@ | ||
import { EntityType, SearchInput } from '../../types.generated'; | ||
import { useGetSearchResultsQuery } from '../../graphql/search.generated'; | ||
|
||
type AllEntityInput<T, K> = Pick<T, Exclude<keyof T, keyof K>> & K; | ||
|
||
export function useGetAllEntitySearchResults(input: AllEntityInput<SearchInput, { type?: EntityType }>) { | ||
const result: any = {}; | ||
|
||
result[EntityType.Chart] = useGetSearchResultsQuery({ | ||
variables: { | ||
input: { | ||
type: EntityType.Chart, | ||
...input, | ||
}, | ||
}, | ||
}); | ||
|
||
result[EntityType.Dashboard] = useGetSearchResultsQuery({ | ||
variables: { | ||
input: { | ||
type: EntityType.Dashboard, | ||
...input, | ||
}, | ||
}, | ||
}); | ||
|
||
result[EntityType.DataPlatform] = useGetSearchResultsQuery({ | ||
variables: { | ||
input: { | ||
type: EntityType.DataPlatform, | ||
...input, | ||
}, | ||
}, | ||
}); | ||
|
||
result[EntityType.Dataset] = useGetSearchResultsQuery({ | ||
variables: { | ||
input: { | ||
type: EntityType.Dataset, | ||
...input, | ||
}, | ||
}, | ||
}); | ||
|
||
return result; | ||
} |