mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
rollback changes on branches overview
This commit is contained in:
@@ -25,23 +25,13 @@ import React, { FC } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Branch } from "@scm-manager/ui-types";
|
||||
import DefaultBranchTag from "./DefaultBranchTag";
|
||||
import { DateFromNow } from "@scm-manager/ui-components";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import styled from "styled-components";
|
||||
|
||||
type Props = {
|
||||
baseUrl: string;
|
||||
branch: Branch;
|
||||
};
|
||||
|
||||
const Modified = styled.span`
|
||||
margin-left: 1rem;
|
||||
font-size: 0.8rem;
|
||||
`;
|
||||
|
||||
const BranchRow: FC<Props> = ({ baseUrl, branch }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
|
||||
const to = `${baseUrl}/${encodeURIComponent(branch.name)}/info`;
|
||||
return (
|
||||
<tr>
|
||||
@@ -49,12 +39,6 @@ const BranchRow: FC<Props> = ({ baseUrl, branch }) => {
|
||||
<Link to={to} title={branch.name}>
|
||||
{branch.name}
|
||||
<DefaultBranchTag defaultBranch={branch.defaultBranch} />
|
||||
{branch?.lastModified && branch.lastModifier && (
|
||||
<Modified className="has-text-grey is-ellipsis-overflow">
|
||||
{t("branches.overview.lastModified")} <DateFromNow date={branch.lastModified} />{" "}
|
||||
{t("branches.overview.lastModifier")} {branch.lastModifier?.name}
|
||||
</Modified>
|
||||
)}
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -117,7 +117,7 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchBranches: (repository: Repository) => {
|
||||
dispatch(fetchBranches(repository, true));
|
||||
dispatch(fetchBranches(repository));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ class CreateBranch extends React.Component<Props> {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchBranches: (repository: Repository) => {
|
||||
dispatch(fetchBranches(repository, false));
|
||||
dispatch(fetchBranches(repository));
|
||||
},
|
||||
createBranch: (
|
||||
createLink: string,
|
||||
|
||||
@@ -50,7 +50,7 @@ const CONTENT_TYPE_BRANCH_REQUEST = "application/vnd.scmm-branchRequest+json;v=2
|
||||
|
||||
// Fetching branches
|
||||
|
||||
export function fetchBranches(repository: Repository, fullInformation: boolean) {
|
||||
export function fetchBranches(repository: Repository) {
|
||||
if (!repository._links.branches) {
|
||||
return {
|
||||
type: FETCH_BRANCHES_SUCCESS,
|
||||
@@ -64,12 +64,8 @@ export function fetchBranches(repository: Repository, fullInformation: boolean)
|
||||
|
||||
return function(dispatch: any) {
|
||||
dispatch(fetchBranchesPending(repository));
|
||||
let link = (repository._links.branches as Link).href;
|
||||
if (fullInformation) {
|
||||
link += "?fullInformation=true";
|
||||
}
|
||||
return apiClient
|
||||
.get(link)
|
||||
.get((repository._links.branches as Link).href)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
dispatch(fetchBranchesSuccess(data, repository));
|
||||
|
||||
@@ -108,7 +108,7 @@ class CodeOverview extends React.Component<Props> {
|
||||
const mapDispatchToProps = (dispatch: any) => {
|
||||
return {
|
||||
fetchBranches: (repo: Repository) => {
|
||||
dispatch(fetchBranches(repo, false));
|
||||
dispatch(fetchBranches(repo));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user