Enhance bug reporting from within the app (#16566)

* Fix paths of imports

* Process not-found.vue as ts

To prevent the following error from 'vue-tsc':
  error TS6504: File '/Users/pascal/Development/directus/app/src/modules/insights/routes/not-found.vue.js' is a JavaScript file. Did you mean to enable the 'allowJs' option?

Note: We could also enable 'allowJS' but since this is the only js file
this seems to be a more fitting fix

* Drop hljs language definition for GraphQL (now in core)

* Enhance bug reporting from within the app

* Simplify simplify simplify

---------

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
Pascal Jufer
2023-04-11 21:04:26 +02:00
committed by GitHub
parent 15b91dee34
commit f09f440146
5 changed files with 64 additions and 96 deletions

View File

@@ -10,7 +10,7 @@
</v-card-text>
<v-card-actions>
<v-button v-if="notification.type === 'error' && admin && notification.code === 'UNKNOWN'" secondary>
<a target="_blank" :href="getGitHubIssueLink(notification)">
<a target="_blank" href="https://github.com/directus/directus/issues/new?template=bug_report.yml">
{{ t('report_error') }}
</a>
</v-button>
@@ -22,51 +22,21 @@
</template>
<script lang="ts">
import { useI18n } from 'vue-i18n';
import { defineComponent, computed } from 'vue';
import { useNotificationsStore } from '@/stores/notifications';
import { useUserStore } from '@/stores/user';
import { Snackbar } from '@/types/notifications';
import { useProjectInfo } from '@/modules/settings/composables/use-project-info';
import { computed, defineComponent } from 'vue';
import { useI18n } from 'vue-i18n';
export default defineComponent({
setup() {
const { t } = useI18n();
const { parsedInfo } = useProjectInfo();
const notificationsStore = useNotificationsStore();
const userStore = useUserStore();
const notifications = computed(() => notificationsStore.dialogs);
return { t, notifications, admin: userStore.isAdmin, done, getGitHubIssueLink };
function getGitHubIssueLink(notification: Snackbar) {
const debugInfo = `<!-- Please put a detailed explanation of the problem here. -->
---
### Project details
Directus Version: ${parsedInfo.value?.directus.version}
Environment: ${import.meta.env.MODE}
OS: ${parsedInfo.value?.os.type} ${parsedInfo.value?.os.version}
Node: ${parsedInfo.value?.node.version}
### Error
Title: ${notification.title || 'none'}
Message: ${notification.text || 'none'}
<details>
<summary>Stack Trace</summary>
<pre>
${JSON.stringify(notification.error, Object.getOwnPropertyNames(notification.error), 2)}
</pre>
</details>
`;
return `https://github.com/directus/directus/issues/new?body=${encodeURIComponent(debugInfo)}`;
}
return { t, notifications, admin: userStore.isAdmin, done };
function done(id: string) {
notificationsStore.remove(id);