Browse Source

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

tags/3.3.1
Zuul 5 months ago
parent
commit
1ac3eb9fb7
3 changed files with 19 additions and 0 deletions
  1. 11
    0
      tests/unit/test_scheduler.py
  2. 4
    0
      web/src/containers/status/ChangePanel.jsx
  3. 4
    0
      zuul/model.py

+ 11
- 0
tests/unit/test_scheduler.py View File

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

+ 4
- 0
web/src/containers/status/ChangePanel.jsx View File

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

+ 4
- 0
zuul/model.py View File

@@ -2348,6 +2348,10 @@ class QueueItem(object):
2348 2348
             ret['url'] = self.change.url
2349 2349
         else:
2350 2350
             ret['url'] = None
2351
+        if hasattr(self.change, 'ref') and self.change.ref is not None:
2352
+            ret['ref'] = self.change.ref
2353
+        else:
2354
+            ret['ref'] = None
2351 2355
         ret['id'] = self.change._id()
2352 2356
         if self.item_ahead:
2353 2357
             ret['item_ahead'] = self.item_ahead.change._id()

Loading…
Cancel
Save