diff --git a/gradle/changelog/namespace_not_existing.yaml b/gradle/changelog/namespace_not_existing.yaml new file mode 100644 index 0000000000..fac7f3b410 --- /dev/null +++ b/gradle/changelog/namespace_not_existing.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Do not show repositories on overview for not existing namespace ([#1608](https://github.com/scm-manager/scm-manager/pull/1608)) diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 2a7c5f5d6c..091cfa1d14 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -56,6 +56,7 @@ "title": "Repositories", "subtitle": "Übersicht aller verfügbaren Repositories", "noRepositories": "Keine Repositories gefunden.", + "invalidNamespace": "Keine Repositories gefunden. Möglicherweise existiert der ausgewählte Namespace nicht.", "createButton": "Repository hinzufügen", "searchRepository": "Repository suchen", "allNamespaces": "Alle Namespaces" diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index b8635d9385..9a46680807 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -56,6 +56,7 @@ "title": "Repositories", "subtitle": "Overview of available repositories", "noRepositories": "No repositories found.", + "invalidNamespace": "No repositories found. It's likely that the selected namespace does not exist.", "createButton": "Add Repository", "searchRepository": "Search repository", "allNamespaces": "All namespaces" diff --git a/scm-ui/ui-webapp/src/repos/containers/Overview.tsx b/scm-ui/ui-webapp/src/repos/containers/Overview.tsx index ba374fbae5..66d8275dd1 100644 --- a/scm-ui/ui-webapp/src/repos/containers/Overview.tsx +++ b/scm-ui/ui-webapp/src/repos/containers/Overview.tsx @@ -56,7 +56,10 @@ const useOverviewData = () => { search, // if a namespaces is selected we have to wait // until the list of namespaces are loaded from the server - disabled: !!namespace && !namespaces + // also do not fetch repositories if an invalid namespace is selected + disabled: + (!!namespace && !namespaces) || + (!!namespace && !namespaces?._embedded.namespaces.some(n => n.namespace === namespace)) }; const { isLoading: isLoadingRepositories, error: errorRepositories, data: repositories } = useRepositories(request); @@ -92,7 +95,7 @@ const Repositories: FC = ({ namespaces, repositories, search, return {t("overview.noRepositories")}; } } else { - return null; + return {t("overview.invalidNamespace")}; } }; @@ -141,7 +144,9 @@ const Overview: FC = () => { {showActions ? ( n.namespace === namespace) ? namespace : "" + } groups={namespacesToRender} groupSelected={namespaceSelected} link={namespace ? `repos/${namespace}` : "repos"}