Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tags links #81

Merged
merged 1 commit into from
Mar 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions src/DeployPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import { EllipsisLoading } from './Common';

const BORS_LOGIN = 'bors[bot]';

function makeTagAbsoluteUrl(owner, repo, tag) {
return `https://github.com/${owner}/${repo}/releases/tag/${encodeURIComponent(
tag
)}`;
}

class DeployPage extends React.Component {
static propsTypes = {
shortCode: PropTypes.string.isRequired
Expand Down Expand Up @@ -183,6 +189,8 @@ class DeployPage extends React.Component {
commits={commits}
tags={tags}
shortUrl={`/s/${code}`}
owner={owner}
repo={repo}
/>
<RepoSummary
deployInfo={deployInfo}
Expand All @@ -206,7 +214,9 @@ class DeployTable extends React.Component {
PropTypes.shape({ name: PropTypes.string.isRequired })
).isRequired,
commits: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
tags: PropTypes.object.isRequired
tags: PropTypes.object.isRequired,
owner: PropTypes.string.isRequired,
repo: PropTypes.string.isRequired
};

constructor(props) {
Expand All @@ -221,7 +231,7 @@ class DeployTable extends React.Component {
};

render() {
const { deployInfo, commits, tags, shortUrl } = this.props;
const { deployInfo, commits, tags, owner, repo, shortUrl } = this.props;
const { borsMode } = this.state;

let hasBors = false;
Expand Down Expand Up @@ -264,6 +274,8 @@ class DeployTable extends React.Component {
tag={tags[commit.sha]}
users={usersByLogin}
borsMode={borsMode}
owner={owner}
repo={repo}
/>
{deployInfo.map(deploy => (
<td
Expand Down Expand Up @@ -337,6 +349,8 @@ class CommitDetails extends React.Component {
html_url: PropTypes.string.isRequired
}),
html_url: PropTypes.string.isRequired,
owner: PropTypes.string.isRequired,
repo: PropTypes.string.isRequired,
tag: PropTypes.any
};

Expand Down Expand Up @@ -382,7 +396,7 @@ class CommitDetails extends React.Component {
}

render() {
let { commit, author, tag, html_url, borsMode } = this.props;
let { commit, author, tag, html_url, borsMode, owner, repo } = this.props;

let involvedUsers = [author];

Expand All @@ -406,9 +420,13 @@ class CommitDetails extends React.Component {
{title}
</a>
{tag && (
<span className="badge badge-pill badge-info" title={`Tag: ${tag}`}>
<a
href={makeTagAbsoluteUrl(owner, repo, tag)}
className="badge badge-pill badge-info"
title={`Tag: ${tag}`}
>
{tag}
</span>
</a>
)}
{commit.date}
<TimeAgo
Expand Down Expand Up @@ -447,6 +465,15 @@ function UserAvatars({ users }) {
}

class RepoSummary extends React.Component {
static propTypes = {
deployInfo: PropTypes.arrayOf(
PropTypes.shape({ name: PropTypes.string.isRequired })
).isRequired,
owner: PropTypes.string.isRequired,
repo: PropTypes.string.isRequired,
tags: PropTypes.object.isRequired
};

render() {
const { deployInfo, tags, owner, repo } = this.props;

Expand Down Expand Up @@ -525,9 +552,13 @@ class ShaLink extends React.Component {
{sha.slice(0, 7)}
</a>
{tag && (
<span className="badge badge-pill badge-info" title={`Tag: ${tag}`}>
<a
href={makeTagAbsoluteUrl(owner, repo, tag)}
className="badge badge-pill badge-info"
title={`Tag: ${tag}`}
>
{tag}
</span>
</a>
)}
</>
);
Expand Down