mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
Fix repository overview check for changed links
This commit is contained in:
@@ -37,14 +37,14 @@ import {
|
|||||||
} from "@scm-manager/ui-components";
|
} from "@scm-manager/ui-components";
|
||||||
import { getNamespacesLink, getRepositoriesLink } from "../../modules/indexResource";
|
import { getNamespacesLink, getRepositoriesLink } from "../../modules/indexResource";
|
||||||
import {
|
import {
|
||||||
|
fetchNamespaces,
|
||||||
fetchReposByPage,
|
fetchReposByPage,
|
||||||
getFetchReposFailure,
|
getFetchReposFailure,
|
||||||
|
getNamespaceCollection,
|
||||||
getRepositoryCollection,
|
getRepositoryCollection,
|
||||||
isAbleToCreateRepos,
|
isAbleToCreateRepos,
|
||||||
isFetchReposPending,
|
|
||||||
isFetchNamespacesPending,
|
isFetchNamespacesPending,
|
||||||
getNamespaceCollection,
|
isFetchReposPending
|
||||||
fetchNamespaces
|
|
||||||
} from "../modules/repos";
|
} from "../modules/repos";
|
||||||
import RepositoryList from "../components/list";
|
import RepositoryList from "../components/list";
|
||||||
|
|
||||||
@@ -67,28 +67,29 @@ type Props = WithTranslation &
|
|||||||
|
|
||||||
class Overview extends React.Component<Props> {
|
class Overview extends React.Component<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { fetchReposByPage, fetchNamespaces, namespacesLink, namespace, page, location } = this.props;
|
const { fetchNamespaces, namespacesLink } = this.props;
|
||||||
fetchNamespaces(namespacesLink);
|
fetchNamespaces(namespacesLink);
|
||||||
const link = this.getReposLink();
|
this.fetchRepos();
|
||||||
if (link) {
|
|
||||||
fetchReposByPage(link, page, namespace, urls.getQueryStringFromLocation(location));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = (prevProps: Props) => {
|
componentDidUpdate = (prevProps: Props) => {
|
||||||
const { loading, collection, namespaces, namespace, page, location, fetchReposByPage } = this.props;
|
const { loading, collection, namespace, namespaces, page, location } = this.props;
|
||||||
if (!collection && namespace && prevProps.namespaces !== namespaces) {
|
if (namespaces !== prevProps.namespaces && namespace) {
|
||||||
const link = this.getReposLink();
|
this.fetchRepos();
|
||||||
fetchReposByPage(link, page, namespace, urls.getQueryStringFromLocation(location));
|
} else if (collection && (page || namespace) && !loading) {
|
||||||
} else if (collection && page && !loading) {
|
|
||||||
const statePage: number = collection.page + 1;
|
const statePage: number = collection.page + 1;
|
||||||
if (page !== statePage || prevProps.location.search !== location.search) {
|
if (page !== statePage || prevProps.location.search !== location.search || prevProps.namespace !== namespace) {
|
||||||
|
this.fetchRepos();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchRepos = () => {
|
||||||
|
const { namespace, page, location, fetchReposByPage } = this.props;
|
||||||
const link = this.getReposLink();
|
const link = this.getReposLink();
|
||||||
if (link) {
|
if (link) {
|
||||||
fetchReposByPage(link, page, namespace, urls.getQueryStringFromLocation(location));
|
fetchReposByPage(link, page, namespace, urls.getQueryStringFromLocation(location));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getReposLink = () => {
|
getReposLink = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user