diff options
Diffstat (limited to 'webui/src/components/Identity/CurrentRepository.tsx')
-rw-r--r-- | webui/src/components/Identity/CurrentRepository.tsx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/webui/src/components/Identity/CurrentRepository.tsx b/webui/src/components/Identity/CurrentRepository.tsx new file mode 100644 index 000000000..77aa6839b --- /dev/null +++ b/webui/src/components/Identity/CurrentRepository.tsx @@ -0,0 +1,19 @@ +import { useCurrentIdentityQuery } from './CurrentIdentity.generated'; + +// same as in multi_repo_cache.go +const defaultRepoName = '__default'; + +const CurrentRepository = (props: { default: string }) => { + const { loading, error, data } = useCurrentIdentityQuery(); + + if (error || loading || !data?.repository?.name) return null; + + let name = data.repository.name; + if (name === defaultRepoName) { + name = props.default; + } + + return <>{name}</>; +}; + +export default CurrentRepository; |