mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
fix: Adjust telemetry from canvas (no-changelog) (#8252)
This commit is contained in:
parent
90c065e999
commit
7899f7aca5
|
@ -5,9 +5,13 @@ import { useI18n } from '@/composables/useI18n';
|
||||||
import N8nHeading from 'n8n-design-system/components/N8nHeading';
|
import N8nHeading from 'n8n-design-system/components/N8nHeading';
|
||||||
import AppsRequiringCredsNotice from '@/views/SetupWorkflowFromTemplateView/AppsRequiringCredsNotice.vue';
|
import AppsRequiringCredsNotice from '@/views/SetupWorkflowFromTemplateView/AppsRequiringCredsNotice.vue';
|
||||||
import SetupTemplateFormStep from '@/views/SetupWorkflowFromTemplateView/SetupTemplateFormStep.vue';
|
import SetupTemplateFormStep from '@/views/SetupWorkflowFromTemplateView/SetupTemplateFormStep.vue';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted, onUnmounted } from 'vue';
|
||||||
|
import { useTelemetry } from '@/composables/useTelemetry';
|
||||||
|
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||||
|
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
const telemetry = useTelemetry();
|
||||||
|
const workflowStore = useWorkflowsStore();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modalName: string;
|
modalName: string;
|
||||||
|
@ -17,6 +21,7 @@ const props = defineProps<{
|
||||||
const {
|
const {
|
||||||
appCredentials,
|
appCredentials,
|
||||||
credentialUsages,
|
credentialUsages,
|
||||||
|
numFilledCredentials,
|
||||||
selectedCredentialIdByKey,
|
selectedCredentialIdByKey,
|
||||||
setInitialCredentialSelection,
|
setInitialCredentialSelection,
|
||||||
setCredential,
|
setCredential,
|
||||||
|
@ -25,6 +30,17 @@ const {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setInitialCredentialSelection();
|
setInitialCredentialSelection();
|
||||||
|
|
||||||
|
telemetry.track('User opened cred setup', { source: 'canvas' }, { withPostHog: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
telemetry.track('User closed cred setup', {
|
||||||
|
completed: numFilledCredentials.value === credentialUsages.value.length,
|
||||||
|
creds_filled: numFilledCredentials.value,
|
||||||
|
creds_needed: credentialUsages.value.length,
|
||||||
|
workflow_id: workflowStore.workflowId,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -407,11 +407,11 @@ export const listenForCredentialChanges = (opts: {
|
||||||
onCredentialCreated?: (credential: ICredentialsResponse) => void;
|
onCredentialCreated?: (credential: ICredentialsResponse) => void;
|
||||||
onCredentialUpdated?: (credential: ICredentialsResponse) => void;
|
onCredentialUpdated?: (credential: ICredentialsResponse) => void;
|
||||||
onCredentialDeleted?: (credentialId: string) => void;
|
onCredentialDeleted?: (credentialId: string) => void;
|
||||||
}): void => {
|
}) => {
|
||||||
const { store, onCredentialCreated, onCredentialDeleted, onCredentialUpdated } = opts;
|
const { store, onCredentialCreated, onCredentialDeleted, onCredentialUpdated } = opts;
|
||||||
const listeningForActions = ['createNewCredential', 'updateCredential', 'deleteCredential'];
|
const listeningForActions = ['createNewCredential', 'updateCredential', 'deleteCredential'];
|
||||||
|
|
||||||
store.$onAction((result) => {
|
return store.$onAction((result) => {
|
||||||
const { name, after, args } = result;
|
const { name, after, args } = result;
|
||||||
after(async (returnValue) => {
|
after(async (returnValue) => {
|
||||||
if (!listeningForActions.includes(name)) {
|
if (!listeningForActions.includes(name)) {
|
||||||
|
|
|
@ -629,11 +629,11 @@ export const listenForModalChanges = (opts: {
|
||||||
store: UiStore;
|
store: UiStore;
|
||||||
onModalOpened?: (name: keyof Modals) => void;
|
onModalOpened?: (name: keyof Modals) => void;
|
||||||
onModalClosed?: (name: keyof Modals) => void;
|
onModalClosed?: (name: keyof Modals) => void;
|
||||||
}): void => {
|
}) => {
|
||||||
const { store, onModalClosed, onModalOpened } = opts;
|
const { store, onModalClosed, onModalOpened } = opts;
|
||||||
const listeningForActions = ['openModal', 'openModalWithData', 'closeModal'];
|
const listeningForActions = ['openModal', 'openModalWithData', 'closeModal'];
|
||||||
|
|
||||||
store.$onAction((result) => {
|
return store.$onAction((result) => {
|
||||||
const { name, after, args } = result;
|
const { name, after, args } = result;
|
||||||
after(async () => {
|
after(async () => {
|
||||||
if (!listeningForActions.includes(name)) {
|
if (!listeningForActions.includes(name)) {
|
||||||
|
|
|
@ -68,8 +68,12 @@ async function openTemplateCredentialSetup(opts: {
|
||||||
templateId: string;
|
templateId: string;
|
||||||
router: Router;
|
router: Router;
|
||||||
inNewBrowserTab?: boolean;
|
inNewBrowserTab?: boolean;
|
||||||
|
telemetry: Telemetry;
|
||||||
|
source: string;
|
||||||
}) {
|
}) {
|
||||||
const { router, templateId, inNewBrowserTab = false } = opts;
|
const { router, templateId, inNewBrowserTab = false, telemetry, source } = opts;
|
||||||
|
|
||||||
|
telemetry.track('User opened cred setup', { source }, { withPostHog: true });
|
||||||
|
|
||||||
const routeLocation: RouteLocationRaw = {
|
const routeLocation: RouteLocationRaw = {
|
||||||
name: VIEWS.TEMPLATE_SETUP,
|
name: VIEWS.TEMPLATE_SETUP,
|
||||||
|
@ -152,6 +156,7 @@ export async function useTemplateWorkflow(opts: {
|
||||||
router: Router;
|
router: Router;
|
||||||
inNewBrowserTab?: boolean;
|
inNewBrowserTab?: boolean;
|
||||||
telemetry: Telemetry;
|
telemetry: Telemetry;
|
||||||
|
source: string;
|
||||||
}) {
|
}) {
|
||||||
const { nodeTypesStore, posthogStore, templateId, templatesStore } = opts;
|
const { nodeTypesStore, posthogStore, templateId, templatesStore } = opts;
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,7 @@ setupTemplateStore.setTemplateId(templateId.value);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await setupTemplateStore.init();
|
await setupTemplateStore.init();
|
||||||
const wasSkipped = await skipIfTemplateHasNoCreds();
|
await skipIfTemplateHasNoCreds();
|
||||||
if (!wasSkipped) {
|
|
||||||
telemetry.track('User opened cred setup', undefined, {
|
|
||||||
withPostHog: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//#endregion Lifecycle hooks
|
//#endregion Lifecycle hooks
|
||||||
|
|
|
@ -162,6 +162,7 @@ export default defineComponent({
|
||||||
externalHooks: this.externalHooks,
|
externalHooks: this.externalHooks,
|
||||||
nodeTypesStore: useNodeTypesStore(),
|
nodeTypesStore: useNodeTypesStore(),
|
||||||
telemetry: this.$telemetry,
|
telemetry: this.$telemetry,
|
||||||
|
source: 'template_list',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
navigateTo(e: MouseEvent, page: string, id: string) {
|
navigateTo(e: MouseEvent, page: string, id: string) {
|
||||||
|
|
|
@ -141,6 +141,7 @@ export default defineComponent({
|
||||||
nodeTypesStore: useNodeTypesStore(),
|
nodeTypesStore: useNodeTypesStore(),
|
||||||
telemetry: this.$telemetry,
|
telemetry: this.$telemetry,
|
||||||
templatesStore: useTemplatesStore(),
|
templatesStore: useTemplatesStore(),
|
||||||
|
source: 'template_preview',
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onHidePreview() {
|
onHidePreview() {
|
||||||
|
|
Loading…
Reference in a new issue