mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-05-02 14:28:43 +00:00
36e42914fa
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>
43 lines
1,019 B
TypeScript
43 lines
1,019 B
TypeScript
import PipelineStore from '~/store/pipelines';
|
|
import RepoStore from '~/store/repos';
|
|
import { repoSlug } from '~/utils/helpers';
|
|
|
|
import useApiClient from './useApiClient';
|
|
|
|
const apiClient = useApiClient();
|
|
let initialized = false;
|
|
|
|
export default () => {
|
|
if (initialized) {
|
|
return;
|
|
}
|
|
const repoStore = RepoStore();
|
|
const pipelineStore = PipelineStore();
|
|
|
|
initialized = true;
|
|
|
|
apiClient.on((data) => {
|
|
// contains repo update
|
|
if (!data.repo) {
|
|
return;
|
|
}
|
|
const { repo } = data;
|
|
repoStore.setRepo(repo);
|
|
|
|
// contains pipeline update
|
|
if (!data.pipeline) {
|
|
return;
|
|
}
|
|
const { pipeline } = data;
|
|
pipelineStore.setPipeline(repo.owner, repo.name, pipeline);
|
|
pipelineStore.setPipelineFeedItem({ ...pipeline, name: repo.name, owner: repo.owner, full_name: repoSlug(repo) });
|
|
|
|
// contains step update
|
|
if (!data.step) {
|
|
return;
|
|
}
|
|
const { step } = data;
|
|
pipelineStore.setStep(repo.owner, repo.name, pipeline.number, step);
|
|
});
|
|
};
|