Merge "Display ref instead of NA for time triggered items"

This commit is contained in:
Zuul 2018-11-27 22:34:32 +00:00 committed by Gerrit Code Review
commit 1ac3eb9fb7
3 changed files with 19 additions and 0 deletions

View File

@ -3532,6 +3532,17 @@ class TestScheduler(ZuulTestCase):
# second to settle.
time.sleep(1)
self.waitUntilSettled()
# Ensure that the status json has the ref so we can render it in the
# web ui.
data = json.loads(self.sched.formatStatusJSON('tenant-one'))
pipeline = [x for x in data['pipelines'] if x['name'] == 'periodic'][0]
first = pipeline['change_queues'][0]['heads'][0][0]
second = pipeline['change_queues'][1]['heads'][0][0]
self.assertIn(first['ref'], ['refs/heads/master', 'refs/heads/stable'])
self.assertIn(second['ref'],
['refs/heads/master', 'refs/heads/stable'])
self.executor_server.release()
self.waitUntilSettled()

View File

@ -94,6 +94,10 @@ class ChangePanel extends React.Component {
renderChangeLink (change) {
let changeId = change.id || 'NA'
let changeTitle = changeId
// Fall back to display the ref if there is no change id
if (changeId === 'NA' && change.ref) {
changeTitle = change.ref
}
let changeText = ''
if (change.url !== null) {
let githubId = changeId.match(/^([0-9]+),([0-9a-f]{40})$/)

View File

@ -2348,6 +2348,10 @@ class QueueItem(object):
ret['url'] = self.change.url
else:
ret['url'] = None
if hasattr(self.change, 'ref') and self.change.ref is not None:
ret['ref'] = self.change.ref
else:
ret['ref'] = None
ret['id'] = self.change._id()
if self.item_ahead:
ret['item_ahead'] = self.item_ahead.change._id()