mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
refactor(editor): Add telemetry for workflow history (no-changelog) (#8072)
https://linear.app/n8n/issue/PAY-1142
This commit is contained in:
parent
73d400a1bf
commit
62ce962ec9
|
@ -18,6 +18,7 @@ import { useWorkflowHistoryStore } from '@/stores/workflowHistory.store';
|
|||
import { useUIStore } from '@/stores/ui.store';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { telemetry } from '@/plugins/telemetry';
|
||||
import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
|
||||
type WorkflowHistoryActionRecord = {
|
||||
[K in Uppercase<WorkflowHistoryActionTypes[number]>]: Lowercase<K>;
|
||||
|
@ -76,6 +77,7 @@ const evaluatedPruneTime = computed(() => Math.floor(workflowHistoryStore.evalua
|
|||
|
||||
const sendTelemetry = (event: string) => {
|
||||
telemetry.track(event, {
|
||||
instance_id: useRootStore().instanceId,
|
||||
workflow_id: route.params.workflowId,
|
||||
});
|
||||
};
|
||||
|
|
|
@ -107,6 +107,7 @@ describe('WorkflowHistory', () => {
|
|||
params: { workflowId, versionId: versionData.versionId },
|
||||
});
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User opened workflow history', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -124,6 +125,7 @@ describe('WorkflowHistory', () => {
|
|||
await waitFor(() => {
|
||||
expect(router.replace).not.toHaveBeenCalled();
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User selected version', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -142,6 +144,7 @@ describe('WorkflowHistory', () => {
|
|||
params: { workflowId, versionId },
|
||||
});
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User selected version', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -159,6 +162,7 @@ describe('WorkflowHistory', () => {
|
|||
params: { workflowId, versionId },
|
||||
});
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User opened version in new tab', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -180,6 +184,7 @@ describe('WorkflowHistory', () => {
|
|||
params: { workflowId, versionId },
|
||||
});
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User opened version in new tab', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -202,6 +207,7 @@ describe('WorkflowHistory', () => {
|
|||
params: { name: newWorkflowId },
|
||||
});
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User cloned version', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
@ -217,6 +223,7 @@ describe('WorkflowHistory', () => {
|
|||
|
||||
await waitFor(() => {
|
||||
expect(telemetry.track).toHaveBeenCalledWith('User downloaded version', {
|
||||
instance_id: '',
|
||||
workflow_id: workflowId,
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue