Skip to content

Commit 9e382a1

Browse files
committed
fix(exporters): added confimation dialog to show which cell output will be saved
1 parent 8a768df commit 9e382a1

File tree

1 file changed

+17
-2
lines changed
  • client/src/components/notebook/exporters

1 file changed

+17
-2
lines changed

client/src/components/notebook/exporters/index.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ export const saveOutput = async () => {
4444
return;
4545
}
4646

47+
// Show a message to clarify which cell's output will be saved
48+
const proceed = await window.showInformationMessage(
49+
l10n.t(
50+
"This will save output from the selected cell (cell {0}). To save output from a different cell, please click on that cell first.",
51+
cell.index + 1,
52+
),
53+
{ modal: false },
54+
l10n.t("Continue"),
55+
l10n.t("Cancel"),
56+
);
57+
58+
if (proceed !== l10n.t("Continue")) {
59+
return;
60+
}
61+
4762
let odsItem = null;
4863
let logItem = null;
4964

@@ -100,7 +115,7 @@ export const saveOutput = async () => {
100115
content = odsItem.data.toString();
101116
fileExtension = "html";
102117
fileName = `${path.basename(notebook.uri.path, ".sasnb")}_${l10n.t("output")}_${
103-
activeCell + 1
118+
cell.index + 1
104119
}.html`;
105120
} else if (exportChoice.outputType === "log" && logItem) {
106121
const logs: Array<{ line: string; type: string }> = JSON.parse(
@@ -109,7 +124,7 @@ export const saveOutput = async () => {
109124
content = logs.map((log) => log.line).join("\n");
110125
fileExtension = "log";
111126
fileName = `${path.basename(notebook.uri.path, ".sasnb")}_${l10n.t("output")}_${
112-
activeCell + 1
127+
cell.index + 1
113128
}.log`;
114129
}
115130
} catch (error) {

0 commit comments

Comments
 (0)