mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-19 14:02:13 +01:00
Do not show repositories on the overview if a not existing namespace is selected (#1608)
This commit is contained in:
2
gradle/changelog/namespace_not_existing.yaml
Normal file
2
gradle/changelog/namespace_not_existing.yaml
Normal file
@@ -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))
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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<RepositoriesProps> = ({ namespaces, repositories, search,
|
||||
return <Notification type="info">{t("overview.noRepositories")}</Notification>;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
return <Notification type="info">{t("overview.invalidNamespace")}</Notification>;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -141,7 +144,9 @@ const Overview: FC = () => {
|
||||
{showActions ? (
|
||||
<OverviewPageActions
|
||||
showCreateButton={showCreateButton}
|
||||
currentGroup={namespace || ""}
|
||||
currentGroup={
|
||||
namespace && namespaces?._embedded.namespaces.some(n => n.namespace === namespace) ? namespace : ""
|
||||
}
|
||||
groups={namespacesToRender}
|
||||
groupSelected={namespaceSelected}
|
||||
link={namespace ? `repos/${namespace}` : "repos"}
|
||||
|
||||
Reference in New Issue
Block a user