Browse Source

Improve new bulma template and show endtime and runtime in a nicer format

tags/v0.2.0
Bernhard Fröhlich 1 month ago
parent
commit
14ec2e105c
Signed by: Bernhard Froehlich <decke@bluelife.at> GPG Key ID: 4DD88C3F9F3B8333
2 changed files with 70 additions and 44 deletions
  1. 10
    0
      main.go
  2. 60
    44
      templates/index.html

+ 10
- 0
main.go View File

@@ -184,6 +184,16 @@ func (j *job) StartDate() string {
184 184
 	return j.Startdate.Format(time.RFC850)
185 185
 }
186 186
 
187
+func (j *job) EndDate() string {
188
+	return j.Enddate.Format(time.RFC850)
189
+}
190
+
191
+func (b *build) Runtime() string {
192
+	diff := b.Enddate.Sub(b.Startdate).Round(time.Second)
193
+
194
+	return fmt.Sprintf("%s", diff.String())
195
+}
196
+
187 197
 func (b *build) LogfileContent() string {
188 198
 	raw, err := ioutil.ReadFile(b.Logfile)
189 199
 	if err != nil {

+ 60
- 44
templates/index.html View File

@@ -15,65 +15,81 @@
15 15
 				<a class="navbar-item">
16 16
 					<img class="img" src="../../static/logo.png" alt="logo" />
17 17
 				</a>
18
+				<a class="navbar-item">caronade</a>
18 19
 			</div>
19 20
 		</nav>
20 21
 
21 22
 		<section class="section">
23
+			<div class="tile is-anchestor">
24
+				<div class="tile is-vertical">
25
+					<div class="tile">
26
+						<div class="tile is-parent is-vertical">
27
+
28
+							<article class="tile is-child message">
29
+								<div class="message-header"># {{.ID}}</div>
30
+								<div class="message-body level">
31
+									<div class="level-left">
32
+										<div class="level-item">
33
+											<p>
34
+												<span class="tag is-info">decke</span> committed
35
+												<a href="{{(index .PushEvent.Commits 0).URL}}">{{.PushEvent.CommitID}}</a>
36
+												to
37
+												<a href="{{.PushEvent.Repository.HTMLURL}}">{{.PushEvent.Repository.FullName}}</a>
38
+											</p>
39
+										</div>
40
+									</div>
41
+									<div class="level-right">
42
+										<div class="level-item">
43
+											<div class="tags has-addons">
44
+												<span class="tag is-dark">build start</span>
45
+												<span class="tag is-info">{{.StartDate}}</span>
46
+											</div>
47
+										</div>
48
+									</div>
49
+								</div>
50
+							</article>
51
+
52
+							<article class="tile is-child message">
53
+								<div class="message-body">
54
+									<pre><code>{{(index .PushEvent.Commits 0).Message}}</code></pre>
55
+								</div>
56
+							</article>
22 57
 
23
-			<article class="message">
24
-				<div class="message-header"># {{.ID}}</div>
25
-				<div class="message-body level">
26
-					<div class="level-left">
27
-						<div class="level-item">
28
-							<p>
29
-								<span class="tag is-info">decke</span> committed
30
-								<a href="{{(index .PushEvent.Commits 0).URL}}">{{.PushEvent.CommitID}}</a>
31
-								to
32
-								<a href="{{.PushEvent.Repository.HTMLURL}}">{{.PushEvent.Repository.FullName}}</a>
33
-							</p>
34 58
 						</div>
35
-					</div>
36
-					<div class="level-right">
37
-						<div class="level-item">
38
-							<div class="tags has-addons">
39
-								<span class="tag is-dark">build start</span>
40
-								<span class="tag is-info">{{.StartDate}}</span>
41
-							</div>
59
+						<div class="tile is-parent is-3">
60
+
61
+							<nav class="tile is-child panel">
62
+								<p class="panel-heading">builds</p>
63
+								{{range .Build}}
64
+								<a class="panel-block" href="#log-{{.ID}}"><span class="icon icon-{{.Status}}"></span> &nbsp; {{.Queue}} ({{.Runtime}})</a>
65
+								{{end}}
66
+							</nav>
67
+
42 68
 						</div>
43 69
 					</div>
44
-				</div>
45
-			</article>
46 70
 
47
-			<article class="message">
48
-				<div class="message-body">
49
-					<pre><code>{{(index .PushEvent.Commits 0).Message}}</code></pre>
50
-				</div>
51
-			</article>
52
-
53
-			<nav class="panel">
54
-				<p class="panel-heading">builds</p>
55
-				{{range .Build}}
56
-				<a class="panel-block" href="#log-{{.ID}}"><span class="icon icon-{{.Status}}"></span> &nbsp; {{.Queue}}</a>
57
-				{{end}}
58
-			</nav>
71
+					{{range .Build}}
72
+					<div class="tile is-parent">
73
+						<article class="tile is-child message">
74
+							<div class="message-header">
75
+								<p>{{.Queue}}</p>
76
+								<a class="is-right" href="{{.ID}}.log"><span class="icon icon-download"></span></a>
77
+							</div>
78
+							<div class="message-body">
79
+								<pre><code>{{.LogfileContent}}</code></pre>
80
+								<a id="log-{{.ID}}"></a>
81
+							</div>
82
+						</article>
83
+					</div>
84
+					{{end}}
59 85
 
60
-			{{range .Build}}
61
-			<article class="message">
62
-				<div class="message-header">
63
-					<p>{{.Queue}}</p>
64
-					<a class="is-right" href="{{.ID}}.log"><span class="icon icon-download"></span></a>
65
-				</div>
66
-				<div class="message-body">
67
-					<pre><code>{{.LogfileContent}}</code></pre>
68
-					<a id="log-{{.ID}}"></a>
69 86
 				</div>
70
-			</article>
71
-			{{end}}
87
+			</div>
72 88
 
73 89
 		</section>
74 90
 
75 91
 		<footer class="footer">
76
-			<p>this page was generated by <a href="https://code.bluelife.at/decke/caronade" target="_blank">caronade</a> at {{.Enddate}}</p>
92
+			<p>this page was generated by <a href="https://code.bluelife.at/decke/caronade" target="_blank">caronade</a> at {{.EndDate}}</p>
77 93
 		</footer>
78 94
 	</body>
79 95
 </html>

Loading…
Cancel
Save