2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
|
|
|
|
import { translate } from "react-i18next";
|
|
|
|
|
import BranchRow from "./BranchRow";
|
|
|
|
|
import { Branch } from "@scm-manager/ui-types";
|
2019-03-28 17:09:59 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
2019-10-19 16:38:07 +02:00
|
|
|
baseUrl: string;
|
|
|
|
|
t: (p: string) => string;
|
|
|
|
|
branches: Branch[];
|
2019-03-28 17:09:59 +01:00
|
|
|
};
|
|
|
|
|
|
2019-03-29 10:02:53 +01:00
|
|
|
class BranchTable extends React.Component<Props> {
|
2019-03-28 17:09:59 +01:00
|
|
|
render() {
|
2019-03-29 10:02:53 +01:00
|
|
|
const { t } = this.props;
|
2019-03-28 17:09:59 +01:00
|
|
|
return (
|
|
|
|
|
<table className="card-table table is-hoverable is-fullwidth">
|
|
|
|
|
<thead>
|
2019-03-29 10:02:53 +01:00
|
|
|
<tr>
|
2019-10-20 18:02:52 +02:00
|
|
|
<th>{t("branches.table.branches")}</th>
|
2019-03-29 10:02:53 +01:00
|
|
|
</tr>
|
2019-03-28 17:09:59 +01:00
|
|
|
</thead>
|
2019-03-29 10:02:53 +01:00
|
|
|
<tbody>{this.renderRow()}</tbody>
|
2019-03-28 17:09:59 +01:00
|
|
|
</table>
|
|
|
|
|
);
|
|
|
|
|
}
|
2019-03-29 10:02:53 +01:00
|
|
|
|
|
|
|
|
renderRow() {
|
|
|
|
|
const { baseUrl, branches } = this.props;
|
|
|
|
|
let rowContent = null;
|
|
|
|
|
if (branches) {
|
|
|
|
|
rowContent = branches.map((branch, index) => {
|
|
|
|
|
return <BranchRow key={index} baseUrl={baseUrl} branch={branch} />;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return rowContent;
|
|
|
|
|
}
|
2019-03-28 17:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
export default translate("repos")(BranchTable);
|