woodpecker/web/src/compositions/useBuildFeed.ts
Anbraten 58838f225c
Rewrite of WebUI (#245)
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)
2021-11-03 17:40:31 +01:00

31 lines
784 B
TypeScript

import { computed, toRef } from 'vue';
import useUserConfig from '~/compositions/useUserConfig';
import BuildStore from '~/store/builds';
import useAuthentication from './useAuthentication';
const { userConfig, setUserConfig } = useUserConfig();
export default () => {
const buildStore = BuildStore();
const { isAuthenticated } = useAuthentication();
const isOpen = computed(() => userConfig.value.isBuildFeedOpen && !!isAuthenticated);
function toggle() {
setUserConfig('isBuildFeedOpen', !userConfig.value.isBuildFeedOpen);
}
const sortedBuilds = toRef(buildStore, 'sortedBuildFeed');
const activeBuilds = toRef(buildStore, 'activeBuilds');
return {
toggle,
isOpen,
sortedBuilds,
activeBuilds,
load: buildStore.loadBuildFeed,
};
};