Redirect to new pipeline (#1761)

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
Anbraten 2023-05-17 19:33:28 +02:00 committed by GitHub
parent 435f5ae207
commit cfb53cb995
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -124,9 +124,9 @@ export default class WoodpeckerClient extends ApiClient {
repo: string,
pipeline: string,
opts?: Record<string, string | number | boolean>,
): Promise<unknown> {
): Promise<Pipeline> {
const query = encodeQueryString(opts);
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipeline}?${query}`);
return this._post(`/api/repos/${owner}/${repo}/pipelines/${pipeline}?${query}`) as Promise<Pipeline>;
}
getLogs(owner: string, repo: string, pipeline: number, step: number): Promise<PipelineLog[]> {

View file

@ -161,10 +161,14 @@ const { doSubmit: restartPipeline, isLoading: isRestartingPipeline } = useAsyncA
throw new Error('Unexpected: Repo is undefined');
}
await apiClient.restartPipeline(repo.value.owner, repo.value.name, pipelineId.value, { fork: true });
const newPipeline = await apiClient.restartPipeline(repo.value.owner, repo.value.name, pipelineId.value, {
fork: true,
});
notifications.notify({ title: i18n.t('repo.pipeline.actions.restart_success'), type: 'success' });
// TODO: directly send to newest pipeline?
await router.push({ name: 'repo', params: { repoName: repo.value.name, repoOwner: repo.value.owner } });
await router.push({
name: 'repo-pipeline',
params: { pipelineId: newPipeline.number },
});
});
onMounted(loadPipeline);