2024-07-18 09:01:14 -07:00
|
|
|
/**
|
|
|
|
* Canvas V2 Only
|
|
|
|
* @TODO Remove this notice when Canvas V2 is the only one in use
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { CanvasNodeHandleKey } from '@/constants';
|
|
|
|
import { computed, inject } from 'vue';
|
|
|
|
import { NodeConnectionType } from 'n8n-workflow';
|
|
|
|
import { CanvasConnectionMode } from '@/types';
|
|
|
|
|
|
|
|
export function useCanvasNodeHandle() {
|
|
|
|
const handle = inject(CanvasNodeHandleKey);
|
|
|
|
|
|
|
|
const label = computed(() => handle?.label.value ?? '');
|
2024-08-26 00:32:39 -07:00
|
|
|
const isConnected = computed(() => handle?.isConnected.value ?? false);
|
|
|
|
const isConnecting = computed(() => handle?.isConnecting.value ?? false);
|
2024-07-18 09:01:14 -07:00
|
|
|
const type = computed(() => handle?.type.value ?? NodeConnectionType.Main);
|
|
|
|
const mode = computed(() => handle?.mode.value ?? CanvasConnectionMode.Input);
|
2024-09-05 22:54:54 -07:00
|
|
|
const isReadOnly = computed(() => handle?.isReadOnly.value);
|
2024-07-18 09:01:14 -07:00
|
|
|
|
|
|
|
return {
|
|
|
|
label,
|
2024-08-26 00:32:39 -07:00
|
|
|
isConnected,
|
|
|
|
isConnecting,
|
2024-09-05 22:54:54 -07:00
|
|
|
isReadOnly,
|
2024-07-18 09:01:14 -07:00
|
|
|
type,
|
|
|
|
mode,
|
|
|
|
};
|
|
|
|
}
|