Add age on build cards

This commit is contained in:
Stéphane Bidoul 2021-12-01 12:01:57 +01:00
parent b21a7c92f8
commit abdbbb3cbe
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92

View file

@ -1,4 +1,8 @@
import {LitElement, html, css} from 'https://unpkg.com/lit@2.0.2?module'; import {LitElement, html, css} from 'https://unpkg.com/lit@2.0.2?module';
import dayjs from 'https://unpkg.com/dayjs@1.10.7/esm';
import relativeTime from 'https://unpkg.com/dayjs@1.10.7/esm/plugin/relativeTime';
dayjs.extend(relativeTime);
class RunboatBuildElement extends LitElement { class RunboatBuildElement extends LitElement {
static get properties() { static get properties() {
@ -35,6 +39,10 @@ class RunboatBuildElement extends LitElement {
.build-status-failed { .build-status-failed {
background-color: lightcoral; background-color: lightcoral;
} }
.age {
color: gray;
white-space: nowrap;
}
p { p {
margin-top: 0.5em; margin-top: 0.5em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
@ -53,10 +61,10 @@ class RunboatBuildElement extends LitElement {
${this.build.commit_info?.pr? ${this.build.commit_info?.pr?
html`PR <a href="${this.build.repo_pr_link}">${this.build.commit_info?.pr}</a>`:"" html`PR <a href="${this.build.repo_pr_link}">${this.build.commit_info?.pr}</a>`:""
} }
<br>
${this.build.commit_info?.git_commit? ${this.build.commit_info?.git_commit?
html`(<a href="${this.build.repo_commit_link}">${this.build.commit_info?.git_commit.substring(0, 8)}</a>)`:"" html`(<a href="${this.build.repo_commit_link}">${this.build.commit_info?.git_commit.substring(0, 8)}</a>)`:""
} }
<span class="age">${dayjs(this.build.created).fromNow()}</span>
</p> </p>
<p> <p>
${this.build.status || "undeployed"} ${this.build.status || "undeployed"}