refactor(editor): Add telemetry for SSO/SAML (no-changelog) (#8102)

https://linear.app/n8n/issue/PAY-1142
This commit is contained in:
Iván Ovejero 2023-12-20 11:41:39 +01:00 committed by GitHub
parent 1d1cb0d3c5
commit faadfd6d4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,8 @@ import CopyInput from '@/components/CopyInput.vue';
import { useI18n } from '@/composables/useI18n';
import { useMessage } from '@/composables/useMessage';
import { useToast } from '@/composables/useToast';
import { useTelemetry } from '@/composables/useTelemetry';
import { useRootStore } from '@/stores/n8nRoot.store';
const IdentityProviderSettingsType = {
URL: 'url',
@ -13,6 +15,8 @@ const IdentityProviderSettingsType = {
};
const i18n = useI18n();
const telemetry = useTelemetry();
const rootStore = useRootStore();
const ssoStore = useSSOStore();
const uiStore = useUIStore();
const message = useMessage();
@ -78,6 +82,8 @@ const getSamlConfig = async () => {
ssoSettingsSaved.value = !!config?.metadata;
};
let testSucceeded = false;
const onSave = async () => {
try {
const config =
@ -100,6 +106,13 @@ const onSave = async () => {
await onTest();
}
}
telemetry.track('User updated single sign on settings', {
instance_id: rootStore.instanceId,
identity_provider: ipsType.value === 'url' ? 'metadata' : 'xml',
is_valid: testSucceeded,
is_active: ssoStore.isSamlLoginEnabled,
});
} catch (error) {
toast.showError(error, i18n.baseText('settings.sso.settings.save.error'));
return;
@ -115,8 +128,10 @@ const onTest = async () => {
if (typeof window !== 'undefined') {
window.open(url, '_blank');
}
testSucceeded = true;
} catch (error) {
toast.showError(error, 'error');
testSucceeded = false;
}
};