2019-03-28 17:09:59 +01:00
|
|
|
//@flow
|
|
|
|
|
import React from "react";
|
|
|
|
|
import type { Repository, Branch } from "@scm-manager/ui-types";
|
|
|
|
|
import { translate } from "react-i18next";
|
2019-03-29 13:52:19 +01:00
|
|
|
import BranchButtonGroup from "./BranchButtonGroup";
|
2019-03-28 17:09:59 +01:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
repository: Repository,
|
|
|
|
|
branch: Branch,
|
|
|
|
|
// context props
|
|
|
|
|
t: string => string
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BranchDetailTable extends React.Component<Props> {
|
|
|
|
|
render() {
|
|
|
|
|
const { repository, branch, t } = this.props;
|
2019-04-01 13:47:41 +02:00
|
|
|
|
2019-03-28 17:09:59 +01:00
|
|
|
return (
|
|
|
|
|
<table className="table">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
2019-04-01 15:13:44 +02:00
|
|
|
<th>{t("branch.name")}</th>
|
2019-04-01 13:47:41 +02:00
|
|
|
<td>
|
|
|
|
|
{branch.name} {this.renderDefaultBranch()}
|
|
|
|
|
</td>
|
2019-03-28 17:09:59 +01:00
|
|
|
</tr>
|
|
|
|
|
<tr>
|
2019-04-01 15:13:44 +02:00
|
|
|
<th>
|
2019-03-28 17:09:59 +01:00
|
|
|
{t("branch.repository")}
|
2019-04-01 15:13:44 +02:00
|
|
|
</th>
|
2019-03-28 17:09:59 +01:00
|
|
|
<td>{repository.name}</td>
|
|
|
|
|
</tr>
|
2019-03-29 13:52:19 +01:00
|
|
|
<tr>
|
2019-04-01 15:13:44 +02:00
|
|
|
<th>{t("branch.actions")}</th>
|
2019-04-01 13:47:41 +02:00
|
|
|
<td>
|
|
|
|
|
<BranchButtonGroup repository={repository} branch={branch} />
|
2019-03-29 13:52:19 +01:00
|
|
|
</td>
|
|
|
|
|
</tr>
|
2019-03-28 17:09:59 +01:00
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
);
|
|
|
|
|
}
|
2019-04-01 13:47:41 +02:00
|
|
|
|
|
|
|
|
renderDefaultBranch() {
|
|
|
|
|
const { branch } = this.props;
|
|
|
|
|
|
|
|
|
|
let defaultLabel = null;
|
|
|
|
|
if (branch.defaultBranch) {
|
|
|
|
|
defaultLabel = <span className="tag is-dark">Default</span>;
|
|
|
|
|
}
|
|
|
|
|
return defaultLabel;
|
|
|
|
|
}
|
2019-03-28 17:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default translate("repos")(BranchDetailTable);
|