Skip to content

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

refactor(sql-editor): say goodbye to ugly relative path (#844)

Yunwei Xiaod329e2c4d8b6
diff --git a/frontend/src/store/modules/sheet.ts b/frontend/src/store/modules/sheet.ts
index d06e35fce8..8a90f531a7 100644
--- a/frontend/src/store/modules/sheet.ts
+++ b/frontend/src/store/modules/sheet.ts
@@ -3,7 +3,7 @@ import { isEmpty } from "lodash-es";
import * as types from "../mutation-types";
import { makeActions } from "../actions";
-import {
+import type {
Sheet,
SheetId,
SheetState,
@@ -16,9 +16,8 @@ import {
Database,
Project,
ProjectMember,
- UNKNOWN_ID,
-} from "../../types";
-import { unknown } from "../../types";
+} from "@/types";
+import { unknown, UNKNOWN_ID } from "@/types";
import { getPrincipalFromIncludedList } from "./principal";
function convertSheet(
diff --git a/frontend/src/store/modules/sqlEditor.ts b/frontend/src/store/modules/sqlEditor.ts
index 88ffaf7284..51ce68e03f 100644
--- a/frontend/src/store/modules/sqlEditor.ts
+++ b/frontend/src/store/modules/sqlEditor.ts
@@ -14,10 +14,10 @@ import {
UNKNOWN_ID,
Sheet,
DEFAULT_PROJECT_ID,
-} from "../../types";
+} from "@/types";
import * as types from "../mutation-types";
import { makeActions } from "../actions";
-import { unknown } from "../../types";
+import { unknown } from "@/types";
export const getDefaultConnectionContext = () => ({
hasSlug: false,
diff --git a/frontend/src/store/modules/tab.ts b/frontend/src/store/modules/tab.ts
index 8ef75ca1d6..750cdad555 100644
--- a/frontend/src/store/modules/tab.ts
+++ b/frontend/src/store/modules/tab.ts
@@ -1,6 +1,6 @@
import dayjs from "dayjs";
import { v1 as uuidv1 } from "uuid";
-import { TabInfo, AnyTabInfo, TabState } from "../../types";
+import { TabInfo, AnyTabInfo, TabState } from "@/types";
import * as types from "../mutation-types";
import { makeActions } from "../actions";
diff --git a/frontend/src/views/SqlEditor/AsidePanel/AsidePanel.vue b/frontend/src/views/SqlEditor/AsidePanel/AsidePanel.vue
index 71a899b77f..7aff02355e 100644
--- a/frontend/src/views/SqlEditor/AsidePanel/AsidePanel.vue
+++ b/frontend/src/views/SqlEditor/AsidePanel/AsidePanel.vue
@@ -31,7 +31,7 @@
import { ref, watch } from "vue";
import { useNamespacedState } from "vuex-composition-helpers";
-import type { SqlEditorState } from "../../../types";
+import type { SqlEditorState } from "@/types";
import DatabaseTree from "./DatabaseTree.vue";
import QueryHistoryContainer from "./QueryHistoryContainer.vue";
import SheetContainer from "./SheetContainer.vue";
diff --git a/frontend/src/views/SqlEditor/AsidePanel/DatabaseTree.vue b/frontend/src/views/SqlEditor/AsidePanel/DatabaseTree.vue
index 4321451e23..4c7a1d41dd 100644
--- a/frontend/src/views/SqlEditor/AsidePanel/DatabaseTree.vue
+++ b/frontend/src/views/SqlEditor/AsidePanel/DatabaseTree.vue
@@ -47,9 +47,9 @@ import {
SqlEditorActions,
ConnectionContext,
UNKNOWN_ID,
-} from "../../../types";
-import { connectionSlug, getHighlightHTMLByKeyWords } from "../../../utils";
-import InstanceEngineIconVue from "../../../components/InstanceEngineIcon.vue";
+} from "@/types";
+import { connectionSlug, getHighlightHTMLByKeyWords } from "@/utils";
+import InstanceEngineIconVue from "@/components/InstanceEngineIcon.vue";
import HeroiconsOutlineDatabase from "~icons/heroicons-outline/database.vue";
import HeroiconsOutlineTable from "~icons/heroicons-outline/table.vue";
diff --git a/frontend/src/views/SqlEditor/AsidePanel/QueryHistoryContainer.vue b/frontend/src/views/SqlEditor/AsidePanel/QueryHistoryContainer.vue
index bec7b1aa27..32cf207250 100644
--- a/frontend/src/views/SqlEditor/AsidePanel/QueryHistoryContainer.vue
+++ b/frontend/src/views/SqlEditor/AsidePanel/QueryHistoryContainer.vue
@@ -76,8 +76,8 @@ import {
QueryHistory,
SqlEditorActions,
SqlEditorState,
-} from "../../../types";
-import { getHighlightHTMLByKeyWords } from "../../../utils";
+} from "@/types";
+import { getHighlightHTMLByKeyWords } from "@/utils";
interface State {
search: string;
diff --git a/frontend/src/views/SqlEditor/AsidePanel/SheetContainer.vue b/frontend/src/views/SqlEditor/AsidePanel/SheetContainer.vue
index 96ee43f1ef..6ee6dee86d 100644
--- a/frontend/src/views/SqlEditor/AsidePanel/SheetContainer.vue
+++ b/frontend/src/views/SqlEditor/AsidePanel/SheetContainer.vue
@@ -101,9 +101,9 @@ import {
SqlEditorActions,
SqlEditorState,
UNKNOWN_ID,
-} from "../../../types";
-import { getHighlightHTMLByKeyWords } from "../../../utils";
-import { useSQLEditorConnection } from "../../../composables/useSQLEditorConnection";
+} from "@/types";
+import { getHighlightHTMLByKeyWords } from "@/utils";
+import { useSQLEditorConnection } from "@/composables/useSQLEditorConnection";
interface State {
search: string;
diff --git a/frontend/src/views/SqlEditor/AsidePanel/TableSchema.vue b/frontend/src/views/SqlEditor/AsidePanel/TableSchema.vue
index c5218b71e6..3d6d48a745 100644
--- a/frontend/src/views/SqlEditor/AsidePanel/TableSchema.vue
+++ b/frontend/src/views/SqlEditor/AsidePanel/TableSchema.vue
@@ -78,7 +78,7 @@ import type {
SqlEditorGetters,
Database,
DatabaseId,
-} from "../../../types";
+} from "@/types";
const emit = defineEmits<{
(e: "close-pane"): void;
diff --git a/frontend/src/views/SqlEditor/EditorHeader.vue b/frontend/src/views/SqlEditor/EditorHeader.vue
index 5bbd5b0b59..2dd445f395 100644
--- a/frontend/src/views/SqlEditor/EditorHeader.vue
+++ b/frontend/src/views/SqlEditor/EditorHeader.vue
@@ -99,9 +99,9 @@ import { useI18n } from "vue-i18n";
import { useLocalStorage } from "@vueuse/core";
import { useStore } from "vuex";
-import ProfileDropdown from "../../components/ProfileDropdown.vue";
-import { InboxSummary, UNKNOWN_ID } from "../../types";
-import { isDBAOrOwner, isDev } from "../../utils";
+import ProfileDropdown from "@/components/ProfileDropdown.vue";
+import { InboxSummary, UNKNOWN_ID } from "@/types";
+import { isDBAOrOwner, isDev } from "@/utils";
interface LocalState {
showMobileMenu: boolean;
diff --git a/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue b/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
index 2031708012..3fab1a6105 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/EditorAction.vue
@@ -131,8 +131,8 @@ import {
SheetActions,
UNKNOWN_ID,
Instance,
-} from "../../../types";
-import { useExecuteSQL } from "../../../composables/useExecuteSQL";
+} from "@/types";
+import { useExecuteSQL } from "@/composables/useExecuteSQL";
import SharePopover from "./SharePopover.vue";
import { useRouter } from "vue-router";
import { instanceSlug } from "../../../utils/slug";
diff --git a/frontend/src/views/SqlEditor/EditorPanel/EditorPanel.vue b/frontend/src/views/SqlEditor/EditorPanel/EditorPanel.vue
index 2c3389237d..5e766a4ce8 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/EditorPanel.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/EditorPanel.vue
@@ -26,11 +26,7 @@ import {
useNamespacedActions,
} from "vuex-composition-helpers";
-import {
- SqlEditorState,
- SqlEditorActions,
- SqlEditorGetters,
-} from "../../../types";
+import { SqlEditorState, SqlEditorActions, SqlEditorGetters } from "@/types";
import EditorAction from "./EditorAction.vue";
import QueryEditor from "./QueryEditor.vue";
import ExecuteHint from "./ExecuteHint.vue";
diff --git a/frontend/src/views/SqlEditor/EditorPanel/ExecuteHint.vue b/frontend/src/views/SqlEditor/EditorPanel/ExecuteHint.vue
index a214117a79..4ea5fae468 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/ExecuteHint.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/ExecuteHint.vue
@@ -57,18 +57,14 @@ import {
useNamespacedState,
} from "vuex-composition-helpers";
-import { UNKNOWN_ID } from "../../../types";
+import { UNKNOWN_ID } from "@/types";
-import type {
- SqlEditorState,
- SqlEditorGetters,
- TabGetters,
-} from "../../../types";
+import type { SqlEditorState, SqlEditorGetters, TabGetters } from "@/types";
import {
parseSQL,
transformSQL,
isDDLStatement,
-} from "../../../components/MonacoEditor/sqlParser";
+} from "@/components/MonacoEditor/sqlParser";
const emit = defineEmits<{
(e: "close"): void;
diff --git a/frontend/src/views/SqlEditor/EditorPanel/QueryEditor.vue b/frontend/src/views/SqlEditor/EditorPanel/QueryEditor.vue
index 2084ef1a47..a3ef845952 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/QueryEditor.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/QueryEditor.vue
@@ -18,13 +18,8 @@ import {
useNamespacedState,
} from "vuex-composition-helpers";
-import { useExecuteSQL } from "../../../composables/useExecuteSQL";
-import {
- TabActions,
- TabGetters,
- SheetActions,
- SqlEditorState,
-} from "../../../types";
+import { useExecuteSQL } from "@/composables/useExecuteSQL";
+import { TabActions, TabGetters, SheetActions, SqlEditorState } from "@/types";
const store = useStore();
const { currentTab } = useNamespacedGetters<TabGetters>("tab", ["currentTab"]);
diff --git a/frontend/src/views/SqlEditor/EditorPanel/SharePopover.vue b/frontend/src/views/SqlEditor/EditorPanel/SharePopover.vue
index 275a9ab7d0..c3965864fd 100644
--- a/frontend/src/views/SqlEditor/EditorPanel/SharePopover.vue
+++ b/frontend/src/views/SqlEditor/EditorPanel/SharePopover.vue
@@ -93,7 +93,7 @@ import {
SheetGetters,
SheetActions,
AccessOption,
-} from "../../../types";
+} from "@/types";
const emit = defineEmits<{
(e: "close"): void;
diff --git a/frontend/src/views/SqlEditor/TabListContainer.vue b/frontend/src/views/SqlEditor/TabListContainer.vue
index 8908f77400..edfab73bad 100644
--- a/frontend/src/views/SqlEditor/TabListContainer.vue
+++ b/frontend/src/views/SqlEditor/TabListContainer.vue
@@ -126,6 +126,7 @@ import {
useNamespacedState,
useNamespacedActions,
} from "vuex-composition-helpers";
+import { useDialog } from "naive-ui";
import {
TabInfo,
@@ -135,10 +136,9 @@ import {
TabState,
TabActions,
SheetActions,
-} from "../../types";
-import { useDialog } from "naive-ui";
-import { getDefaultTab } from "../../store/modules/tab";
-import { useSQLEditorConnection } from "../../composables/useSQLEditorConnection";
+} from "@/types";
+import { getDefaultTab } from "@/store/modules/tab";
+import { useSQLEditorConnection } from "@/composables/useSQLEditorConnection";
// getters map
const { currentTab, hasTabs } = useNamespacedGetters<TabGetters>("tab", [
diff --git a/frontend/src/views/SqlEditor/TablePanel/TableView.vue b/frontend/src/views/SqlEditor/TablePanel/TableView.vue
index 6b8c8dec51..9679171d2b 100644
--- a/frontend/src/views/SqlEditor/TablePanel/TableView.vue
+++ b/frontend/src/views/SqlEditor/TablePanel/TableView.vue
@@ -73,7 +73,7 @@ import {
import { unparse } from "papaparse";
import { isEmpty } from "lodash-es";
-import { TabGetters, SqlEditorState } from "../../../types";
+import { TabGetters, SqlEditorState } from "@/types";
interface State {
search: string;