mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-07 07:59:36 +00:00
58838f225c
Rewrite of the UI using Typescript, Vue3, Windicss and Vite. The design should be close to the current one with some changes: - latest pipeline in a sidebar on the right - secrets and registry as part of the repo-settings (secrets and registry entries shouldn't be used as much so they can be "hidden" under settings IMO) - start page shows list of active repositories with button to enable / add new ones (currently you see all repositories and in most cases you only add new repositories once in a while)
43 lines
974 B
TypeScript
43 lines
974 B
TypeScript
import BuildStore from '~/store/builds';
|
|
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 buildStore = BuildStore();
|
|
|
|
initialized = true;
|
|
|
|
apiClient.on((data) => {
|
|
// contains repo update
|
|
if (!data.repo) {
|
|
return;
|
|
}
|
|
const { repo } = data;
|
|
repoStore.setRepo(repo);
|
|
|
|
// contains build update
|
|
if (!data.build) {
|
|
return;
|
|
}
|
|
const { build } = data;
|
|
buildStore.setBuild(repo.owner, repo.name, build);
|
|
buildStore.setBuildFeedItem({ ...build, name: repo.name, owner: repo.owner, full_name: repoSlug(repo) });
|
|
|
|
// contains proc update
|
|
if (!data.proc) {
|
|
return;
|
|
}
|
|
const { proc } = data;
|
|
buildStore.setProc(repo.owner, repo.name, build.number, proc);
|
|
});
|
|
};
|