Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Add telemetry to resource moving #9720

Merged
merged 4 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/CredentialCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CREDENTIAL_LIST_ITEM_ACTIONS = {
const props = withDefaults(
defineProps<{
data: ICredentialsResponse;
readOnly: boolean;
readOnly?: boolean;
}>(),
{
data: () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useProjectsStore } from '@/stores/projects.store';
import Modal from '@/components/Modal.vue';
import { N8nCheckbox, N8nText } from 'n8n-design-system';
import { useToast } from '@/composables/useToast';
import { useTelemetry } from '@/composables/useTelemetry';

const props = defineProps<{
modalName: string;
Expand All @@ -21,6 +22,7 @@ const i18n = useI18n();
const toast = useToast();
const uiStore = useUIStore();
const projectsStore = useProjectsStore();
const telemetry = useTelemetry();

const checks = ref([false, false]);
const allChecked = computed(() => checks.value.every(Boolean));
Expand All @@ -43,6 +45,10 @@ const confirm = async () => {
props.data.projectId,
);
closeModal();
telemetry.track(`User successfully moved ${props.data.resourceType}`, {
[`${props.data.resourceType}_id`]: props.data.resource.id,
project_from_type: projectsStore.currentProject?.type ?? projectsStore.personalProject?.type,
});
} catch (error) {
toast.showError(
error.message,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script lang="ts" setup>
import { ref, computed } from 'vue';
import { ref, computed, onMounted } from 'vue';
import type { ICredentialsResponse, IWorkflowDb } from '@/Interface';
import { useI18n } from '@/composables/useI18n';
import { useUIStore } from '@/stores/ui.store';
import { useProjectsStore } from '@/stores/projects.store';
import Modal from '@/components/Modal.vue';
import { PROJECT_MOVE_RESOURCE_CONFIRM_MODAL } from '@/constants';
import { splitName } from '@/utils/projects.utils';
import { useTelemetry } from '@/composables/useTelemetry';

const props = defineProps<{
modalName: string;
Expand All @@ -19,6 +20,7 @@ const props = defineProps<{
const i18n = useI18n();
const uiStore = useUIStore();
const projectsStore = useProjectsStore();
const telemetry = useTelemetry();

const projectId = ref<string | null>(null);
const processedName = computed(() => {
Expand Down Expand Up @@ -48,6 +50,13 @@ const next = () => {
},
});
};

onMounted(() => {
telemetry.track(`User clicked to move a ${props.data.resourceType}`, {
[`${props.data.resourceType}_id`]: props.data.resource.id,
project_from_type: projectsStore.currentProject?.type ?? projectsStore.personalProject?.type,
});
});
</script>
<template>
<Modal width="500px" :name="props.modalName" data-test-id="project-move-resource-modal">
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/WorkflowCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const WORKFLOW_LIST_ITEM_ACTIONS = {
const props = withDefaults(
defineProps<{
data: IWorkflowDb;
readOnly: boolean;
readOnly?: boolean;
}>(),
{
data: () => ({
Expand Down
Loading