mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
added translation and used styled table instead of list
This commit is contained in:
@@ -43,6 +43,10 @@
|
|||||||
"title": "Repository erstellen",
|
"title": "Repository erstellen",
|
||||||
"subtitle": "Erstellen eines neuen Repository"
|
"subtitle": "Erstellen eines neuen Repository"
|
||||||
},
|
},
|
||||||
|
"branchesOverview": {
|
||||||
|
"title": "Übersicht aller verfügbaren Branches",
|
||||||
|
"branches": "Branches"
|
||||||
|
},
|
||||||
"changesets": {
|
"changesets": {
|
||||||
"errorTitle": "Fehler",
|
"errorTitle": "Fehler",
|
||||||
"errorSubtitle": "Changesets konnten nicht abgerufen werden",
|
"errorSubtitle": "Changesets konnten nicht abgerufen werden",
|
||||||
|
|||||||
@@ -43,6 +43,10 @@
|
|||||||
"title": "Create Repository",
|
"title": "Create Repository",
|
||||||
"subtitle": "Create a new repository"
|
"subtitle": "Create a new repository"
|
||||||
},
|
},
|
||||||
|
"branchesOverview": {
|
||||||
|
"title": "Overview of all branches",
|
||||||
|
"branches": "Branches"
|
||||||
|
},
|
||||||
"changesets": {
|
"changesets": {
|
||||||
"errorTitle": "Error",
|
"errorTitle": "Error",
|
||||||
"errorSubtitle": "Could not fetch changesets",
|
"errorSubtitle": "Could not fetch changesets",
|
||||||
|
|||||||
@@ -1,12 +1,21 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {fetchBranches, getBranches, getFetchBranchesFailure, isFetchBranchesPending} from "../modules/branches";
|
import {
|
||||||
|
fetchBranches,
|
||||||
|
getBranches,
|
||||||
|
getFetchBranchesFailure,
|
||||||
|
isFetchBranchesPending
|
||||||
|
} from "../modules/branches";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import type { Branch, Repository } from "@scm-manager/ui-types";
|
import type { Branch, Repository } from "@scm-manager/ui-types";
|
||||||
import { compose } from "redux";
|
import { compose } from "redux";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import {withRouter} from "react-router-dom";
|
import {Link, withRouter} from "react-router-dom";
|
||||||
import {ErrorNotification, Loading} from "@scm-manager/ui-components";
|
import {
|
||||||
|
ErrorNotification,
|
||||||
|
Loading,
|
||||||
|
Subtitle
|
||||||
|
} from "@scm-manager/ui-components";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
repository: Repository,
|
repository: Repository,
|
||||||
@@ -24,19 +33,13 @@ type Props = {
|
|||||||
};
|
};
|
||||||
class BranchesOverview extends React.Component<Props> {
|
class BranchesOverview extends React.Component<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const {
|
const { fetchBranches, repository } = this.props;
|
||||||
fetchBranches,
|
|
||||||
repository
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
fetchBranches(repository);
|
fetchBranches(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { loading, error, t } = this.props;
|
||||||
loading,
|
|
||||||
error,
|
|
||||||
} = this.props;
|
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <ErrorNotification error={error} />;
|
return <ErrorNotification error={error} />;
|
||||||
@@ -46,7 +49,19 @@ class BranchesOverview extends React.Component<Props> {
|
|||||||
return <Loading />;
|
return <Loading />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <>{this.renderBranches()}</>;
|
return (
|
||||||
|
<>
|
||||||
|
<Subtitle subtitle={t("branchesOverview.title")} />
|
||||||
|
<table className="card-table table is-hoverable is-fullwidth">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{t("branchesOverview.branches")}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{this.renderBranches()}</tbody>
|
||||||
|
</table>
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderBranches() {
|
renderBranches() {
|
||||||
@@ -55,11 +70,16 @@ class BranchesOverview extends React.Component<Props> {
|
|||||||
let branchesList = null;
|
let branchesList = null;
|
||||||
if (branches) {
|
if (branches) {
|
||||||
branchesList = (
|
branchesList = (
|
||||||
<ul>
|
<>
|
||||||
{branches.map((branch, index) => {
|
{branches.map((branch, index) => {
|
||||||
return <li key={index}>{branch.name}</li>;
|
const to = `../branch/${encodeURIComponent(branch.name)}/changesets/`;
|
||||||
|
return (
|
||||||
|
<tr>
|
||||||
|
<td key={index}><Link to={to}>{branch.name}</Link></td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
</ul>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return branchesList;
|
return branchesList;
|
||||||
@@ -84,7 +104,7 @@ const mapDispatchToProps = dispatch => {
|
|||||||
return {
|
return {
|
||||||
fetchBranches: (repository: Repository) => {
|
fetchBranches: (repository: Repository) => {
|
||||||
dispatch(fetchBranches(repository));
|
dispatch(fetchBranches(repository));
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user