Tweak links on build card
This commit is contained in:
parent
2052be3b01
commit
9da7e23f4a
3 changed files with 12 additions and 10 deletions
|
|
@ -49,7 +49,8 @@ class Build(BaseModel):
|
||||||
git_commit: str
|
git_commit: str
|
||||||
image: str
|
image: str
|
||||||
deploy_link: str
|
deploy_link: str
|
||||||
repo_link: str
|
repo_target_branch_link: str
|
||||||
|
repo_pr_link: Optional[str]
|
||||||
repo_commit_link: str
|
repo_commit_link: str
|
||||||
webui_link: str
|
webui_link: str
|
||||||
status: models.BuildStatus
|
status: models.BuildStatus
|
||||||
|
|
|
||||||
|
|
@ -138,12 +138,14 @@ class Build(BaseModel):
|
||||||
return f"http://{self.slug}.{settings.build_domain}"
|
return f"http://{self.slug}.{settings.build_domain}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def repo_link(self) -> str:
|
def repo_target_branch_link(self) -> str:
|
||||||
link = f"https://github.com/{self.repo}"
|
return f"https://github.com/{self.repo}/tree/{self.target_branch}"
|
||||||
if self.pr:
|
|
||||||
return f"{link}/pull/{self.pr}"
|
@property
|
||||||
else:
|
def repo_pr_link(self) -> str | None:
|
||||||
return f"{link}/tree/{self.target_branch}"
|
if not self.pr:
|
||||||
|
return None
|
||||||
|
return f"https://github.com/{self.repo}/pull/{self.pr}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def repo_commit_link(self) -> str:
|
def repo_commit_link(self) -> str:
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,10 @@ class RunboatBuildElement extends LitElement {
|
||||||
<div class="build-card build-status-${this.build.status}">
|
<div class="build-card build-status-${this.build.status}">
|
||||||
<p class="build-name">${this.build.name}</p>
|
<p class="build-name">${this.build.name}</p>
|
||||||
<p>
|
<p>
|
||||||
${this.build.repo}
|
<a href="${this.build.repo_target_branch_link}">${this.build.repo} ${this.build.target_branch}</a>
|
||||||
${this.build.pr?
|
${this.build.pr?
|
||||||
html`PR <a href="${this.build.repo_link}">${this.build.pr}</a> to`:""
|
html`PR <a href="${this.build.repo_pr_link}">${this.build.pr}</a>`:""
|
||||||
}
|
}
|
||||||
<a href="${this.build.repo_link}">${this.build.target_branch}</a>
|
|
||||||
<br>
|
<br>
|
||||||
${this.build.git_commit?
|
${this.build.git_commit?
|
||||||
html`(<a href="${this.build.repo_commit_link}">${this.build.git_commit.substring(0, 8)}</a>)`:""
|
html`(<a href="${this.build.repo_commit_link}">${this.build.git_commit.substring(0, 8)}</a>)`:""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue