Skip to content

Commit afa65b4

Browse files
committed
view build
1 parent a898c76 commit afa65b4

File tree

9 files changed

+108
-78
lines changed

9 files changed

+108
-78
lines changed

assets/templates_src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h3 class="box-title">Projects</h3>
4747
{% if item.FinishedAt %}
4848
{{ item.FinishedAt | naturaltime }}
4949
{% else %}
50-
started at{{ item.StartedAt | naturaltime }}
50+
started at {{ item.StartedAt | naturaltime }}
5151
{% endif %}
5252
{% endif %}
5353
</td>

assets/templates_src/internal/layout.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
<title>Postgres-CI</title>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<link rel="stylesheet" href="/static/bootstrap/css/bootstrap.min.css">
9-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
10-
<!--
11-
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
12-
-->
9+
<link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css">
1310
<link rel="stylesheet" href="/static/dist/css/AdminLTE.min.css">
1411
<link rel="stylesheet" href="/static/dist/css/skins/skin-black.min.css">
1512
</head>

assets/templates_src/internal/layout/header.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</a>
1313
<div class="navbar-custom-menu">
1414
<ul class="nav navbar-nav">
15-
<li class="dropdown notifications-menu">
15+
<!--li class="dropdown notifications-menu">
1616
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
1717
<i class="fa fa-bell-o"></i>
1818
<span class="label label-warning">10</span>
@@ -30,7 +30,7 @@
3030
</li>
3131
<li class="footer"><a href="#">View all</a></li>
3232
</ul>
33-
</li>
33+
</li-->
3434
<li><a>{% verbatim %}{{ CurrentUser.Name }} {% endverbatim %}</a></li>
3535
<li>
3636
<a href="/logout/"><i class="fa fa-sign-out"></i></a>

assets/templates_src/project/build.html

Lines changed: 0 additions & 54 deletions
This file was deleted.

assets/templates_src/project/builds.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h1>Builds</h1>
1414
<h3 class="box-title">Total: {{ total }}</h3>
1515
<div class="box-tools">
1616
<select class="form-control">
17-
<option value=""></option>
17+
<option value="">branches</option>
1818
{% for branch in branches %}
1919
<option value="{{ branch.ID }}">{{ branch.Name }}</option>
2020
{% endfor %}
@@ -50,7 +50,7 @@ <h3 class="box-title">Total: {{ total }}</h3>
5050
<td>
5151
<a href="/project/{{ item.ProjectID }}/build/{{ item.BuildID }}/">{{ item.CommitSHA }}</a>
5252
</td>
53-
<td>{{ item.CommitMessage }}</td>
53+
<td>{{ item.CommitMessage | truncatechars:255 }}</td>
5454
<td>
5555
<a href="/{{ item.BranchID }}">{{ item.Branch }}</a>
5656
</td>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{% extends "../internal/layout.html" %} {% block content_header%}
2+
<h1>Builds</h1> {% endblock %}
3+
<ol class="breadcrumb">
4+
{% block breadcrumb%}
5+
<li><a href="/"><i class="fa fa-dashboard"></i> Dashboard</a></li>
6+
{% verbatim %}<li><a href="/project/{{ build.ProjectID}}/builds/">{{ build.ProjectName}} builds</a></li>{% endverbatim %}
7+
<li class="active">build</li>
8+
{% endblock %} {% block content%} {% verbatim %}
9+
<div class="box">
10+
<div class="box-header">
11+
<h3 class="box-title">Commit {{ build.CommitSHA }}</h3>
12+
<div class="box-tools">{{ build.CommittedAt | time:"Mon, 02 Jan 2006 15:04:05 -0700"}}</div>
13+
</div>
14+
<div class="box-body">
15+
<strong>Branch:</strong> <a href="/project/{{ build.ProjectID }}/builds/branch/{{ build.BranchID }}/">{{ build.Branch }}</a><br>
16+
<strong>Author:</strong> {{ build.AuthorName }} ({{ build.AuthorEmail }})<br>
17+
{% if build.AuthorName != build.CommitterName %}<br>
18+
<strong>Commiter:</strong> {{ build.CommitterName }} ({{ build.CommitterEmail }})<br>
19+
{% endif %}
20+
<strong>Message:</strong>
21+
<pre>{{ build.CommitMessage }}</pre>
22+
</div>
23+
</div>
24+
<div class="box">
25+
<div class="box-header">
26+
<h3 class="box-title">Config</h3>
27+
28+
</div>
29+
<div class="box-body">
30+
<pre>{{ build.Config }}</pre>
31+
</div>
32+
</div>
33+
{% for part in build.Parts %}
34+
<div class="box collapsed-box{% if !part.Success %} box-danger box-solid{% endif %}">
35+
<div class="box-header">
36+
<h3 class="box-title">
37+
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button>
38+
Image: {{ part.DockerImage}}. Server version: {{ part.ServerVersion }}
39+
</h3>
40+
<div class="box-tools">
41+
<strong>Duration:</strong> {{ part.FinishedAt | duration:part.StartedAt }}
42+
</div>
43+
</div>
44+
<div class="box-body" style="display: none;">
45+
<strong>Output:</strong>
46+
<pre>{{ part.Output }}</pre>
47+
<table class="table table-striped">
48+
<thead>
49+
<tr>
50+
<th>Function</th>
51+
<th width="110px">Duration</th>
52+
</tr>
53+
</thead>
54+
<tbody>
55+
{% for test in part.Tests %}
56+
<tr>
57+
<td>
58+
59+
{% if test.Errors %}
60+
<span class="label label-danger">{{ test.Namespace }}.{{ test.Procedure }}</span><br>
61+
{% for error in test.Errors %}
62+
{{ error.Message }} {{ error.Comment }} <br>
63+
{% endfor %}
64+
{% else %}
65+
{{ test.Namespace }}.{{ test.Procedure }}
66+
{% endif %}
67+
</td>
68+
<td>{{ test.FinishedAt | duration_seconds:test.StartedAt }}</td>
69+
</tr>
70+
{% endfor %}
71+
</tbody>
72+
</table>
73+
74+
</div>
75+
</div>
76+
{% endfor %}
77+
{% endverbatim %} {% endblock %}

src/app/controllers/project/builds.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import (
99

1010
func buildsHandler(c *http200ok.Context) {
1111

12-
list, err := build.List(params.ToInt32(c, "ProjectID"), 0, 10, 0)
12+
list, err := build.List(params.ToInt32(c, "ProjectID"), params.ToInt32(c, "BranchID"), 10, 0)
1313

1414
if err != nil {
15+
1516
return
1617
}
1718

@@ -21,16 +22,3 @@ func buildsHandler(c *http200ok.Context) {
2122
"items": list.Items,
2223
})
2324
}
24-
25-
func buildHandler(c *http200ok.Context) {
26-
27-
build, err := build.View(params.ToInt32(c, "BuildID"))
28-
29-
if err != nil {
30-
return
31-
}
32-
33-
render.HTML(c, "project/build.html", render.Context{
34-
"build": build,
35-
})
36-
}

src/app/controllers/project/route.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ import (
77
func Route(server *http200ok.Server) {
88

99
server.Get("/project/:ProjectID/builds/", buildsHandler)
10-
server.Get("/project/:ProjectID/build/:BuildID/", buildHandler)
10+
server.Get("/project/:ProjectID/builds/branch/:BranchID/", buildsHandler)
11+
server.Get("/project/:ProjectID/build/:BuildID/", viewBuildHandler)
1112
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package project
2+
3+
import (
4+
"github.com/postgres-ci/app-server/src/app/models/build"
5+
"github.com/postgres-ci/app-server/src/tools/params"
6+
"github.com/postgres-ci/app-server/src/tools/render"
7+
"github.com/postgres-ci/http200ok"
8+
)
9+
10+
func viewBuildHandler(c *http200ok.Context) {
11+
12+
build, err := build.View(params.ToInt32(c, "BuildID"))
13+
14+
if err != nil {
15+
return
16+
}
17+
18+
render.HTML(c, "project/view_build.html", render.Context{
19+
"build": build,
20+
})
21+
}

0 commit comments

Comments
 (0)