mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-26 08:06:09 +01:00
Namespace filter leads to empty page (#1476)
* Namespace filter leads to empty page Fix bug where an empty page was shown if the repository namespace filtered overview page was called directly. Also now the namespace filter and the search action can be used together. Co-authored-by: Florian Scholdei <florian.scholdei@cloudogu.com>
This commit is contained in:
@@ -6,13 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
- Add repository import via dump file for Subversion ([#1471](https://github.com/scm-manager/scm-manager/pull/1471))
|
||||
- Add support for permalinks to lines in source code view ([#1472](https://github.com/scm-manager/scm-manager/pull/1472))
|
||||
|
||||
### Fixed
|
||||
- Add "Api Key" page link to sub-navigation of "User" and "Me" sections ([#1464](https://github.com/scm-manager/scm-manager/pull/1464))
|
||||
- Empty page on repository namespace filter ([#1476](https://github.com/scm-manager/scm-manager/pull/1476))
|
||||
- Usage of namespace filter and search action together on repository overview ([#1476](https://github.com/scm-manager/scm-manager/pull/1476))
|
||||
|
||||
## [2.11.1] - 2020-12-07
|
||||
### Fixed
|
||||
|
||||
@@ -25,7 +25,7 @@ import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { RouteComponentProps, withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { NamespaceCollection, RepositoryCollection, Link } from "@scm-manager/ui-types";
|
||||
import { Link, NamespaceCollection, RepositoryCollection } from "@scm-manager/ui-types";
|
||||
import {
|
||||
CreateButton,
|
||||
LinkPaginator,
|
||||
@@ -61,15 +61,14 @@ type Props = WithTranslation &
|
||||
namespacesLink: string;
|
||||
|
||||
// dispatched functions
|
||||
fetchReposByPage: (link: string, page: number, namespace?: string, filter?: string) => void;
|
||||
fetchNamespaces: (link: string) => void;
|
||||
fetchReposByPage: (link: string, page: number, filter?: string) => void;
|
||||
fetchNamespaces: (link: string, callback?: () => void) => void;
|
||||
};
|
||||
|
||||
class Overview extends React.Component<Props> {
|
||||
componentDidMount() {
|
||||
const { fetchNamespaces, namespacesLink } = this.props;
|
||||
fetchNamespaces(namespacesLink);
|
||||
this.fetchRepos();
|
||||
fetchNamespaces(namespacesLink, () => this.fetchRepos());
|
||||
}
|
||||
|
||||
componentDidUpdate = (prevProps: Props) => {
|
||||
@@ -130,7 +129,7 @@ class Overview extends React.Component<Props> {
|
||||
currentGroup={namespace}
|
||||
groups={namespacesToRender}
|
||||
groupSelected={this.namespaceSelected}
|
||||
link="repos"
|
||||
link={namespace ? `repos/${namespace}` : "repos"}
|
||||
label={t("overview.createButton")}
|
||||
testId="repository-overview"
|
||||
searchPlaceholder={t("overview.searchRepository")}
|
||||
@@ -204,8 +203,8 @@ const mapDispatchToProps = (dispatch: any) => {
|
||||
fetchReposByPage: (link: string, page: number, filter?: string) => {
|
||||
dispatch(fetchReposByPage(link, page, filter));
|
||||
},
|
||||
fetchNamespaces: (link: string) => {
|
||||
dispatch(fetchNamespaces(link));
|
||||
fetchNamespaces: (link: string, callback?: () => void) => {
|
||||
dispatch(fetchNamespaces(link, callback));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ export function fetchReposFailure(err: Error): Action {
|
||||
}
|
||||
|
||||
// fetch namespaces
|
||||
export function fetchNamespaces(link: string) {
|
||||
export function fetchNamespaces(link: string, callback?: () => void) {
|
||||
return function(dispatch: any) {
|
||||
dispatch(fetchNamespacesPending());
|
||||
return apiClient
|
||||
@@ -152,6 +152,7 @@ export function fetchNamespaces(link: string) {
|
||||
.then(namespaces => {
|
||||
dispatch(fetchNamespacesSuccess(namespaces));
|
||||
})
|
||||
.then(callback)
|
||||
.catch(err => {
|
||||
dispatch(fetchNamespacesFailure(err));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user