mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
feat(editor): Add telemetry event for tidy up feature (no-changelog) (#13831)
This commit is contained in:
@@ -99,6 +99,7 @@ import { useClipboard } from '@/composables/useClipboard';
|
||||
import { useUniqueNodeName } from '@/composables/useUniqueNodeName';
|
||||
import { isPresent } from '../utils/typesUtils';
|
||||
import { useProjectsStore } from '@/stores/projects.store';
|
||||
import type { CanvasLayoutEvent } from './useCanvasLayout';
|
||||
|
||||
type AddNodeData = Partial<INodeUi> & {
|
||||
type: string;
|
||||
@@ -164,6 +165,22 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
* Node operations
|
||||
*/
|
||||
|
||||
function tidyUp({ result, source, target }: CanvasLayoutEvent) {
|
||||
updateNodesPosition(
|
||||
result.nodes.map(({ id, x, y }) => ({ id, position: { x, y } })),
|
||||
{ trackBulk: true, trackHistory: true },
|
||||
);
|
||||
trackTidyUp({ result, source, target });
|
||||
}
|
||||
|
||||
function trackTidyUp({ result, source, target }: CanvasLayoutEvent) {
|
||||
telemetry.track('User tidied up canvas', {
|
||||
source,
|
||||
target,
|
||||
nodes_count: result.nodes.length,
|
||||
});
|
||||
}
|
||||
|
||||
function updateNodesPosition(
|
||||
events: CanvasNodeMoveEvent[],
|
||||
{ trackHistory = false, trackBulk = true } = {},
|
||||
@@ -1995,6 +2012,7 @@ export function useCanvasOperations({ router }: { router: ReturnType<typeof useR
|
||||
revertAddNode,
|
||||
updateNodesPosition,
|
||||
updateNodePosition,
|
||||
tidyUp,
|
||||
revertUpdateNodePosition,
|
||||
setNodeActive,
|
||||
setNodeActiveByName,
|
||||
|
||||
Reference in New Issue
Block a user