You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-11-23 21:44:44 +02:00
Renamed procs/jobs to steps in code (#1331)
Renamed `procs` to `steps` in code for the issue #1288 Co-authored-by: Harikesh Prajapati <harikesh.prajapati@druva.com> Co-authored-by: qwerty287 <ndev@web.de> Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -1,40 +1,40 @@
|
||||
import { Pipeline, PipelineProc, Repo } from '~/lib/api/types';
|
||||
import { Pipeline, PipelineStep, Repo } from '~/lib/api/types';
|
||||
|
||||
export function findProc(procs: PipelineProc[], pid: number): PipelineProc | undefined {
|
||||
return procs.reduce((prev, proc) => {
|
||||
if (proc.pid === pid) {
|
||||
return proc;
|
||||
export function findStep(steps: PipelineStep[], pid: number): PipelineStep | undefined {
|
||||
return steps.reduce((prev, step) => {
|
||||
if (step.pid === pid) {
|
||||
return step;
|
||||
}
|
||||
|
||||
if (proc.children) {
|
||||
const result = findProc(proc.children, pid);
|
||||
if (step.children) {
|
||||
const result = findStep(step.children, pid);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return prev;
|
||||
}, undefined as PipelineProc | undefined);
|
||||
}, undefined as PipelineStep | undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the process is in a completed state.
|
||||
*
|
||||
* @param {Object} proc - The process object.
|
||||
* @param {Object} step - The process object.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isProcFinished(proc: PipelineProc): boolean {
|
||||
return proc.state !== 'running' && proc.state !== 'pending';
|
||||
export function isStepFinished(step: PipelineStep): boolean {
|
||||
return step.state !== 'running' && step.state !== 'pending';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the process is running.
|
||||
*
|
||||
* @param {Object} proc - The process object.
|
||||
* @param {Object} step - The process object.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isProcRunning(proc: PipelineProc): boolean {
|
||||
return proc.state === 'running';
|
||||
export function isStepRunning(step: PipelineStep): boolean {
|
||||
return step.state === 'running';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user