You've already forked AstralRinth
forked from didirus/AstralRinth
Make debug info always expanded to aid support team, add copy button (#3282)
* Make debug info always expanded to aid support team, add copy button * Remove testing error lol
This commit is contained in:
@@ -1,7 +1,16 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { XIcon, HammerIcon, LogInIcon, UpdatedIcon } from '@modrinth/assets'
|
import {
|
||||||
|
CheckIcon,
|
||||||
|
DropdownIcon,
|
||||||
|
XIcon,
|
||||||
|
HammerIcon,
|
||||||
|
LogInIcon,
|
||||||
|
UpdatedIcon,
|
||||||
|
CopyIcon,
|
||||||
|
} from '@modrinth/assets'
|
||||||
import { ChatIcon } from '@/assets/icons'
|
import { ChatIcon } from '@/assets/icons'
|
||||||
import { ref } from 'vue'
|
import { ButtonStyled, Collapsible } from '@modrinth/ui'
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
import { login as login_flow, set_default_user } from '@/helpers/auth.js'
|
import { login as login_flow, set_default_user } from '@/helpers/auth.js'
|
||||||
import { handleError } from '@/store/notifications.js'
|
import { handleError } from '@/store/notifications.js'
|
||||||
import { handleSevereError } from '@/store/error.js'
|
import { handleSevereError } from '@/store/error.js'
|
||||||
@@ -13,6 +22,7 @@ import ModalWrapper from '@/components/ui/modal/ModalWrapper.vue'
|
|||||||
const errorModal = ref()
|
const errorModal = ref()
|
||||||
const error = ref()
|
const error = ref()
|
||||||
const closable = ref(true)
|
const closable = ref(true)
|
||||||
|
const errorCollapsed = ref(false)
|
||||||
|
|
||||||
const title = ref('An error occurred')
|
const title = ref('An error occurred')
|
||||||
const errorType = ref('unknown')
|
const errorType = ref('unknown')
|
||||||
@@ -118,6 +128,26 @@ async function repairInstance() {
|
|||||||
}
|
}
|
||||||
loadingRepair.value = false
|
loadingRepair.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasDebugInfo = computed(
|
||||||
|
() =>
|
||||||
|
errorType.value === 'directory_move' ||
|
||||||
|
errorType.value === 'minecraft_auth' ||
|
||||||
|
errorType.value === 'state_init' ||
|
||||||
|
errorType.value === 'no_loader_version',
|
||||||
|
)
|
||||||
|
|
||||||
|
const debugInfo = computed(() => error.value.message ?? error.value ?? 'No error message.')
|
||||||
|
|
||||||
|
const copied = ref(false)
|
||||||
|
|
||||||
|
async function copyToClipboard(text) {
|
||||||
|
await navigator.clipboard.writeText(text)
|
||||||
|
copied.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
copied.value = false
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -244,16 +274,9 @@ async function repairInstance() {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
{{ error.message ?? error }}
|
{{ debugInfo }}
|
||||||
</template>
|
</template>
|
||||||
<template
|
<template v-if="hasDebugInfo">
|
||||||
v-if="
|
|
||||||
errorType === 'directory_move' ||
|
|
||||||
errorType === 'minecraft_auth' ||
|
|
||||||
errorType === 'state_init' ||
|
|
||||||
errorType === 'no_loader_version'
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<hr />
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
If nothing is working and you need help, visit
|
If nothing is working and you need help, visit
|
||||||
@@ -261,16 +284,39 @@ async function repairInstance() {
|
|||||||
and start a chat using the widget in the bottom right and we will be more than happy to
|
and start a chat using the widget in the bottom right and we will be more than happy to
|
||||||
assist! Make sure to provide the following debug information to the agent:
|
assist! Make sure to provide the following debug information to the agent:
|
||||||
</p>
|
</p>
|
||||||
<details>
|
|
||||||
<summary>Debug information</summary>
|
|
||||||
{{ error.message ?? error }}
|
|
||||||
</details>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group push-right">
|
<div class="flex items-center gap-2">
|
||||||
<a :href="supportLink" class="btn" @click="errorModal.hide()"><ChatIcon /> Get support</a>
|
<ButtonStyled>
|
||||||
<button v-if="closable" class="btn" @click="errorModal.hide()"><XIcon /> Close</button>
|
<a :href="supportLink" @click="errorModal.hide()"><ChatIcon /> Get support</a>
|
||||||
|
</ButtonStyled>
|
||||||
|
<ButtonStyled v-if="closable">
|
||||||
|
<button @click="errorModal.hide()"><XIcon /> Close</button>
|
||||||
|
</ButtonStyled>
|
||||||
|
<ButtonStyled v-if="hasDebugInfo">
|
||||||
|
<button :disabled="copied" @click="copyToClipboard(debugInfo)">
|
||||||
|
<template v-if="copied"> <CheckIcon class="text-green" /> Copied! </template>
|
||||||
|
<template v-else> <CopyIcon /> Copy debug info </template>
|
||||||
|
</button>
|
||||||
|
</ButtonStyled>
|
||||||
</div>
|
</div>
|
||||||
|
<template v-if="hasDebugInfo">
|
||||||
|
<div class="bg-button-bg rounded-xl mt-2 overflow-clip">
|
||||||
|
<button
|
||||||
|
class="flex items-center justify-between w-full bg-transparent border-0 px-4 py-3 cursor-pointer"
|
||||||
|
@click="errorCollapsed = !errorCollapsed"
|
||||||
|
>
|
||||||
|
<span class="text-contrast font-extrabold m-0">Debug information:</span>
|
||||||
|
<DropdownIcon
|
||||||
|
class="h-5 w-5 text-secondary transition-transform"
|
||||||
|
:class="{ 'rotate-180': !errorCollapsed }"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
<Collapsible :collapsed="errorCollapsed">
|
||||||
|
<pre class="m-0 px-4 py-3 bg-bg rounded-none">{{ debugInfo }}</pre>
|
||||||
|
</Collapsible>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</ModalWrapper>
|
</ModalWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -376,9 +376,8 @@ import {
|
|||||||
ExitIcon,
|
ExitIcon,
|
||||||
ScaleIcon,
|
ScaleIcon,
|
||||||
} from "@modrinth/assets";
|
} from "@modrinth/assets";
|
||||||
import { ButtonStyled, MarkdownEditor, OverflowMenu } from "@modrinth/ui";
|
import { ButtonStyled, MarkdownEditor, OverflowMenu, Collapsible } from "@modrinth/ui";
|
||||||
import Categories from "~/components/ui/search/Categories.vue";
|
import Categories from "~/components/ui/search/Categories.vue";
|
||||||
import Collapsible from "~/components/ui/Collapsible.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
project: {
|
project: {
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
defineProps<{
|
||||||
baseClass?: string;
|
baseClass?: string
|
||||||
collapsed: boolean;
|
collapsed: boolean
|
||||||
}>();
|
}>()
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.accordion-content {
|
.accordion-content {
|
||||||
@@ -9,6 +9,7 @@ export { default as ButtonStyled } from './base/ButtonStyled.vue'
|
|||||||
export { default as Card } from './base/Card.vue'
|
export { default as Card } from './base/Card.vue'
|
||||||
export { default as Checkbox } from './base/Checkbox.vue'
|
export { default as Checkbox } from './base/Checkbox.vue'
|
||||||
export { default as Chips } from './base/Chips.vue'
|
export { default as Chips } from './base/Chips.vue'
|
||||||
|
export { default as Collapsible } from './base/Collapsible.vue'
|
||||||
export { default as ContentPageHeader } from './base/ContentPageHeader.vue'
|
export { default as ContentPageHeader } from './base/ContentPageHeader.vue'
|
||||||
export { default as CopyCode } from './base/CopyCode.vue'
|
export { default as CopyCode } from './base/CopyCode.vue'
|
||||||
export { default as DoubleIcon } from './base/DoubleIcon.vue'
|
export { default as DoubleIcon } from './base/DoubleIcon.vue'
|
||||||
|
|||||||
Reference in New Issue
Block a user