mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-27 14:13:08 +00:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { computed, ref } from 'vue';
|
|
import { defineStore } from 'pinia';
|
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
|
import type { INodeUi, XYPosition } from '@/Interface';
|
|
import { useLoadingService } from '@/composables/useLoadingService';
|
|
|
|
export const useCanvasStore = defineStore('canvas', () => {
|
|
const workflowStore = useWorkflowsStore();
|
|
const loadingService = useLoadingService();
|
|
|
|
const newNodeInsertPosition = ref<XYPosition | null>(null);
|
|
const nodes = computed<INodeUi[]>(() => workflowStore.allNodes);
|
|
const aiNodes = computed<INodeUi[]>(() =>
|
|
nodes.value.filter((node) => node.type.includes('langchain')),
|
|
);
|
|
const hasRangeSelection = ref(false);
|
|
|
|
function setHasRangeSelection(value: boolean) {
|
|
hasRangeSelection.value = value;
|
|
}
|
|
|
|
return {
|
|
newNodeInsertPosition,
|
|
isLoading: loadingService.isLoading,
|
|
aiNodes,
|
|
hasRangeSelection: computed(() => hasRangeSelection.value),
|
|
startLoading: loadingService.startLoading,
|
|
setLoadingText: loadingService.setLoadingText,
|
|
stopLoading: loadingService.stopLoading,
|
|
setHasRangeSelection,
|
|
};
|
|
});
|