Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
35755b9c
Commit
35755b9c
authored
Dec 19, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: improve formatting of build status page
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/5493077
parent
9b3799aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
4 deletions
+29
-4
ui.go
misc/dashboard/app/build/ui.go
+22
-1
ui.html
misc/dashboard/app/build/ui.html
+7
-3
No files found.
misc/dashboard/app/build/ui.go
View file @
35755b9c
...
...
@@ -148,7 +148,9 @@ var uiTemplate = template.Must(
template
.
New
(
"ui"
)
.
Funcs
(
template
.
FuncMap
{
"builderTitle"
:
builderTitle
,
"shortDesc"
:
shortDesc
,
"shortHash"
:
shortHash
,
"shortUser"
:
shortUser
,
"repoURL"
:
repoURL
,
})
.
ParseFile
(
"build/ui.html"
),
...
...
@@ -159,7 +161,15 @@ func builderTitle(s string) string {
return
strings
.
Replace
(
s
,
"-"
,
" "
,
-
1
)
}
// shortHash returns a the short version of a hash.
// shortDesc returns the first line of a description.
func
shortDesc
(
desc
string
)
string
{
if
i
:=
strings
.
Index
(
desc
,
"
\n
"
);
i
!=
-
1
{
desc
=
desc
[
:
i
]
}
return
desc
}
// shortHash returns a short version of a hash.
func
shortHash
(
hash
string
)
string
{
if
len
(
hash
)
>
12
{
hash
=
hash
[
:
12
]
...
...
@@ -167,6 +177,17 @@ func shortHash(hash string) string {
return
hash
}
// shortUser returns a shortened version of a user string.
func
shortUser
(
user
string
)
string
{
if
i
,
j
:=
strings
.
Index
(
user
,
"<"
),
strings
.
Index
(
user
,
">"
);
i
!=
-
1
&&
j
>
i
{
user
=
user
[
i
+
1
:
j
]
if
k
:=
strings
.
Index
(
user
,
"@golang.org"
);
k
!=
-
1
{
user
=
user
[
:
k
]
}
}
return
user
}
// repoRe matches Google Code repositories and subrepositories (without paths).
var
repoRe
=
regexp
.
MustCompile
(
`^code\.google\.com/p/([a-z0-9\-]+)(\.[a-z0-9\-]+)?$`
)
...
...
misc/dashboard/app/build/ui.html
View file @
35755b9c
...
...
@@ -29,11 +29,15 @@
.build
tr
:nth-child
(
2n
)
{
background-color
:
#f0f0f0
;
}
.build
.hash
{
font-family
:
monospace
;
}
.build
.result
{
text-align
:
center
;
width
:
50px
;
}
.build
.time
{
font-family
:
monospace
;
color
:
#666
;
}
.build
.descr
,
.build
.time
,
.build
.user
{
...
...
@@ -83,9 +87,9 @@
{{end}}
</td>
{{end}}
<td
class=
"user"
>
{{.User}}
</td>
<td
class=
"time"
>
{{.Time.Time}}
</td>
<td
class=
"desc"
>
{{.Desc}}
</td>
<td
class=
"user"
>
{{
shortUser
.User}}
</td>
<td
class=
"time"
>
{{.Time.Time
.Format "02 Jan 2006 15:04"
}}
</td>
<td
class=
"desc"
>
{{
shortDesc
.Desc}}
</td>
</tr>
{{end}}
</table>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment