diff --git a/web/src/containers/build/Buildset.jsx b/web/src/containers/build/Buildset.jsx index 3b3765e571..0701960150 100644 --- a/web/src/containers/build/Buildset.jsx +++ b/web/src/containers/build/Buildset.jsx @@ -51,8 +51,13 @@ function getRefs(buildset) { return 'refs' in buildset ? buildset.refs : [buildset] } +function getRef(buildset) { + return 'refs' in buildset ? buildset.refs[0] : buildset +} + function Buildset({ buildset, timezone, tenant, user, preferences }) { const [isGanttChartModalOpen, setIsGanttChartModalOpen] = useState(false) + const ref = getRef(buildset) function renderBuildTimes() { const firstStartBuild = buildset.builds.reduce((prev, cur) => @@ -181,9 +186,9 @@ function Buildset({ buildset, timezone, tenant, user, preferences }) { function enqueueConfirm() { setShowEnqueueModal(false) - if (buildset.change === null) { - enqueue_ref(tenant.apiPrefix, buildset.project, buildset.pipeline, - buildset.ref, buildset.oldrev, buildset.newrev) + if (ref.change === null) { + enqueue_ref(tenant.apiPrefix, ref.project, buildset.pipeline, + ref.ref, ref.oldrev, ref.newrev) .then(() => { dispatch(addNotification( { @@ -197,12 +202,12 @@ function Buildset({ buildset, timezone, tenant, user, preferences }) { dispatch(addApiError(error)) }) } else { - const changeId = buildset.change + ',' + buildset.patchset - enqueue(tenant.apiPrefix, buildset.project, buildset.pipeline, changeId) + const changeId = ref.change + ',' + ref.patchset + enqueue(tenant.apiPrefix, ref.project, ref.pipeline, changeId) .then(() => { dispatch(addNotification( { - text: 'Change queued successfully.', + text: 'Change enqueued successfully.', type: 'success', status: '', url: '', @@ -215,10 +220,10 @@ function Buildset({ buildset, timezone, tenant, user, preferences }) { } function renderEnqueueModal() { - let changeId = buildset.change ? buildset.change + ',' + buildset.patchset : buildset.newrev + let changeId = ref.change ? ref.change + ',' + ref.patchset : ref.newrev let changeInfo = changeId ? <>for change {changeId} - : <>for ref {buildset.ref} + : <>for ref {ref.ref} const title = 'You are about to re-enqueue a change' return ( Confirm, , ]}> -

Please confirm that you want to re-enqueue all jobs {changeInfo} on project {buildset.project} on pipeline {buildset.pipeline}.

+

Please confirm that you want to re-enqueue all jobs {changeInfo} on project {ref.project} on pipeline {buildset.pipeline}.

) }