Skip to content

Commit

Permalink
Merge pull request #1906 from tardyp/webui
Browse files Browse the repository at this point in the history
fixes for Webui
  • Loading branch information
tardyp committed Nov 3, 2015
2 parents 1dfdc0c + 289d5b7 commit 6a662c1
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 38 deletions.
2 changes: 1 addition & 1 deletion www/base/src/app/builders/builders.tpl.jade
Expand Up @@ -21,7 +21,7 @@
a(ui-sref='builder({builder: builder.builderid})')
| {{ builder.name }}
td
span(ng-repeat="build in builder.builds")
span(ng-repeat="build in builder.builds | orderBy : '-number' |limitTo: '15' ")
a(ui-sref='build({builder: builder.builderid, build: build.number})')
span.badge-status(ng-class="results2class(build, 'pulse')")
| {{ build.number }}
Expand Down
52 changes: 32 additions & 20 deletions www/base/src/app/builders/builds/build.controller.coffee
@@ -1,7 +1,8 @@
class Build extends Controller
constructor: ($rootScope, $scope, $location, $stateParams, $state,
dataService, dataUtilsService, recentStorage, publicFieldsFilter,
glBreadcrumbService, glTopbarContextualActionsService) ->
glBreadcrumbService, glTopbarContextualActionsService, resultsService) ->
_.mixin($scope, resultsService)

builderid = _.parseInt($stateParams.builder)
buildnumber = _.parseInt($stateParams.build)
Expand Down Expand Up @@ -71,10 +72,23 @@ class Build extends Controller
data = dataService.open($scope)
data.getBuilders(builderid).then (builders) ->
$scope.builder = builder = builders[0]
builder.getBuilds(buildnumber).then (builds) ->
$scope.build = build = builds[0]
if not build.number? and buildnumber > 1
$state.go('build', builder:builderid, build:buildnumber - 1)
builder.getBuilds(number__lt: buildnumber + 2, limit: 3, order: '-number').then (builds) ->
$scope.prevbuild = null
$scope.nextbuild = null
build = null
for b in builds
if b.number == buildnumber - 1
$scope.prevbuild = b
if b.number == buildnumber
$scope.build = build = b
if b.number == buildnumber + 1
$scope.nextbuild = b
$scope.last_build = false

if not build
$state.go('build', builder: builderid, build: builds[0].number)
return

breadcrumb = [
caption: "Builders"
sref: "builders"
Expand All @@ -97,18 +111,19 @@ class Build extends Controller
link: "#/builders/#{$scope.builder.builderid}/builds/#{$scope.build.number}"
caption: "#{$scope.builder.name} / #{$scope.build.number}"

data.getBuilds(build.buildid).then (builds) ->
build = builds[0]
$scope.properties = build.getProperties().getArray()
$scope.changes = build.getChanges().getArray()
$scope.$watch 'changes', (changes) ->
if changes?
responsibles = {}
for change in changes
change.author_email = dataUtilsService.emailInString(change.author)
responsibles[change.author] = change.author_email
$scope.responsibles = responsibles
, true
# HACK: we should definitively fix this in the data_module
# http://trac.buildbot.net/ticket/3380
build._endpoint = "builds"
$scope.properties = build.getProperties().getArray()
$scope.changes = build.getChanges().getArray()
$scope.$watch 'changes', (changes) ->
if changes?
responsibles = {}
for change in changes
change.author_email = dataUtilsService.emailInString(change.author)
responsibles[change.author] = change.author_email
$scope.responsibles = responsibles
, true

data.getBuildslaves(build.buildslaveid).then (buildslaves) ->
$scope.buildslave = publicFieldsFilter(buildslaves[0])
Expand All @@ -117,6 +132,3 @@ class Build extends Controller
$scope.buildrequest = buildrequest = buildrequests[0]
data.getBuildsets(buildrequest.buildsetid).then (buildsets) ->
$scope.buildset = buildsets[0]

builder.getBuilds(buildnumber + 1).then (builds) ->
$scope.nextbuild = builds[0]
16 changes: 13 additions & 3 deletions www/base/src/app/builders/builds/build.tpl.jade
Expand Up @@ -3,11 +3,14 @@
nav
ul.pager
li.previous(ng-class="{'disabled': build.number == 1}")
a(ng-if="build.number > 1 ", ui-sref="build({build:build.number - 1})") ← Previous
a(ng-if="build.number > 1 ", ui-sref="build({build:prevbuild.number})")
span.badge-status(ng-class="results2class(prevbuild, 'pulse')") ←
|  Previous
span(ng-if="build.number == 1") ← Previous
li(ng-if="build.complete" title="{{ build.complete_at | dateformat:'LLL' }}") Finished {{ build.complete_at | timeago }}
li.next(ng-class="{'disabled': last_build}")
a(ng-if="!last_build", ui-sref="build({build:build.number + 1})") Next →
a(ng-if="!last_build", ui-sref="build({build:nextbuild.number})") Next 
span.badge-status(ng-class="results2class(nextbuild, 'pulse')") →
span(ng-if="last_build") Next →
.row
.col-sm-5
Expand All @@ -29,7 +32,14 @@
td.text-center {{ value[0] }}
td.text-right {{ value[1] }}
tab(heading="{{buildslave.name}}")
rawdata(data="buildslave")
table.table.table-hover.table-striped.table-condensed
tbody
tr
td.text-left name
td.text-center {{buildslave.name}}
tr(ng-repeat="(name, value) in buildslave.slaveinfo")
td.text-left {{ name }}
td.text-right {{ value }}
tab(heading="Responsible Users")
ul.list-group
li.list-group-item(ng-repeat="(author, email) in responsibles")
Expand Down
11 changes: 7 additions & 4 deletions www/base/src/app/common/filters/publicFields.filter.coffee
@@ -1,7 +1,10 @@
class PublicFields extends Filter('common')
constructor: ->
return (object) ->
copy = angular.copy(object)
for k of object
if k.indexOf('_') == 0 then delete copy[k]
return object
if not object?
return object
object._publicfields ?= {}
for k, v of object
if k.indexOf('_') != 0 and object.hasOwnProperty(k)
object._publicfields[k] = v
return object._publicfields
7 changes: 0 additions & 7 deletions www/data_module/src/data.config.coffee
Expand Up @@ -4,10 +4,3 @@ class HttpConfig extends Config
# of multiple http responses received at around
# the same time via $rootScope.$applyAsync
$httpProvider.useApplyAsync(true)
### @ngInject ###
$httpProvider.interceptors.push ($log, API) ->
return request: (config) ->
# log API request only
if config.url.indexOf(API) is 0
$log.debug("#{config.method} #{config.url}")
return config
3 changes: 0 additions & 3 deletions www/data_module/src/services/socket/socket.service.coffee
Expand Up @@ -19,7 +19,6 @@ class Socket extends Service
@socket.onmessage = (message) =>
try
data = angular.fromJson(message.data)
$log.debug('WS message', data)

# response message
if data._id?
Expand Down Expand Up @@ -49,7 +48,6 @@ class Socket extends Service
data = angular.toJson(data)
# ReconnectingWebSocket does not put status constants on instance
if @socket.readyState is (@socket.OPEN or 1)
$log.debug 'WS send', angular.fromJson(data)
@socket.send(data)
else
# if the WebSocket is not open yet, add the data to the queue
Expand All @@ -61,7 +59,6 @@ class Socket extends Service
flush: ->
# send all the data waiting in the queue
while data = @queue.shift()
$log.debug 'WS send', angular.fromJson(data)
@socket.send(data)

nextId: ->
Expand Down

0 comments on commit 6a662c1

Please sign in to comment.