mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
Moved getBranchFromMatch to ui-components
This commit is contained in:
@@ -19,6 +19,7 @@ export { default as LinkPaginator } from "./LinkPaginator.js";
|
||||
export { default as ProtectedRoute } from "./ProtectedRoute.js";
|
||||
export { default as Help } from "./Help.js";
|
||||
export { default as LabelWithHelpIcon } from "./LabelWithHelpIcon.js";
|
||||
export { getPageFromMatch } from "./urls";
|
||||
|
||||
export { apiClient, NOT_FOUND_ERROR, UNAUTHORIZED_ERROR } from "./apiclient.js";
|
||||
|
||||
|
||||
@@ -4,3 +4,11 @@ export const contextPath = window.ctxPath || "";
|
||||
export function withContextPath(path: string) {
|
||||
return contextPath + path;
|
||||
}
|
||||
|
||||
export function getPageFromMatch(match: any) {
|
||||
let page = parseInt(match.params.page, 10);
|
||||
if (isNaN(page) || !page) {
|
||||
page = 1;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { getPageFromMatch } from "./Changesets";
|
||||
import { getPageFromMatch } from "./urls";
|
||||
|
||||
describe("tests for getPageFromMatch", () => {
|
||||
function createMatch(page: string) {
|
||||
@@ -1,14 +1,14 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
|
||||
import {Redirect, Route, Switch, withRouter} from "react-router-dom";
|
||||
import { Redirect, Route, Switch, withRouter } from "react-router-dom";
|
||||
|
||||
import Overview from "../repos/containers/Overview";
|
||||
import Users from "../users/containers/Users";
|
||||
import Login from "../containers/Login";
|
||||
import Logout from "../containers/Logout";
|
||||
|
||||
import {ProtectedRoute} from "@scm-manager/ui-components";
|
||||
import { ProtectedRoute } from "@scm-manager/ui-components";
|
||||
import AddUser from "../users/containers/AddUser";
|
||||
import SingleUser from "../users/containers/SingleUser";
|
||||
import RepositoryRoot from "../repos/containers/RepositoryRoot";
|
||||
|
||||
@@ -21,7 +21,8 @@ import ChangesetList from "../components/changesets/ChangesetList";
|
||||
import {
|
||||
ErrorNotification,
|
||||
LinkPaginator,
|
||||
Loading
|
||||
Loading,
|
||||
getPageFromMatch
|
||||
} from "@scm-manager/ui-components";
|
||||
import { compose } from "redux";
|
||||
|
||||
@@ -94,14 +95,6 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export function getPageFromMatch(match: any) {
|
||||
let page = parseInt(match.params.page, 10);
|
||||
if (isNaN(page) || !page) {
|
||||
page = 1;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const { repository, branch, match } = ownProps;
|
||||
const changesets = getChangesets(state, repository, branch);
|
||||
|
||||
Reference in New Issue
Block a user