Files
n8n-enterprise-unlocked/packages/editor-ui/src/composables/useBugReporting.ts
Mutasem Aldmour 296f68f041 feat: Add report bug buttons (#11304)
Co-authored-by: Cornelius Suermann <cornelius@n8n.io>
2024-10-21 13:32:37 +02:00

42 lines
1.0 KiB
TypeScript

import { useDebugInfo } from '@/composables/useDebugInfo';
const BASE_FORUM_URL = 'https://github.com/n8n-io/n8n/issues/new?labels=bug-report';
const REPORT_TEMPLATE = `
<!-- Please follow the template below. Skip the questions that are not relevant to you. -->
## Describe the problem/error/question
## What is the error message (if any)?
## Please share your workflow/screenshots/recording
\`\`\`
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
\`\`\`
## Share the output returned by the last node
<!-- If you need help with data transformations, please also share your expected output. -->
`;
export function useBugReporting() {
const debugInfo = useDebugInfo();
const getReportingURL = () => {
const url = new URL(BASE_FORUM_URL);
const report = `${REPORT_TEMPLATE}\n${debugInfo.generateDebugInfo({ skipSensitive: true, secondaryHeader: true })}}`;
url.searchParams.append('body', report);
return url.toString();
};
return {
getReportingURL,
};
}