Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-doors-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@knime/hub-features": patch
---

Fix inconsistent error toast text when stack trace is provided but copying to clipboard is not allowed
11 changes: 8 additions & 3 deletions packages/hub-features/src/rfcErrors/RFCErrorToastTemplate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ const onShowDetailsClicked = () => {
<div class="title">
{{ props.title }}
</div>
<button v-if="!showDetails" class="show-more" @click="onShowDetailsClicked">
<button
v-if="!showDetails"
data-test-id="show-details"
class="show-more"
@click="onShowDetailsClicked"
>
Show details
</button>
<div v-if="showDetails" class="additional-info">
Expand All @@ -124,11 +129,11 @@ const onShowDetailsClicked = () => {
<div v-if="date"><strong>Date: </strong>{{ formattedDate }}</div>
<div v-if="requestId"><strong>Request id: </strong>{{ requestId }}</div>
<div v-if="errorId"><strong>Error id: </strong>{{ errorId }}</div>
<div v-if="stacktrace">
<div v-if="stacktrace && canCopyToClipboard">
<strong>Stacktrace: </strong>Part of clipboard text
</div>
<div v-if="canCopyToClipboard" class="copy-button-wrapper">
<Button @click="copyToClipboard">
<Button data-test-id="copy-to-clipboard" @click="copyToClipboard">
<template v-if="copied">
<CheckIcon class="copy-icon" />Error was copied
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,16 @@ describe("RFCErrorToastTemplate", () => {
const { wrapper, copyMock } = doMount({
...defaultProps,
stacktrace: "cannot read property explosion of undefined at foo.bar.baz",
canCopyToClipboard: false,
} as any);
await wrapper.find("button").trigger("click");

await wrapper.find("[data-test-id='show-details']").trigger("click");

expect(wrapper.text()).not.toContain("Stacktrace: Part of clipboard text");
await wrapper.setProps({ canCopyToClipboard: true });
expect(wrapper.text()).toContain("Stacktrace: Part of clipboard text");

await wrapper.find("button").trigger("click"); // first show details
await wrapper.find("button").trigger("click"); // then the clipboard button
await wrapper.find("[data-test-id='copy-to-clipboard']").trigger("click");

// @ts-expect-error
const copiedText = copyMock.mock.calls[0][0];
Expand Down