Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: export file name (#940)

STEVEN493f72a8b9d7
diff --git a/frontend/src/views/SqlEditor/TablePanel/TableView.vue b/frontend/src/views/SqlEditor/TablePanel/TableView.vue
index 9679171d2b..a6f0ec58d6 100644
--- a/frontend/src/views/SqlEditor/TablePanel/TableView.vue
+++ b/frontend/src/views/SqlEditor/TablePanel/TableView.vue
@@ -72,6 +72,7 @@ import {
} from "vuex-composition-helpers";
import { unparse } from "papaparse";
import { isEmpty } from "lodash-es";
+import dayjs from "dayjs";
import { TabGetters, SqlEditorState } from "@/types";
@@ -185,9 +186,12 @@ const handleExportBtnClick = (format: "csv" | "json") => {
}
const encodedUri = encodeURI(`data:text/${format};charset=utf-8,${rawText}`);
+ const formatedDateString = dayjs(new Date()).format("YYYY-MM-DDTHH-mm-ss");
+ // Example filename: `mysheet-2022-03-23T09-54-21.json`
+ const filename = `${currentTab.value.name}-${formatedDateString}`;
const link = document.createElement("a");
- link.download = `${currentTab.value.name}.${format}`;
+ link.download = `${filename}.${format}`;
link.href = encodedUri;
link.click();
};