feat: Add workflow sharing telemetry (#4906)

* feat: Add workflow sharing telemetry

* chore: fix linting issue

* fix: fix telemetry typo
This commit is contained in:
Alex Grozav
2022-12-15 10:05:54 +02:00
committed by GitHub
parent 9956547504
commit ac066fc9f3
7 changed files with 84 additions and 6 deletions

View File

@@ -66,8 +66,10 @@ import { IWorkflowSettings } from 'n8n-workflow';
import { useNDVStore } from '@/stores/ndv';
import { useTemplatesStore } from '@/stores/templates';
import { useNodeTypesStore } from '@/stores/nodeTypes';
import { useWorkflowsEEStore } from "@/stores/workflows.ee";
import { useUsersStore } from "@/stores/users";
import { useUsersStore } from '@/stores/users';
import { useWorkflowsEEStore } from '@/stores/workflows.ee';
import { ICredentialMap, ICredentialsResponse, IUsedCredential } from '@/Interface';
import { getWorkflowPermissions, IPermissions } from '@/permissions';
import { ICredentialsResponse } from '@/Interface';
let cachedWorkflowKey: string | null = '';
@@ -85,6 +87,9 @@ export const workflowHelpers = mixins(externalHooks, nodeHelpers, restApi, showM
useUsersStore,
useUIStore,
),
workflowPermissions(): IPermissions {
return getWorkflowPermissions(this.usersStore.currentUser, this.workflowsStore.workflow);
},
},
methods: {
executeData(
@@ -827,7 +832,15 @@ export const workflowHelpers = mixins(externalHooks, nodeHelpers, restApi, showM
this.uiStore.removeActiveAction('workflowSaving');
if (error.errorCode === 100) {
const url = this.$router.resolve({ name: VIEWS.WORKFLOW, params: { name: currentWorkflow }}).href;
this.$telemetry.track('User attempted to save locked workflow', {
workflowId: currentWorkflow,
sharing_role: this.workflowPermissions.isOwner ? 'owner' : 'sharee',
});
const url = this.$router.resolve({
name: VIEWS.WORKFLOW,
params: { name: currentWorkflow },
}).href;
const overwrite = await this.confirmMessage(
this.$locale.baseText('workflows.concurrentChanges.confirmMessage.message', {