yocto_console_view: Only request properties for running builds which don't have them

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2018-11-16 13:49:59 +00:00
parent 81273de5ac
commit a60c841a49
2 changed files with 24 additions and 14 deletions

View File

@ -89,22 +89,32 @@ class Console extends Controller
@builds.onChange = @changes.onChange = @buildrequests.onChange = @buildsets.onChange = @onChange @builds.onChange = @changes.onChange = @buildrequests.onChange = @buildsets.onChange = @onChange
@builds.onNew = (build) => @builds.onNew = (build) =>
build.getProperties().onChange = (properties) => change = false
change = false buildid = build.buildid
buildid = properties.endpoint.split('/')[1] if build.properties?.yp_build_revision?
if ! @revmapping[buildid] @revmapping[build.buildid] = build.properties.yp_build_revision[0]
rev = @getBuildProperty(properties[0], 'yp_build_revision') change = true
if rev? if build.properties?.yp_build_branch?
@revmapping[buildid] = rev @branchmapping[build.buildid] = build.properties.yp_build_branch[0]
change = true change = true
if ! @branchmapping[buildid] if (! @revmapping[buildid] || ! @branchmapping[buildid]) && ! build.complete_at
branch = @getBuildProperty(properties[0], 'yp_build_branch') build.getProperties().onChange = (properties) =>
if branch? change = false
@branchmapping[buildid] = branch buildid = properties.endpoint.split('/')[1]
if ! @revmapping[buildid]
rev = @getBuildProperty(properties[0], 'yp_build_revision')
if rev?
@revmapping[buildid] = rev
change = true
if ! @branchmapping[buildid]
branch = @getBuildProperty(properties[0], 'yp_build_branch')
if branch?
@branchmapping[buildid] = branch
change = true change = true
if change and not @onchange_debounce? if change and not @onchange_debounce?
@onchange_debounce = @$timeout(@_onChange, 100) @onchange_debounce = @$timeout(@_onChange, 100)
if change and not @onchange_debounce?
@onchange_debounce = @$timeout(@_onChange, 100)
getBuildProperty: (properties, property) -> getBuildProperty: (properties, property) ->
hasProperty = properties && properties.hasOwnProperty(property) hasProperty = properties && properties.hasOwnProperty(property)

File diff suppressed because one or more lines are too long