2022-10-18 01:24:12 +00:00
|
|
|
import { computed, toRef } from 'vue';
|
|
|
|
|
|
|
|
import useUserConfig from '~/compositions/useUserConfig';
|
2023-01-31 08:37:11 +00:00
|
|
|
import { usePipelineStore } from '~/store/pipelines';
|
2022-10-18 01:24:12 +00:00
|
|
|
|
|
|
|
import useAuthentication from './useAuthentication';
|
|
|
|
|
|
|
|
const { userConfig, setUserConfig } = useUserConfig();
|
|
|
|
|
|
|
|
export default () => {
|
2023-01-31 08:37:11 +00:00
|
|
|
const pipelineStore = usePipelineStore();
|
2022-10-18 01:24:12 +00:00
|
|
|
const { isAuthenticated } = useAuthentication();
|
|
|
|
|
|
|
|
const isOpen = computed(() => userConfig.value.isPipelineFeedOpen && !!isAuthenticated);
|
|
|
|
|
|
|
|
function toggle() {
|
|
|
|
setUserConfig('isPipelineFeedOpen', !userConfig.value.isPipelineFeedOpen);
|
|
|
|
}
|
|
|
|
|
2023-09-07 20:28:36 +00:00
|
|
|
function close() {
|
|
|
|
setUserConfig('isPipelineFeedOpen', false);
|
|
|
|
}
|
|
|
|
|
2023-01-31 08:37:11 +00:00
|
|
|
const sortedPipelines = toRef(pipelineStore, 'pipelineFeed');
|
2022-10-18 01:24:12 +00:00
|
|
|
const activePipelines = toRef(pipelineStore, 'activePipelines');
|
|
|
|
|
|
|
|
return {
|
|
|
|
toggle,
|
2023-09-07 20:28:36 +00:00
|
|
|
close,
|
2022-10-18 01:24:12 +00:00
|
|
|
isOpen,
|
|
|
|
sortedPipelines,
|
|
|
|
activePipelines,
|
|
|
|
load: pipelineStore.loadPipelineFeed,
|
|
|
|
};
|
|
|
|
};
|