Skip to content
Permalink
Browse files

Improve new bulma template and show endtime and runtime in a nicer fo…

…rmat
  • Loading branch information...
decke committed Jun 6, 2019
1 parent 02d7df4 commit 14ec2e105c5b90edb7a9b63c21f6ea6a80a689b5
Showing with 70 additions and 44 deletions.
  1. +10 −0 main.go
  2. +60 −44 templates/index.html
10 main.go
@@ -184,6 +184,16 @@ func (j *job) StartDate() string {
return j.Startdate.Format(time.RFC850)
}

func (j *job) EndDate() string {
return j.Enddate.Format(time.RFC850)
}

func (b *build) Runtime() string {
diff := b.Enddate.Sub(b.Startdate).Round(time.Second)

return fmt.Sprintf("%s", diff.String())
}

func (b *build) LogfileContent() string {
raw, err := ioutil.ReadFile(b.Logfile)
if err != nil {
@@ -15,65 +15,81 @@
<a class="navbar-item">
<img class="img" src="../../static/logo.png" alt="logo" />
</a>
<a class="navbar-item">caronade</a>
</div>
</nav>

<section class="section">
<div class="tile is-anchestor">
<div class="tile is-vertical">
<div class="tile">
<div class="tile is-parent is-vertical">

<article class="tile is-child message">
<div class="message-header"># {{.ID}}</div>
<div class="message-body level">
<div class="level-left">
<div class="level-item">
<p>
<span class="tag is-info">decke</span> committed
<a href="{{(index .PushEvent.Commits 0).URL}}">{{.PushEvent.CommitID}}</a>
to
<a href="{{.PushEvent.Repository.HTMLURL}}">{{.PushEvent.Repository.FullName}}</a>
</p>
</div>
</div>
<div class="level-right">
<div class="level-item">
<div class="tags has-addons">
<span class="tag is-dark">build start</span>
<span class="tag is-info">{{.StartDate}}</span>
</div>
</div>
</div>
</div>
</article>

<article class="tile is-child message">
<div class="message-body">
<pre><code>{{(index .PushEvent.Commits 0).Message}}</code></pre>
</div>
</article>

<article class="message">
<div class="message-header"># {{.ID}}</div>
<div class="message-body level">
<div class="level-left">
<div class="level-item">
<p>
<span class="tag is-info">decke</span> committed
<a href="{{(index .PushEvent.Commits 0).URL}}">{{.PushEvent.CommitID}}</a>
to
<a href="{{.PushEvent.Repository.HTMLURL}}">{{.PushEvent.Repository.FullName}}</a>
</p>
</div>
</div>
<div class="level-right">
<div class="level-item">
<div class="tags has-addons">
<span class="tag is-dark">build start</span>
<span class="tag is-info">{{.StartDate}}</span>
</div>
<div class="tile is-parent is-3">

<nav class="tile is-child panel">
<p class="panel-heading">builds</p>
{{range .Build}}
<a class="panel-block" href="#log-{{.ID}}"><span class="icon icon-{{.Status}}"></span> &nbsp; {{.Queue}} ({{.Runtime}})</a>
{{end}}
</nav>

</div>
</div>
</div>
</article>

<article class="message">
<div class="message-body">
<pre><code>{{(index .PushEvent.Commits 0).Message}}</code></pre>
</div>
</article>

<nav class="panel">
<p class="panel-heading">builds</p>
{{range .Build}}
<a class="panel-block" href="#log-{{.ID}}"><span class="icon icon-{{.Status}}"></span> &nbsp; {{.Queue}}</a>
{{end}}
</nav>
{{range .Build}}
<div class="tile is-parent">
<article class="tile is-child message">
<div class="message-header">
<p>{{.Queue}}</p>
<a class="is-right" href="{{.ID}}.log"><span class="icon icon-download"></span></a>
</div>
<div class="message-body">
<pre><code>{{.LogfileContent}}</code></pre>
<a id="log-{{.ID}}"></a>
</div>
</article>
</div>
{{end}}

{{range .Build}}
<article class="message">
<div class="message-header">
<p>{{.Queue}}</p>
<a class="is-right" href="{{.ID}}.log"><span class="icon icon-download"></span></a>
</div>
<div class="message-body">
<pre><code>{{.LogfileContent}}</code></pre>
<a id="log-{{.ID}}"></a>
</div>
</article>
{{end}}
</div>

</section>

<footer class="footer">
<p>this page was generated by <a href="https://code.bluelife.at/decke/caronade" target="_blank">caronade</a> at {{.Enddate}}</p>
<p>this page was generated by <a href="https://code.bluelife.at/decke/caronade" target="_blank">caronade</a> at {{.EndDate}}</p>
</footer>
</body>
</html>

0 comments on commit 14ec2e1

Please sign in to comment.
You can’t perform that action at this time.