summaryrefslogtreecommitdiff
path: root/web/src/containers/build/Buildset.jsx
diff options
context:
space:
mode:
authorMatthieu Huin <mhuin@redhat.com>2022-02-24 17:01:39 +0100
committerMatthieu Huin <mhuin@redhat.com>2022-02-24 17:24:32 +0100
commit115094f46afb232305da38faf0aa74f3a0996ce6 (patch)
treeec4d22a8e4421ed088d48d807276fa5360ac81b0 /web/src/containers/build/Buildset.jsx
parentd5385d7fc58f98d719ebe981e053ff12e639aed6 (diff)
downloadzuul-115094f46afb232305da38faf0aa74f3a0996ce6.tar.gz
GUI: fix broken enqueue when buildset.newrev is null
Enqueueing would not work properly on pipelines where newrev isn't set. This is the case on periodic pipelines for example. This changes the way we decide whether to use enqueue or enqueue_ref. Change-Id: Ie6563a98ee40a89fbc37c9832f6ac710a57aa4f3
Diffstat (limited to 'web/src/containers/build/Buildset.jsx')
-rw-r--r--web/src/containers/build/Buildset.jsx18
1 files changed, 11 insertions, 7 deletions
diff --git a/web/src/containers/build/Buildset.jsx b/web/src/containers/build/Buildset.jsx
index aeac9c05c..3f7bc41fb 100644
--- a/web/src/containers/build/Buildset.jsx
+++ b/web/src/containers/build/Buildset.jsx
@@ -65,8 +65,8 @@ function Buildset({ buildset, timezone, tenant, user }) {
const overallDuration =
(moment.utc(lastEndBuild.end_time).tz(timezone) -
moment.utc(
- buildset.event_timestamp!=null
- ? buildset.event_timestamp : firstStartBuild.start_time
+ buildset.event_timestamp != null
+ ? buildset.event_timestamp : firstStartBuild.start_time
).tz(timezone)
) / 1000
@@ -177,15 +177,15 @@ function Buildset({ buildset, timezone, tenant, user }) {
}
function enqueueConfirm() {
- let changeId = buildset.change ? buildset.change + ',' + buildset.patchset : buildset.newrev
setShowEnqueueModal(false)
- if (/^[0-9a-f]{40}$/.test(changeId)) {
+ if (buildset.change === null) {
const oldrev = '0000000000000000000000000000000000000000'
- enqueue_ref(tenant.apiPrefix, buildset.project, buildset.pipeline, buildset.ref, oldrev, changeId, user.token)
+ const newrev = buildset.newrev ? buildset.newrev : '0000000000000000000000000000000000000000'
+ enqueue_ref(tenant.apiPrefix, buildset.project, buildset.pipeline, buildset.ref, oldrev, newrev, user.token)
.then(() => {
dispatch(addNotification(
{
- text: 'Change queued successfully.',
+ text: 'Enqueue successful.',
type: 'success',
status: '',
url: '',
@@ -195,6 +195,7 @@ function Buildset({ buildset, timezone, tenant, user }) {
dispatch(addApiError(error))
})
} else {
+ const changeId = buildset.change + ',' + buildset.patchset
enqueue(tenant.apiPrefix, buildset.project, buildset.pipeline, changeId, user.token)
.then(() => {
dispatch(addNotification(
@@ -213,6 +214,9 @@ function Buildset({ buildset, timezone, tenant, user }) {
function renderEnqueueModal() {
let changeId = buildset.change ? buildset.change + ',' + buildset.patchset : buildset.newrev
+ let changeInfo = changeId
+ ? <>for change <strong>{changeId}</strong></>
+ : <>for ref <strong>{buildset.ref}</strong></>
const title = 'You are about to re-enqueue a change'
return (
<Modal
@@ -225,7 +229,7 @@ function Buildset({ buildset, timezone, tenant, user }) {
<Button key="deq_confirm" variant="primary" onClick={enqueueConfirm}>Confirm</Button>,
<Button key="deq_cancel" variant="link" onClick={() => { setShowEnqueueModal(false) }}>Cancel</Button>,
]}>
- <p>Please confirm that you want to re-enqueue <strong>all jobs</strong> for change <strong>{changeId}</strong> (project <strong>{buildset.project}</strong>) on pipeline <strong>{buildset.pipeline}</strong>.</p>
+ <p>Please confirm that you want to re-enqueue <strong>all jobs</strong> {changeInfo} on project <strong>{buildset.project}</strong> on pipeline <strong>{buildset.pipeline}</strong>.</p>
</Modal>
)
}