make pending pipelines cancable (#2013)

in some edgecases we get pipelines that we can not cancle via WebUI.

fix https://codeberg.org/Codeberg-CI/feedback/issues/126
This commit is contained in:
6543 2023-07-18 06:12:17 +02:00 committed by GitHub
parent a890a0d4d4
commit 572449b845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,18 +140,11 @@ const { doSubmit: cancelPipeline, isLoading: isCancelingPipeline } = useAsyncAct
throw new Error('Unexpected: Repo is undefined'); throw new Error('Unexpected: Repo is undefined');
} }
if (!pipeline.value?.workflows) { if (!pipeline.value?.number) {
throw new Error('Unexpected: Pipeline steps not loaded'); throw new Error('Unexpected: Pipeline number not found');
} }
// TODO: is selectedStepId right? await apiClient.cancelPipeline(repo.value.id, pipeline.value.number);
// const step = findStep(pipeline.value.steps, selectedStepId.value || 2);
// if (!step) {
// throw new Error('Unexpected: Step not found');
// }
await apiClient.cancelPipeline(repo.value.id, parseInt(pipelineId.value, 10));
notifications.notify({ title: i18n.t('repo.pipeline.actions.cancel_success'), type: 'success' }); notifications.notify({ title: i18n.t('repo.pipeline.actions.cancel_success'), type: 'success' });
}); });