Display ref instead of NA for time triggered items

Currently time triggered items show up as 'NA' in the status ui. If we
want to dequeue such an item we need the ref which is not existing
anywere in the status, not even in the pure json. So add the ref if
it's there and display the ref instead of 'NA' in the status ui if the
ref is set.

Change-Id: Iedae91d96ab91f4b4131da66ee317072f38e376b
This commit is contained in:
Tobias Henkel 2018-11-21 15:01:10 +01:00
parent 33699fa316
commit 6e940f0b72
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

@ -2325,6 +2325,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()