summaryrefslogtreecommitdiffstatshomepage
path: root/webui/src/components/Identity/CurrentRepository.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'webui/src/components/Identity/CurrentRepository.tsx')
-rw-r--r--webui/src/components/Identity/CurrentRepository.tsx19
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;