mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-16 13:36:33 +00:00
718ec6141c
[record.webm](https://github.com/woodpecker-ci/woodpecker/assets/3391958/f797be2c-09a9-4699-be85-7d5925e146ed) --------- Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
35 lines
924 B
TypeScript
35 lines
924 B
TypeScript
import { computed, toRef } from 'vue';
|
|
|
|
import useUserConfig from '~/compositions/useUserConfig';
|
|
import { usePipelineStore } from '~/store/pipelines';
|
|
|
|
import useAuthentication from './useAuthentication';
|
|
|
|
const { userConfig, setUserConfig } = useUserConfig();
|
|
|
|
export default () => {
|
|
const pipelineStore = usePipelineStore();
|
|
const { isAuthenticated } = useAuthentication();
|
|
|
|
const isOpen = computed(() => userConfig.value.isPipelineFeedOpen && !!isAuthenticated);
|
|
|
|
function toggle() {
|
|
setUserConfig('isPipelineFeedOpen', !userConfig.value.isPipelineFeedOpen);
|
|
}
|
|
|
|
function close() {
|
|
setUserConfig('isPipelineFeedOpen', false);
|
|
}
|
|
|
|
const sortedPipelines = toRef(pipelineStore, 'pipelineFeed');
|
|
const activePipelines = toRef(pipelineStore, 'activePipelines');
|
|
|
|
return {
|
|
toggle,
|
|
close,
|
|
isOpen,
|
|
sortedPipelines,
|
|
activePipelines,
|
|
load: pipelineStore.loadPipelineFeed,
|
|
};
|
|
};
|