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

feat(ui): open in IDE tests with error on report and code tabs #992

Merged
merged 4 commits into from
Mar 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 17 additions & 1 deletion packages/ui/client/components/views/ViewReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ function relative(p: string) {
return p.slice(config.value.root.length)
return p
}
function shouldOpenInEditor(p: string) {
return props.file && p.endsWith(props.file.name)
}
async function openInEditor(name: string, line: number, column: number) {
const url = encodeURI(`${name}:${line}:${column}`)
await fetch(`/__open-in-editor?file=${url}`)
}
</script>

<template>
Expand All @@ -36,7 +43,16 @@ function relative(p: string) {
{{ task.name }}
<div v-if="task.result?.error" class="scrolls scrolls-rounded task-error">
<pre><b>{{ task.result.error.name || task.result.error.nameStr }}</b>: {{ task.result.error.message }}</pre>
<pre v-for="stack, i of task.result.error.stacks || []" :key="i" op80> - {{ relative(stack.file) }}:{{ stack.line }}:{{ stack.column }}</pre>
<div v-for="(stack, i) of task.result.error.stacks || []" :key="i" class="op80 flex gap-x-2 items-center">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not destructure the stack?

Copy link
Member Author

@userquin userquin Mar 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

trying also adding on code tab

<pre> - {{ relative(stack.file) }}:{{ stack.line }}:{{ stack.column }}</pre>
<div
v-if="shouldOpenInEditor(stack.file)"
class="i-carbon-launch text-red-900 hover:cursor-pointer"
tabindex="0"
title="Open in IDE"
@click.passive="openInEditor(stack.file, stack.line, stack.column)"
/>
</div>
</div>
</div>
</div>
Expand Down