Skip to content

Commit

Permalink
Merge tardyp/buildbot:uifixes (PR #1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Aug 31, 2014
2 parents ff32595 + b7b710c commit 6ab7980
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 12 deletions.
2 changes: 1 addition & 1 deletion www/.gitignore
@@ -1,6 +1,6 @@
MANIFEST.in
build
!src/app/builders/build
!base/src/app/builders/build
dist/
static/
coverage/
Expand Down
2 changes: 1 addition & 1 deletion www/base/guanlecoja/config.coffee
Expand Up @@ -30,7 +30,7 @@ config =
# JavaScript libraries (order matters)
deps:
"guanlecoja-ui":
version: '~1.1.0'
version: '~1.2.0'
files: ['vendors.js', 'scripts.js']
moment:
version: "~2.6.0"
Expand Down
5 changes: 4 additions & 1 deletion www/base/setup.py
Expand Up @@ -17,16 +17,19 @@

try:
from buildbot_pkg import setup_www_plugin
import mock, buildbot
except ImportError:
from setuptools import setup
import sys
print >> sys.stderr, "Please install buildbot_pkg module in order to install that package, or use the pre-build .whl modules available on pypi"
print >> sys.stderr, "Please install buildbot, buildbot_pkg, and mock modules in order to install that package, or use the pre-build .whl modules available on pypi"
sys.exit(1)

setup_www_plugin(
name='buildbot-www',
description='Buildbot UI',
author=u'Pierre Tardy',
author_email=u'tardyp@gmail.com',
setup_requires=['buildbot', 'buildbot_pkg', 'mock'],
url='http://buildbot.net/',
license='GNU GPL',
packages=['buildbot_www'],
Expand Down
24 changes: 24 additions & 0 deletions www/base/src/app/builders/build/build.controller.coffee
@@ -0,0 +1,24 @@
class Build extends Controller
constructor: ($rootScope, $scope, $location, buildbotService, $stateParams, recentStorage) ->

buildbotService.bindHierarchy($scope, $stateParams, ['builders', 'builds'])
.then ([builder, build]) ->
$rootScope.$broadcast "breadcrumb", [
caption: "Builders"
sref: "builders"
,
caption: builder.name
sref: "builder({builder:#{builder.id}})"
,
caption: build.number
sref: "build({build:#{build.number}})"
]
buildbotService.one("buildslaves", build.buildslaveid).bind($scope)
buildbotService.one("buildrequests", build.buildrequestid)
.bind($scope).then (buildrequest) ->
buildset = buildbotService.one("buildsets", buildrequest.buildsetid)
buildset.bind($scope)
buildset.one("properties").bind($scope, dest_key:'properties')
recentStorage.addBuild
link: "#/builders/#{$scope.builder.builderid}/build/#{$scope.build.number}"
caption: "#{$scope.builder.name} / #{$scope.build.number}"
15 changes: 15 additions & 0 deletions www/base/src/app/builders/build/build.route.coffee
@@ -0,0 +1,15 @@
class State extends Config
constructor: ($stateProvider) ->

# Name of the state
name = 'build'

# Register new state
state =
controller: "#{name}Controller"
templateUrl: "views/#{name}.html"
name: name
url: '/builders/:builder/build/:build'
data: {}

$stateProvider.state(state)
24 changes: 24 additions & 0 deletions www/base/src/app/builders/build/build.tpl.jade
@@ -0,0 +1,24 @@
.container
.row
ul.breadcrumb
li.pull-right
button.btn.btn-default(ng-show="build.complete") Rebuild
li.pull-right
button.btn.btn-default(ng-show="build.complete") Promote
.row
.col-sm-5
buildsummary(ng-if="build", buildid="build.buildid")
.col-sm-7
tabset
tab(heading="properties")
rawdata(data="properties")
tab(heading="{{buildslave.name}}")
rawdata(data="buildslave")
tab(heading="builder")
rawdata(data="builder")
tab(heading="build")
rawdata(data="build")
tab(heading="buildrequest")
rawdata(data="buildrequest")
tab(heading="buildset")
rawdata(data="buildset")
1 change: 1 addition & 0 deletions www/base/src/styles/styles.less
@@ -1,5 +1,6 @@
// Import bootstrap and font awesome stylesheets
@import "../../libs/bootstrap/less/bootstrap.less";
@import "../../libs/font-awesome/less/font-awesome.less";
@import (inline) "../../libs/guanlecoja-ui/styles.css";

// Import colors and animation stylesheet
Expand Down
10 changes: 4 additions & 6 deletions www/waterfall_view/src/module/main.module.coffee
Expand Up @@ -191,7 +191,7 @@ class Waterfall extends Controller
###
# Returns the result string of a builder, build or step
###
result: (b) ->
getResultClassFromThing: (b) ->
if not b.complete and b.started_at >= 0
result = 'pending'
else
Expand All @@ -211,7 +211,6 @@ class Waterfall extends Controller
drawXAxis: ->
x = @scale.getX(@builders, @getInnerWidth())
builderName = @scale.getBuilderName(@builders)
color = @result

# Remove old axis
@header.select('.axis.x').remove()
Expand Down Expand Up @@ -252,7 +251,7 @@ class Waterfall extends Controller
.attr('x2', 0)
.attr('y1', x.rangeBand() / 2)
.attr('y2', - x.rangeBand() / 2)
.attr('class', color)
.attr('class', self.getResultClassFromThing)
.classed('stroke', true)

# Y axis tick values
Expand Down Expand Up @@ -328,7 +327,6 @@ class Waterfall extends Controller
drawBuilds: ->
x = @scale.getX(@builders, @getInnerWidth())
y = @scale.getY(@groups, @c.gap, @getInnerHeight())
color = @result

# Remove previous elements
@chart.selectAll('.builder').remove()
Expand All @@ -351,7 +349,7 @@ class Waterfall extends Controller

# Draw rectangle for each build
builds.append('rect')
.attr('class', color)
.attr('class', self.getResultClassFromThing)
.attr('width', x.rangeBand())
.attr('height', (build) -> y(build.started_at) - y(build.complete_at))
.classed('fill', true)
Expand Down Expand Up @@ -431,7 +429,7 @@ class Waterfall extends Controller
.append('text')
.attr('y', (step, i) -> 15 * (i + 1))
.attr('x', if r then 30 else 10)
.attr('class', color)
.attr('class', self.getResultClassFromThing)
.classed('fill', true)
.transition().delay(100)
# Text format
Expand Down
6 changes: 3 additions & 3 deletions www/waterfall_view/src/module/main.module.spec.coffee
Expand Up @@ -109,9 +109,9 @@ describe 'Waterfall view controller', ->
testBuild =
complete: false
started_at: 0
expect(w.result(testBuild)).toBe('pending')
expect(w.getResultClassFromThing(testBuild)).toBe('pending')
testBuild.complete = true
expect(w.result(testBuild)).toBe('unknown')
expect(w.getResultClassFromThing(testBuild)).toBe('unknown')
results =
0: 'success'
1: 'warnings'
Expand All @@ -121,4 +121,4 @@ describe 'Waterfall view controller', ->
5: 'cancelled'
for i in [0..5]
testBuild.results = i
expect(w.result(testBuild)).toBe(results[i])
expect(w.getResultClassFromThing(testBuild)).toBe(results[i])

0 comments on commit 6ab7980

Please sign in to comment.