mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
feat(editor): Add more telemetry for workflow inputs (no-changelog) (#12862)
This commit is contained in:
parent
eabf160957
commit
6dd90c8764
|
@ -18,6 +18,9 @@ import {
|
|||
} from 'n8n-design-system';
|
||||
import ParameterInputList from './ParameterInputList.vue';
|
||||
import Draggable from 'vuedraggable';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useNDVStore } from '@/stores/ndv.store';
|
||||
import { telemetry } from '@/plugins/telemetry';
|
||||
|
||||
const locale = useI18n();
|
||||
|
||||
|
@ -44,6 +47,9 @@ const emit = defineEmits<{
|
|||
valueChanged: [value: ValueChangedEvent];
|
||||
}>();
|
||||
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const ndvStore = useNDVStore();
|
||||
|
||||
const getPlaceholderText = computed(() => {
|
||||
const placeholder = locale.nodeText().placeholder(props.parameter, props.path);
|
||||
return placeholder ? placeholder : locale.baseText('fixedCollectionParameter.choose');
|
||||
|
@ -127,6 +133,13 @@ const getOptionProperties = (optionName: string) => {
|
|||
return undefined;
|
||||
};
|
||||
|
||||
const onAddButtonClick = (optionName: string) => {
|
||||
optionSelected(optionName);
|
||||
if (props.parameter.name === 'workflowInputs') {
|
||||
trackWorkflowInputFieldAdded();
|
||||
}
|
||||
};
|
||||
|
||||
const optionSelected = (optionName: string) => {
|
||||
const option = getOptionProperties(optionName);
|
||||
if (option === undefined) {
|
||||
|
@ -183,6 +196,9 @@ const optionSelected = (optionName: string) => {
|
|||
|
||||
const valueChanged = (parameterData: IUpdateInformation) => {
|
||||
emit('valueChanged', parameterData);
|
||||
if (props.parameter.name === 'workflowInputs') {
|
||||
trackWorkflowInputFieldTypeChange(parameterData);
|
||||
}
|
||||
};
|
||||
const onDragChange = (optionName: string) => {
|
||||
const parameterData: ValueChangedEvent = {
|
||||
|
@ -193,6 +209,21 @@ const onDragChange = (optionName: string) => {
|
|||
|
||||
emit('valueChanged', parameterData);
|
||||
};
|
||||
|
||||
const trackWorkflowInputFieldTypeChange = (parameterData: IUpdateInformation) => {
|
||||
telemetry.track('User changed workflow input field type', {
|
||||
type: parameterData.value,
|
||||
workflow_id: workflowsStore.workflow.id,
|
||||
node_id: ndvStore.activeNode?.id,
|
||||
});
|
||||
};
|
||||
|
||||
const trackWorkflowInputFieldAdded = () => {
|
||||
telemetry.track('User added workflow input field', {
|
||||
workflow_id: workflowsStore.workflow.id,
|
||||
node_id: ndvStore.activeNode?.id,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -305,7 +336,7 @@ const onDragChange = (optionName: string) => {
|
|||
block
|
||||
data-test-id="fixed-collection-add"
|
||||
:label="getPlaceholderText"
|
||||
@click="optionSelected(parameter.options[0].name)"
|
||||
@click="onAddButtonClick(parameter.options[0].name)"
|
||||
/>
|
||||
<div v-else class="add-option">
|
||||
<N8nSelect
|
||||
|
|
|
@ -837,6 +837,25 @@ function valueChanged(value: NodeParameterValueType | {} | Date) {
|
|||
parameter: props.parameter.name,
|
||||
});
|
||||
}
|
||||
// Track workflow input data mode change
|
||||
const isWorkflowInputParameter =
|
||||
props.parameter.name === 'inputSource' && props.parameter.default === 'workflowInputs';
|
||||
if (isWorkflowInputParameter) {
|
||||
trackWorkflowInputModeEvent(value as string);
|
||||
}
|
||||
}
|
||||
|
||||
function trackWorkflowInputModeEvent(value: string) {
|
||||
const telemetryValuesMap: Record<string, string> = {
|
||||
workflowInputs: 'fields',
|
||||
jsonExample: 'json',
|
||||
passthrough: 'all',
|
||||
};
|
||||
telemetry.track('User chose input data mode', {
|
||||
option: telemetryValuesMap[value],
|
||||
workflow_id: workflowsStore.workflowId,
|
||||
node_id: node.value?.id,
|
||||
});
|
||||
}
|
||||
|
||||
async function optionSelected(command: string) {
|
||||
|
|
Loading…
Reference in a new issue