Skip to content

Commit

Permalink
LUCI updated the table formatting again
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad902 committed Jul 23, 2019
1 parent 606d5cb commit 0a74d0e
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions dashboard/dashboard.go
Expand Up @@ -129,15 +129,13 @@ func GetStatus(buildUrl string) (statusLine, error) {
if i == 0 {
// Does this look like the right table?
h := findSubtag(c, "th")
if h != nil && h.FirstChild != nil && strings.Contains(h.FirstChild.Data, "Time") {
h2 := h.NextSibling
if h2 != nil {
h2 = h2.NextSibling
}
if h2 != nil && h2.FirstChild != nil && strings.Contains(h2.FirstChild.Data, "Duration") {
if h != nil && h.FirstChild != nil {
if h.FirstChild.Data == "Time" {
continue
} else if h.FirstChild.Data == "Create time" {
isLuci = true
continue
}
continue
}
return *new(statusLine)
}
Expand All @@ -147,7 +145,7 @@ func GetStatus(buildUrl string) (statusLine, error) {
var rev int64 = 0

for i, c := range findSubtags(c, "td") {
if i == 0 && lastbuild.IsZero() {
if ((!isLuci && i == 0) || (isLuci && i == 1)) && lastbuild.IsZero() {
// LUCI has slightly different layout/formatting than buildbot
if c.FirstChild.Data == "span" {
strtime, err := strconv.ParseInt(attr(c.FirstChild, "data-timestamp"), 10, 64)
Expand All @@ -168,20 +166,19 @@ func GetStatus(buildUrl string) (statusLine, error) {
}
}
}
if (!isLuci && i == 1) || (isLuci && i == 2) {
if (!isLuci && i == 1) || (isLuci && i == 3) {
rev, _ = strconv.ParseInt(c.FirstChild.Data, 10, 0)
}
if (!isLuci && i == 2) || (isLuci && i == 3) {
if (!isLuci && i == 2) || (isLuci && i == 4) {
classC := class(c)
if classC == "success" || classC == "status-Success" {
if strings.Contains(strings.ToLower(classC), "success") {
success = 1
}
if classC == "failure" || classC == "status-Failure" {
if strings.Contains(strings.ToLower(classC), "failure") {
success = -1
}

}
if (!isLuci && i == 3) || (isLuci && i == 4) {
if (!isLuci && i == 3) || (isLuci && i == 5) {
relUrl, err := url.Parse(attr(findSubtag(c, "a"), "href"))
if err == nil {
buildUrl = baseUrl.ResolveReference(relUrl).String()
Expand Down

0 comments on commit 0a74d0e

Please sign in to comment.