Skip to content

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

chore: rename to `Schema Editor` (#3825)

boojack810675e4b571
diff --git a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
index d760e49ddc..be8e2deb6c 100644
--- a/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/AlterSchemaPrepForm.vue
@@ -174,7 +174,7 @@ import {
} from "@/types";
import {
allowGhostMigration,
- allowUsingUIEditor,
+ allowUsingSchemaEditor,
parseDatabaseNameByTemplate,
sortDatabaseList,
} from "@/utils";
@@ -342,7 +342,7 @@ const generateMultiDb = async () => {
(id) => databaseList.value.find((db) => db.id === id)!
);
- if (isAlterSchema.value && allowUsingUIEditor(selectedDatabaseList)) {
+ if (isAlterSchema.value && allowUsingSchemaEditor(selectedDatabaseList)) {
schemaEditorContext.value.databaseIdList = cloneDeep(
flattenSelectedDatabaseIdList.value
);
@@ -449,7 +449,7 @@ const generateTenant = async () => {
});
const selectedDatabaseList =
databaseListGroupByName[state.selectedDatabaseName!];
- if (isAlterSchema.value && allowUsingUIEditor(selectedDatabaseList)) {
+ if (isAlterSchema.value && allowUsingSchemaEditor(selectedDatabaseList)) {
schemaEditorContext.value.databaseIdList = selectedDatabaseList.map(
(database) => database.id
);
@@ -465,7 +465,7 @@ const generateTenant = async () => {
for (const databaseId of state.selectedDatabaseIdListForTenantMode) {
databaseList.push(databaseStore.getDatabaseById(databaseId));
}
- if (isAlterSchema.value && allowUsingUIEditor(databaseList)) {
+ if (isAlterSchema.value && allowUsingSchemaEditor(databaseList)) {
schemaEditorContext.value.databaseIdList = Array.from(
state.selectedDatabaseIdListForTenantMode.values()
);
@@ -511,7 +511,7 @@ const generateTenant = async () => {
const selectDatabase = async (database: Database) => {
if (database.project.workflowType == "UI") {
- if (isAlterSchema.value && allowUsingUIEditor([database])) {
+ if (isAlterSchema.value && allowUsingSchemaEditor([database])) {
schemaEditorContext.value.databaseIdList = [database.id];
state.showSchemaEditorModal = true;
return;
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
index 5c92a16b0c..ef267abda8 100644
--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue
@@ -1,7 +1,7 @@
<template>
<BBModal
:title="$t('database.alter-schema')"
- class="ui-editor-modal-container !w-320 h-auto overflow-auto !max-w-[calc(100%-40px)] !max-h-[calc(100%-40px)]"
+ class="schema-editor-modal-container !w-320 h-auto overflow-auto !max-w-[calc(100%-40px)] !max-h-[calc(100%-40px)]"
:esc-closable="false"
@close="dismissModal"
>
@@ -11,12 +11,12 @@
<button
class="-mb-px px-3 leading-9 rounded-t-md flex items-center text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none outline-none"
:class="
- state.selectedTab === 'ui-editor' &&
+ state.selectedTab === 'schema-editor' &&
'bg-white border-gray-300 text-gray-800'
"
- @click="handleChangeTab('ui-editor')"
+ @click="handleChangeTab('schema-editor')"
>
- {{ $t("ui-editor.self") }}
+ {{ $t("schema-editor.self") }}
<div class="ml-1">
<BBBetaBadge />
</div>
@@ -29,12 +29,12 @@
"
@click="handleChangeTab('raw-sql')"
>
- {{ $t("ui-editor.raw-sql") }}
+ {{ $t("schema-editor.raw-sql") }}
</button>
</div>
<div class="w-full h-full max-h-full overflow-auto border-b mb-4">
- <UIEditor
- v-show="state.selectedTab === 'ui-editor'"
+ <SchemaEditor
+ v-show="state.selectedTab === 'schema-editor'"
:database-id-list="props.databaseIdList"
/>
<div
@@ -64,13 +64,13 @@
</label>
<button
class="text-sm border px-3 leading-8 flex items-center rounded cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"
- :disabled="!allowSyncSQLFromUIEditor"
- @click="handleSyncSQLFromUIEditor"
+ :disabled="!allowSyncSQLFromSchemaEditor"
+ @click="handleSyncSQLFromSchemaEditor"
>
<heroicons-outline:arrow-path
class="w-4 h-auto mr-1 text-gray-500"
/>
- {{ $t("ui-editor.sync-sql-from-ui-editor") }}
+ {{ $t("schema-editor.sync-sql-from-schema-editor") }}
</button>
</div>
</div>
@@ -94,7 +94,7 @@
:disabled="!allowPreviewIssue"
@click="handlePreviewIssue"
>
- {{ $t("ui-editor.preview-issue") }}
+ {{ $t("schema-editor.preview-issue") }}
</button>
</div>
</BBModal>
@@ -105,8 +105,8 @@
<!-- Close modal confirm dialog -->
<ActionConfirmModal
v-if="state.showActionConfirmModal"
- :title="$t('ui-editor.confirm-to-close.title')"
- :description="$t('ui-editor.confirm-to-close.description')"
+ :title="$t('schema-editor.confirm-to-close.title')"
+ :description="$t('schema-editor.confirm-to-close.description')"
@close="state.showActionConfirmModal = false"
@confirm="emit('close')"
/>
@@ -129,18 +129,18 @@ import { allowGhostMigration } from "@/utils";
import {
useDatabaseStore,
useNotificationStore,
- useUIEditorStore,
+ useSchemaEditorStore,
} from "@/store";
-import { diffTableList } from "@/utils/UIEditor/diffTable";
-import { validateDatabaseEdit } from "@/utils/UIEditor/validate";
+import { diffTableList } from "@/utils/schemaEditor/diffTable";
+import { validateDatabaseEdit } from "@/utils/schemaEditor/validate";
import BBBetaBadge from "@/bbkit/BBBetaBadge.vue";
-import UIEditor from "@/components/UIEditor/UIEditor.vue";
+import SchemaEditor from "@/components/SchemaEditor/SchemaEditor.vue";
+import ActionConfirmModal from "@/components/SchemaEditor/Modals/ActionConfirmModal.vue";
import GhostDialog from "./GhostDialog.vue";
-import ActionConfirmModal from "../UIEditor/Modals/ActionConfirmModal.vue";
const MAX_UPLOAD_FILE_SIZE_MB = 1;
-type TabType = "raw-sql" | "ui-editor";
+type TabType = "raw-sql" | "schema-editor";
interface LocalState {
selectedTab: TabType;
@@ -166,28 +166,28 @@ const emit = defineEmits<{
const { t } = useI18n();
const router = useRouter();
const state = reactive<LocalState>({
- selectedTab: "ui-editor",
+ selectedTab: "schema-editor",
editStatement: "",
showActionConfirmModal: false,
});
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const databaseStore = useDatabaseStore();
const notificationStore = useNotificationStore();
-const statementFromUIEditor = ref<string>();
+const statementFromSchemaEditor = ref<string>();
const ghostDialog = ref<InstanceType<typeof GhostDialog>>();
const allowPreviewIssue = computed(() => {
- if (state.selectedTab === "ui-editor") {
- const databaseEditList = getDatabaseEditListWithUIEditor();
+ if (state.selectedTab === "schema-editor") {
+ const databaseEditList = getDatabaseEditListWithSchemaEditor();
return databaseEditList.length !== 0;
} else {
return state.editStatement !== "";
}
});
-const allowSyncSQLFromUIEditor = computed(() => {
+const allowSyncSQLFromSchemaEditor = computed(() => {
if (state.selectedTab === "raw-sql") {
- return statementFromUIEditor.value !== state.editStatement;
+ return statementFromSchemaEditor.value !== state.editStatement;
}
return false;
});
@@ -253,20 +253,20 @@ const isUsingGhostMigration = async (databaseList: Database[]) => {
return "normal";
};
-const handleSyncSQLFromUIEditor = async () => {
- if (!allowSyncSQLFromUIEditor.value) {
+const handleSyncSQLFromSchemaEditor = async () => {
+ if (!allowSyncSQLFromSchemaEditor.value) {
return;
}
- const databaseEditMap = await fetchDatabaseEditMapWithUIEditor();
+ const databaseEditMap = await fetchDatabaseEditMapWithSchemaEditor();
if (!databaseEditMap) {
return;
}
state.editStatement = Array.from(databaseEditMap.values()).join("\n");
- statementFromUIEditor.value = state.editStatement;
+ statementFromSchemaEditor.value = state.editStatement;
};
-const getDatabaseEditListWithUIEditor = () => {
+const getDatabaseEditListWithSchemaEditor = () => {
const databaseEditList: DatabaseEdit[] = [];
for (const database of editorStore.databaseList) {
const originTableList = editorStore.originTableList.filter(
@@ -291,8 +291,8 @@ const getDatabaseEditListWithUIEditor = () => {
return databaseEditList;
};
-const fetchDatabaseEditMapWithUIEditor = async () => {
- const databaseEditList = getDatabaseEditListWithUIEditor();
+const fetchDatabaseEditMapWithSchemaEditor = async () => {
+ const databaseEditList = getDatabaseEditListWithSchemaEditor();
const databaseEditMap: Map<DatabaseId, string> = new Map();
if (databaseEditList.length > 0) {
for (const databaseEdit of databaseEditList) {
@@ -399,7 +399,7 @@ const handlePreviewIssue = async () => {
if (state.selectedTab === "raw-sql") {
query.sql = state.editStatement;
} else {
- const databaseEditList = getDatabaseEditListWithUIEditor();
+ const databaseEditList = getDatabaseEditListWithSchemaEditor();
// Validate databaseEditList in frontend.
const validateResultList = [];
for (const databaseEdit of databaseEditList) {
@@ -417,7 +417,7 @@ const handlePreviewIssue = async () => {
return;
}
- const databaseEditMap = await fetchDatabaseEditMapWithUIEditor();
+ const databaseEditMap = await fetchDatabaseEditMapWithSchemaEditor();
if (!databaseEditMap) {
return;
}
@@ -471,9 +471,9 @@ const generateIssueName = (
};
watch(
- () => getDatabaseEditListWithUIEditor(),
+ () => getDatabaseEditListWithSchemaEditor(),
() => {
- statementFromUIEditor.value = undefined;
+ statementFromSchemaEditor.value = undefined;
},
{
deep: true,
@@ -482,7 +482,7 @@ watch(
</script>
<style>
-.ui-editor-modal-container > .modal-container {
+.schema-editor-modal-container > .modal-container {
@apply w-full h-160 overflow-auto grid;
grid-template-rows: min-content 1fr min-content;
}
diff --git a/frontend/src/components/UIEditor/AsidePanel.vue b/frontend/src/components/SchemaEditor/AsidePanel.vue
similarity index 100%
rename from frontend/src/components/UIEditor/AsidePanel.vue
rename to frontend/src/components/SchemaEditor/AsidePanel.vue
diff --git a/frontend/src/components/UIEditor/DatabaseTree.vue b/frontend/src/components/SchemaEditor/DatabaseTree.vue
similarity index 93%
rename from frontend/src/components/UIEditor/DatabaseTree.vue
rename to frontend/src/components/SchemaEditor/DatabaseTree.vue
index 6b0a6ac786..2275b65c74 100644
--- a/frontend/src/components/UIEditor/DatabaseTree.vue
+++ b/frontend/src/components/SchemaEditor/DatabaseTree.vue
@@ -10,7 +10,7 @@
</template>
</NInput>
</div>
- <div ref="treeRef" class="ui-editor-database-tree pb-2 h-auto">
+ <div ref="treeRef" class="schema-editor-database-tree pb-2 h-auto">
<n-tree
block-line
:data="treeDataRef"
@@ -52,10 +52,10 @@ import { TreeOption, NEllipsis, NInput } from "naive-ui";
import { computed, onMounted, watch, ref, h, reactive, nextTick } from "vue";
import { useI18n } from "vue-i18n";
import scrollIntoView from "scroll-into-view-if-needed";
-import { DatabaseId, InstanceId, UIEditorTabType } from "@/types";
-import { Table } from "@/types/UIEditor";
+import { DatabaseId, InstanceId, SchemaEditorTabType } from "@/types";
+import { Table } from "@/types/schemaEditor";
import {
- useUIEditorStore,
+ useSchemaEditorStore,
generateUniqueTabId,
useInstanceStore,
} from "@/store";
@@ -109,7 +109,7 @@ interface LocalState {
}
const { t } = useI18n();
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const instanceStore = useInstanceStore();
const state = reactive<LocalState>({
shouldRelocateTreeNode: false,
@@ -139,7 +139,7 @@ const contextMenuOptions = computed(() => {
const options = [];
options.push({
key: "create-table",
- label: t("ui-editor.actions.create-table"),
+ label: t("schema-editor.actions.create-table"),
});
return options;
} else if (treeNode.type === "table") {
@@ -157,16 +157,16 @@ const contextMenuOptions = computed(() => {
if (isDropped) {
options.push({
key: "restore",
- label: t("ui-editor.actions.restore"),
+ label: t("schema-editor.actions.restore"),
});
} else {
options.push({
key: "rename",
- label: t("ui-editor.actions.rename"),
+ label: t("schema-editor.actions.rename"),
});
options.push({
key: "drop",
- label: t("ui-editor.actions.drop-table"),
+ label: t("schema-editor.actions.drop-table"),
});
}
return options;
@@ -221,7 +221,7 @@ onMounted(async () => {
expandedKeysRef.value.push(node.key);
editorStore.addTab({
id: generateUniqueTabId(),
- type: UIEditorTabType.TabForDatabase,
+ type: SchemaEditorTabType.TabForDatabase,
databaseId: node.databaseId,
});
}
@@ -286,10 +286,10 @@ watch(
return;
}
- if (currentTab.type === UIEditorTabType.TabForDatabase) {
+ if (currentTab.type === SchemaEditorTabType.TabForDatabase) {
const key = `d-${currentTab.databaseId}`;
selectedKeysRef.value = [key];
- } else if (currentTab.type === UIEditorTabType.TabForTable) {
+ } else if (currentTab.type === SchemaEditorTabType.TabForTable) {
const databaseTreeNodeKey = `d-${currentTab.databaseId}`;
if (!expandedKeysRef.value.includes(databaseTreeNodeKey)) {
expandedKeysRef.value.push(databaseTreeNodeKey);
@@ -467,13 +467,13 @@ const nodeProps = ({ option: treeNode }: { option: TreeNode }) => {
await loadSubTree(treeNode);
editorStore.addTab({
id: generateUniqueTabId(),
- type: UIEditorTabType.TabForDatabase,
+ type: SchemaEditorTabType.TabForDatabase,
databaseId: treeNode.databaseId,
});
} else if (treeNode.type === "table") {
editorStore.addTab({
id: generateUniqueTabId(),
- type: UIEditorTabType.TabForTable,
+ type: SchemaEditorTabType.TabForTable,
databaseId: treeNode.databaseId,
tableName: treeNode.tableName,
});
@@ -565,36 +565,36 @@ const handleSelectedKeysChange = (selectedKeys: string[]) => {
</script>
<style>
-.ui-editor-database-tree .n-tree-node-wrapper {
+.schema-editor-database-tree .n-tree-node-wrapper {
@apply !py-px;
}
-.ui-editor-database-tree .n-tree-node-content__prefix {
+.schema-editor-database-tree .n-tree-node-content__prefix {
@apply shrink-0 !mr-1;
}
-.ui-editor-database-tree .n-tree-node-content__text {
+.schema-editor-database-tree .n-tree-node-content__text {
@apply truncate mr-1;
}
-.ui-editor-database-tree .n-tree-node-content__suffix {
+.schema-editor-database-tree .n-tree-node-content__suffix {
@apply rounded-sm !hidden hover:opacity-80;
}
-.ui-editor-database-tree
+.schema-editor-database-tree
.n-tree-node-wrapper:hover
.n-tree-node-content__suffix {
@apply !flex;
}
-.ui-editor-database-tree
+.schema-editor-database-tree
.n-tree-node-wrapper
.n-tree-node--selected
.n-tree-node-content__suffix {
@apply !flex;
}
-.ui-editor-database-tree .n-tree-node-switcher {
+.schema-editor-database-tree .n-tree-node-switcher {
@apply px-0 !w-4 !h-7;
}
</style>
<style scoped>
-.ui-editor-database-tree {
+.schema-editor-database-tree {
@apply overflow-y-auto;
max-height: calc(100% - 48px);
}
diff --git a/frontend/src/components/UIEditor/EmptyTips.vue b/frontend/src/components/SchemaEditor/EmptyTips.vue
similarity index 83%
rename from frontend/src/components/UIEditor/EmptyTips.vue
rename to frontend/src/components/SchemaEditor/EmptyTips.vue
index a25e2327fc..b74e12488c 100644
--- a/frontend/src/components/UIEditor/EmptyTips.vue
+++ b/frontend/src/components/SchemaEditor/EmptyTips.vue
@@ -3,6 +3,6 @@
class="w-full h-full flex flex-row justify-center items-center text-gray-600 font-medium"
>
<heroicons-solid:pencil-square class="w-4 h-auto mr-2" />
- {{ $t("ui-editor.use-tips") }}
+ {{ $t("schema-editor.use-tips") }}
</div>
</template>
diff --git a/frontend/src/components/UIEditor/Modals/ActionConfirmModal.vue b/frontend/src/components/SchemaEditor/Modals/ActionConfirmModal.vue
similarity index 100%
rename from frontend/src/components/UIEditor/Modals/ActionConfirmModal.vue
rename to frontend/src/components/SchemaEditor/Modals/ActionConfirmModal.vue
diff --git a/frontend/src/components/UIEditor/Modals/TableNameModal.vue b/frontend/src/components/SchemaEditor/Modals/TableNameModal.vue
similarity index 86%
rename from frontend/src/components/UIEditor/Modals/TableNameModal.vue
rename to frontend/src/components/SchemaEditor/Modals/TableNameModal.vue
index 0d0d985561..6fcbee3452 100644
--- a/frontend/src/components/UIEditor/Modals/TableNameModal.vue
+++ b/frontend/src/components/SchemaEditor/Modals/TableNameModal.vue
@@ -2,14 +2,14 @@
<BBModal
:title="
isCreatingTable
- ? $t('ui-editor.actions.create-table')
- : $t('ui-editor.actions.rename')
+ ? $t('schema-editor.actions.create-table')
+ : $t('schema-editor.actions.rename')
"
class="shadow-inner outline outline-gray-200"
@close="dismissModal"
>
<div class="w-72">
- <p>{{ $t("ui-editor.table.name") }}</p>
+ <p>{{ $t("schema-editor.table.name") }}</p>
<BBTextField
class="my-2 w-full"
:required="true"
@@ -32,17 +32,17 @@
<script lang="ts" setup>
import { computed, PropType, reactive } from "vue";
import { useI18n } from "vue-i18n";
-import { DatabaseId, UNKNOWN_ID, UIEditorTabType, unknown } from "@/types";
-import { TableTabContext } from "@/types/UIEditor";
+import { DatabaseId, UNKNOWN_ID, SchemaEditorTabType, unknown } from "@/types";
+import { TableTabContext } from "@/types/schemaEditor";
import {
- useUIEditorStore,
+ useSchemaEditorStore,
useNotificationStore,
generateUniqueTabId,
} from "@/store";
import {
transformColumnDataToColumn,
transformTableDataToTable,
-} from "@/utils/UIEditor/transform";
+} from "@/utils/schemaEditor/transform";
const tableNameFieldRegexp = /^\S+$/;
@@ -66,7 +66,7 @@ const emit = defineEmits<{
}>();
const { t } = useI18n();
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const notificationStore = useNotificationStore();
const state = reactive<LocalState>({
tableName: props.tableName || "",
@@ -85,7 +85,7 @@ const handleConfirmButtonClick = async () => {
notificationStore.pushNotification({
module: "bytebase",
style: "CRITICAL",
- title: t("ui-editor.message.invalid-table-name"),
+ title: t("schema-editor.message.invalid-table-name"),
});
return;
}
@@ -99,7 +99,7 @@ const handleConfirmButtonClick = async () => {
notificationStore.pushNotification({
module: "bytebase",
style: "CRITICAL",
- title: t("ui-editor.message.duplicated-table-name"),
+ title: t("schema-editor.message.duplicated-table-name"),
});
return;
}
@@ -122,7 +122,7 @@ const handleConfirmButtonClick = async () => {
editorStore.tableList.push(table);
editorStore.addTab({
id: generateUniqueTabId(),
- type: UIEditorTabType.TabForTable,
+ type: SchemaEditorTabType.TabForTable,
databaseId: props.databaseId,
tableName: table.newName,
});
diff --git a/frontend/src/components/UIEditor/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditor/Panels/DatabaseEditor.vue
similarity index 90%
rename from frontend/src/components/UIEditor/Panels/DatabaseEditor.vue
rename to frontend/src/components/SchemaEditor/Panels/DatabaseEditor.vue
index 0592e38241..2d1e48d13f 100644
--- a/frontend/src/components/UIEditor/Panels/DatabaseEditor.vue
+++ b/frontend/src/components/SchemaEditor/Panels/DatabaseEditor.vue
@@ -10,7 +10,7 @@
'bg-white border-gray-300 text-gray-800'
"
@click="handleChangeTab('table-list')"
- >{{ $t("ui-editor.table-list") }}</span
+ >{{ $t("schema-editor.table-list") }}</span
>
<span
class="hidden -mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none"
@@ -28,7 +28,7 @@
'bg-white border-gray-300 text-gray-800'
"
@click="handleChangeTab('raw-sql')"
- >{{ $t("ui-editor.raw-sql") }}</span
+ >{{ $t("schema-editor.raw-sql") }}</span
>
</div>
@@ -40,7 +40,7 @@
@click="handleCreateNewTable"
>
<heroicons-outline:plus class="w-4 h-auto mr-1 text-gray-400" />
- {{ $t("ui-editor.actions.create-table") }}
+ {{ $t("schema-editor.actions.create-table") }}
</button>
</div>
<!-- table list -->
@@ -101,7 +101,7 @@
@click="handleDropTable(table)"
/>
</template>
- <span>{{ $t("ui-editor.actions.drop-table") }}</span>
+ <span>{{ $t("schema-editor.actions.drop-table") }}</span>
</n-tooltip>
<n-tooltip v-else trigger="hover">
<template #trigger>
@@ -110,7 +110,7 @@
@click="handleRestoreTable(table)"
/>
</template>
- <span>{{ $t("ui-editor.actions.restore") }}</span>
+ <span>{{ $t("schema-editor.actions.restore") }}</span>
</n-tooltip>
</div>
</div>
@@ -138,7 +138,7 @@
:code="state.statement"
></HighlightCodeBlock>
<div v-else class="flex px-3 py-2 italic text-sm text-gray-600">
- {{ $t("ui-editor.nothing-changed") }}
+ {{ $t("schema-editor.nothing-changed") }}
</div>
</template>
</div>
@@ -160,14 +160,14 @@ import {
generateUniqueTabId,
useDatabaseStore,
useNotificationStore,
- useUIEditorStore,
+ useSchemaEditorStore,
} from "@/store";
-import { DatabaseId, DatabaseTabContext, UIEditorTabType } from "@/types";
-import { Table } from "@/types/UIEditor";
+import { DatabaseId, DatabaseTabContext, SchemaEditorTabType } from "@/types";
+import { Table } from "@/types/schemaEditor";
import { bytesToString } from "@/utils";
import HighlightCodeBlock from "@/components/HighlightCodeBlock";
import TableNameModal from "../Modals/TableNameModal.vue";
-import { diffTableList } from "@/utils/UIEditor/diffTable";
+import { diffTableList } from "@/utils/schemaEditor/diffTable";
type TabType = "table-list" | "er-diagram" | "raw-sql";
@@ -182,7 +182,7 @@ interface LocalState {
}
const { t } = useI18n();
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const databaseStore = useDatabaseStore();
const notificationStore = useNotificationStore();
const state = reactive<LocalState>({
@@ -202,27 +202,27 @@ const tableHeaderList = computed(() => {
return [
{
key: "name",
- label: t("ui-editor.database.name"),
+ label: t("schema-editor.database.name"),
},
{
key: "raw-count",
- label: t("ui-editor.database.row-count"),
+ label: t("schema-editor.database.row-count"),
},
{
key: "data-size",
- label: t("ui-editor.database.data-size"),
+ label: t("schema-editor.database.data-size"),
},
{
key: "engine",
- label: t("ui-editor.database.engine"),
+ label: t("schema-editor.database.engine"),
},
{
key: "collation",
- label: t("ui-editor.database.collation"),
+ label: t("schema-editor.database.collation"),
},
{
key: "comment",
- label: t("ui-editor.database.comment"),
+ label: t("schema-editor.database.comment"),
},
];
});
@@ -291,7 +291,7 @@ const handleCreateNewTable = () => {
const handleTableItemClick = (table: Table) => {
editorStore.addTab({
id: generateUniqueTabId(),
- type: UIEditorTabType.TabForTable,
+ type: SchemaEditorTabType.TabForTable,
databaseId: database.id,
tableName: table.newName,
});
diff --git a/frontend/src/components/UIEditor/Panels/TableEditor.vue b/frontend/src/components/SchemaEditor/Panels/TableEditor.vue
similarity index 93%
rename from frontend/src/components/UIEditor/Panels/TableEditor.vue
rename to frontend/src/components/SchemaEditor/Panels/TableEditor.vue
index 186f36c400..6bd6ab8363 100644
--- a/frontend/src/components/UIEditor/Panels/TableEditor.vue
+++ b/frontend/src/components/SchemaEditor/Panels/TableEditor.vue
@@ -10,7 +10,7 @@
'bg-white border-gray-300 text-gray-800'
"
@click="handleChangeTab('column-list')"
- >{{ $t("ui-editor.column-list") }}</span
+ >{{ $t("schema-editor.column-list") }}</span
>
<span
class="-mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none"
@@ -19,7 +19,7 @@
'bg-white border-gray-300 text-gray-800'
"
@click="handleChangeTab('raw-sql')"
- >{{ $t("ui-editor.raw-sql") }}</span
+ >{{ $t("schema-editor.raw-sql") }}</span
>
</div>
@@ -32,7 +32,7 @@
@click="handleAddColumn"
>
<heroicons-outline:plus class="w-4 h-auto mr-1 text-gray-400" />
- {{ $t("ui-editor.actions.add-column") }}
+ {{ $t("schema-editor.actions.add-column") }}
</button>
</div>
<div class="w-auto flex flex-row justify-end items-center space-x-3">
@@ -45,7 +45,7 @@
<heroicons-solid:arrow-uturn-left
class="w-4 h-auto mr-1 text-gray-400"
/>
- {{ $t("ui-editor.actions.reset") }}
+ {{ $t("schema-editor.actions.reset") }}
</button>
</div>
</div>
@@ -163,7 +163,7 @@
<heroicons:trash class="w-4 h-auto" />
</button>
</template>
- <span>{{ $t("ui-editor.actions.drop-column") }}</span>
+ <span>{{ $t("schema-editor.actions.drop-column") }}</span>
</n-tooltip>
<n-tooltip v-else trigger="hover">
<template #trigger>
@@ -175,7 +175,7 @@
<heroicons:arrow-uturn-left class="w-4 h-auto" />
</button>
</template>
- <span>{{ $t("ui-editor.actions.restore") }}</span>
+ <span>{{ $t("schema-editor.actions.restore") }}</span>
</n-tooltip>
</div>
</div>
@@ -200,7 +200,7 @@
:code="state.statement"
></HighlightCodeBlock>
<div v-else class="flex px-3 py-2 italic text-sm text-gray-600">
- {{ $t("ui-editor.nothing-changed") }}
+ {{ $t("schema-editor.nothing-changed") }}
</div>
</template>
</div>
@@ -215,15 +215,15 @@ import { useDebounceFn } from "@vueuse/core";
import {
useDatabaseStore,
useNotificationStore,
- useUIEditorStore,
+ useSchemaEditorStore,
} from "@/store/modules";
import { TableTabContext, unknown } from "@/types";
import { BBCheckbox, BBSpin } from "@/bbkit";
import { getDataTypeSuggestionList } from "@/utils";
-import { diffTableList } from "@/utils/UIEditor/diffTable";
+import { diffTableList } from "@/utils/schemaEditor/diffTable";
+import { transformColumnDataToColumn } from "@/utils/schemaEditor/transform";
import HighlightCodeBlock from "@/components/HighlightCodeBlock";
-import { Column, DatabaseEdit, Table } from "@/types/UIEditor";
-import { transformColumnDataToColumn } from "@/utils/UIEditor/transform";
+import { Column, DatabaseEdit, Table } from "@/types/schemaEditor";
type TabType = "column-list" | "raw-sql";
@@ -235,7 +235,7 @@ interface LocalState {
}
const { t } = useI18n();
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const databaseStore = useDatabaseStore();
const notificationStore = useNotificationStore();
const currentTab = editorStore.currentTab as TableTabContext;
@@ -271,23 +271,23 @@ const columnHeaderList = computed(() => {
return [
{
key: "name",
- label: t("ui-editor.column.name"),
+ label: t("schema-editor.column.name"),
},
{
key: "type",
- label: t("ui-editor.column.type"),
+ label: t("schema-editor.column.type"),
},
{
key: "default",
- label: t("ui-editor.column.default"),
+ label: t("schema-editor.column.default"),
},
{
key: "comment",
- label: t("ui-editor.column.comment"),
+ label: t("schema-editor.column.comment"),
},
{
key: "nullable",
- label: t("ui-editor.column.not-null"),
+ label: t("schema-editor.column.not-null"),
},
];
});
diff --git a/frontend/src/components/UIEditor/UIEditor.vue b/frontend/src/components/SchemaEditor/SchemaEditor.vue
similarity index 89%
rename from frontend/src/components/UIEditor/UIEditor.vue
rename to frontend/src/components/SchemaEditor/SchemaEditor.vue
index b2b5457ff2..443b0e7fd7 100644
--- a/frontend/src/components/UIEditor/UIEditor.vue
+++ b/frontend/src/components/SchemaEditor/SchemaEditor.vue
@@ -15,10 +15,10 @@
class="w-full h-auto relative overflow-y-auto"
>
<DatabaseEditor
- v-if="currentTab.type === UIEditorTabType.TabForDatabase"
+ v-if="currentTab.type === SchemaEditorTabType.TabForDatabase"
/>
<TableEditor
- v-else-if="currentTab.type === UIEditorTabType.TabForTable"
+ v-else-if="currentTab.type === SchemaEditorTabType.TabForTable"
/>
</div>
</template>
@@ -33,8 +33,8 @@
import { uniq } from "lodash-es";
import { Splitpanes, Pane } from "splitpanes";
import { computed, onMounted, PropType, reactive } from "vue";
-import { useInstanceStore, useUIEditorStore } from "@/store";
-import { DatabaseId, UIEditorTabType } from "@/types";
+import { useInstanceStore, useSchemaEditorStore } from "@/store";
+import { DatabaseId, SchemaEditorTabType } from "@/types";
import AsidePanel from "./AsidePanel.vue";
import EmptyTips from "./EmptyTips.vue";
import TabsContainer from "./TabsContainer.vue";
@@ -55,7 +55,7 @@ const state = reactive<LocalState>({
isLoading: true,
});
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const instanceStore = useInstanceStore();
const currentTab = computed(() => {
return editorStore.currentTab;
diff --git a/frontend/src/components/UIEditor/TabsContainer.vue b/frontend/src/components/SchemaEditor/TabsContainer.vue
similarity index 87%
rename from frontend/src/components/UIEditor/TabsContainer.vue
rename to frontend/src/components/SchemaEditor/TabsContainer.vue
index fbcfe75527..268623b982 100644
--- a/frontend/src/components/UIEditor/TabsContainer.vue
+++ b/frontend/src/components/SchemaEditor/TabsContainer.vue
@@ -17,11 +17,11 @@
<div class="flex flex-row justify-start items-center mr-1">
<span class="mr-1">
<heroicons-outline:circle-stack
- v-if="tab.type === UIEditorTabType.TabForDatabase"
+ v-if="tab.type === SchemaEditorTabType.TabForDatabase"
class="rounded w-4 h-auto text-gray-400"
/>
<heroicons-outline:table-cells
- v-else-if="tab.type === UIEditorTabType.TabForTable"
+ v-else-if="tab.type === SchemaEditorTabType.TabForTable"
class="rounded w-4 h-auto text-gray-400"
/>
</span>
@@ -47,10 +47,10 @@ import { isEqual } from "lodash-es";
import { NEllipsis } from "naive-ui";
import { computed, nextTick, ref, watch } from "vue";
import scrollIntoView from "scroll-into-view-if-needed";
-import { useUIEditorStore } from "@/store";
-import { TabContext, UIEditorTabType } from "@/types";
+import { useSchemaEditorStore } from "@/store";
+import { TabContext, SchemaEditorTabType } from "@/types";
-const editorStore = useUIEditorStore();
+const editorStore = useSchemaEditorStore();
const tabsContainerRef = ref();
const tabList = computed(() => {
return Array.from(editorStore.tabState.tabMap.values());
@@ -76,7 +76,7 @@ watch(
);
const getTabComputedClassList = (tab: TabContext) => {
- if (tab.type === UIEditorTabType.TabForTable) {
+ if (tab.type === SchemaEditorTabType.TabForTable) {
const table = editorStore.getTableWithTableTab(tab);
if (!table) {
return [];
@@ -102,12 +102,12 @@ const getTabComputedClassList = (tab: TabContext) => {
};
const getTabName = (tab: TabContext) => {
- if (tab.type === UIEditorTabType.TabForDatabase) {
+ if (tab.type === SchemaEditorTabType.TabForDatabase) {
const database = editorStore.databaseList.find(
(database) => database.id === tab.databaseId
);
return `${database?.name || "unknown database"}`;
- } else if (tab.type === UIEditorTabType.TabForTable) {
+ } else if (tab.type === SchemaEditorTabType.TabForTable) {
return `${tab.tableName}`;
} else {
// Should never reach here.
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index e811d91bbd..b4e8742703 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1406,11 +1406,11 @@
"self": "Admin mode"
}
},
- "ui-editor": {
- "self": "UI Editor",
+ "schema-editor": {
+ "self": "Schema Editor",
"use-tips": "Click a database/table to start.",
"preview-issue": "Preview issue",
- "sync-sql-from-ui-editor": "Sync SQL from UI Editor",
+ "sync-sql-from-schema-editor": "Sync SQL from UI Editor",
"raw-sql": "Raw SQL",
"actions": {
"create-table": "New table",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 21073de7f5..d8cc2a6d47 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1406,11 +1406,11 @@
"self": "管理员模式"
}
},
- "ui-editor": {
- "self": "UI 编辑器",
+ "schema-editor": {
+ "self": "Schema 编辑器",
"use-tips": "选择需要编辑的数据库或者表",
"preview-issue": "预览工单",
- "sync-sql-from-ui-editor": "从 UI 编辑器中同步 SQL",
+ "sync-sql-from-schema-editor": "从 UI 编辑器中同步 SQL",
"raw-sql": "SQL 语句",
"actions": {
"create-table": "新建表",
diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.ts
index a3ce7d1a4f..3a555bb51d 100644
--- a/frontend/src/store/modules/index.ts
+++ b/frontend/src/store/modules/index.ts
@@ -42,4 +42,4 @@ export * from "./view";
export * from "./dbExtension";
export * from "./sqlReview";
export * from "./onboardingGuide";
-export * from "./UIEditor";
+export * from "./schemaEditor";
diff --git a/frontend/src/store/modules/UIEditor.ts b/frontend/src/store/modules/schemaEditor.ts
similarity index 86%
rename from frontend/src/store/modules/UIEditor.ts
rename to frontend/src/store/modules/schemaEditor.ts
index 7dd94dea05..d0fd032e5c 100644
--- a/frontend/src/store/modules/UIEditor.ts
+++ b/frontend/src/store/modules/schemaEditor.ts
@@ -5,21 +5,21 @@ import {
DatabaseId,
Database,
TabContext,
- UIEditorState,
- UIEditorTabType,
+ SchemaEditorState,
+ SchemaEditorTabType,
TableTabContext,
DatabaseEdit,
ResourceObject,
} from "@/types";
-import { DatabaseEditResult, Table } from "@/types/UIEditor";
-import { useDatabaseStore, useTableStore } from "./";
-import { transformTableDataToTable } from "@/utils/UIEditor/transform";
+import { DatabaseEditResult, Table } from "@/types/schemaEditor";
+import { useDatabaseStore, useTableStore } from ".";
+import { transformTableDataToTable } from "@/utils/schemaEditor/transform";
export const generateUniqueTabId = () => {
return uniqueId();
};
-const getDefaultUIEditorState = (): UIEditorState => {
+const getDefaultSchemaEditorState = (): SchemaEditorState => {
return {
tabState: {
tabMap: new Map<string, TabContext>(),
@@ -39,9 +39,9 @@ function convertDatabaseEditResult(
} as any as DatabaseEditResult;
}
-export const useUIEditorStore = defineStore("UIEditor", {
- state: (): UIEditorState => {
- return getDefaultUIEditorState();
+export const useSchemaEditorStore = defineStore("SchemaEditor", {
+ state: (): SchemaEditorState => {
+ return getDefaultSchemaEditorState();
},
getters: {
currentTab(state) {
@@ -62,13 +62,13 @@ export const useUIEditorStore = defineStore("UIEditor", {
}
if (
- item.type === UIEditorTabType.TabForDatabase &&
+ item.type === SchemaEditorTabType.TabForDatabase &&
item.databaseId === tab.databaseId
) {
return true;
}
if (
- item.type === UIEditorTabType.TabForTable &&
+ item.type === SchemaEditorTabType.TabForTable &&
item.databaseId === tab.databaseId &&
item.tableName === (tab as TableTabContext).tableName
) {
@@ -115,9 +115,9 @@ export const useUIEditorStore = defineStore("UIEditor", {
this.tabState.tabMap.delete(tabId);
},
findTab(databaseId: DatabaseId, tableName?: string) {
- let tabType = UIEditorTabType.TabForDatabase;
+ let tabType = SchemaEditorTabType.TabForDatabase;
if (tableName !== undefined) {
- tabType = UIEditorTabType.TabForTable;
+ tabType = SchemaEditorTabType.TabForTable;
}
const tab = this.tabList.find((tab) => {
@@ -125,10 +125,10 @@ export const useUIEditorStore = defineStore("UIEditor", {
return false;
}
- if (tab.type === UIEditorTabType.TabForDatabase) {
+ if (tab.type === SchemaEditorTabType.TabForDatabase) {
return true;
} else if (
- tab.type === UIEditorTabType.TabForTable &&
+ tab.type === SchemaEditorTabType.TabForTable &&
tab.tableName === tableName
) {
return true;
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index a5a6662cad..182dd503a8 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -49,5 +49,5 @@ export * from "./sheetOrganizer";
export * from "./sqlReview";
export * from "./utils";
export * from "./onboardingGuide";
-export * from "./UIEditor";
+export * from "./schemaEditor";
export * from "./externalApproval";
diff --git a/frontend/src/types/UIEditor.ts b/frontend/src/types/schemaEditor.ts
similarity index 94%
rename from frontend/src/types/UIEditor.ts
rename to frontend/src/types/schemaEditor.ts
index 171d8a5ce8..b479d2b627 100644
--- a/frontend/src/types/UIEditor.ts
+++ b/frontend/src/types/schemaEditor.ts
@@ -36,7 +36,7 @@ export interface Table {
status: TableOrColumnStatus;
}
-export enum UIEditorTabType {
+export enum SchemaEditorTabType {
TabForDatabase = "database",
TabForTable = "table",
}
@@ -44,14 +44,14 @@ export enum UIEditorTabType {
// Tab context for editing database.
export interface DatabaseTabContext {
id: string;
- type: UIEditorTabType.TabForDatabase;
+ type: SchemaEditorTabType.TabForDatabase;
databaseId: DatabaseId;
}
// Tab context for editing table.
export interface TableTabContext {
id: string;
- type: UIEditorTabType.TabForTable;
+ type: SchemaEditorTabType.TabForTable;
databaseId: DatabaseId;
tableName: string;
}
@@ -60,7 +60,7 @@ export type TabContext = DatabaseTabContext | TableTabContext;
type TabId = string;
-export interface UIEditorState {
+export interface SchemaEditorState {
tabState: {
tabMap: Map<TabId, TabContext>;
currentTabId?: TabId;
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 3198df0588..17ae1cce31 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -22,4 +22,4 @@ export * from "./sheet";
export * from "./pev2";
export * from "./web-storage";
export * from "./dom";
-export * from "./UIEditor";
+export * from "./schemaEditor";
diff --git a/frontend/src/utils/UIEditor/diffColumn.test.ts b/frontend/src/utils/schemaEditor/diffColumn.test.ts
similarity index 99%
rename from frontend/src/utils/UIEditor/diffColumn.test.ts
rename to frontend/src/utils/schemaEditor/diffColumn.test.ts
index e59648a50e..6f8e54295c 100644
--- a/frontend/src/utils/UIEditor/diffColumn.test.ts
+++ b/frontend/src/utils/schemaEditor/diffColumn.test.ts
@@ -4,7 +4,7 @@ import {
DropColumnContext,
ChangeColumnContext,
} from "@/types";
-import { Column } from "@/types/UIEditor";
+import { Column } from "@/types/schemaEditor";
import { diffColumnList } from "./diffColumn";
it("diff add column list", () => {
diff --git a/frontend/src/utils/UIEditor/diffColumn.ts b/frontend/src/utils/schemaEditor/diffColumn.ts
similarity index 97%
rename from frontend/src/utils/UIEditor/diffColumn.ts
rename to frontend/src/utils/schemaEditor/diffColumn.ts
index 534c2d9657..a9d26a9847 100644
--- a/frontend/src/utils/UIEditor/diffColumn.ts
+++ b/frontend/src/utils/schemaEditor/diffColumn.ts
@@ -4,7 +4,7 @@ import type {
DropColumnContext,
ChangeColumnContext,
} from "@/types";
-import { Column } from "@/types/UIEditor";
+import { Column } from "@/types/schemaEditor";
import {
transformColumnToAddColumnContext,
transformColumnToChangeColumnContext,
diff --git a/frontend/src/utils/UIEditor/diffTable.test.ts b/frontend/src/utils/schemaEditor/diffTable.test.ts
similarity index 99%
rename from frontend/src/utils/UIEditor/diffTable.test.ts
rename to frontend/src/utils/schemaEditor/diffTable.test.ts
index 8ab7947332..5633b99fda 100644
--- a/frontend/src/utils/UIEditor/diffTable.test.ts
+++ b/frontend/src/utils/schemaEditor/diffTable.test.ts
@@ -5,7 +5,7 @@ import {
AlterTableContext,
RenameTableContext,
} from "@/types";
-import { Table } from "@/types/UIEditor";
+import { Table } from "@/types/schemaEditor";
import { UNKNOWN_ID } from "@/types/const";
import { diffTableList } from "./diffTable";
diff --git a/frontend/src/utils/UIEditor/diffTable.ts b/frontend/src/utils/schemaEditor/diffTable.ts
similarity index 98%
rename from frontend/src/utils/UIEditor/diffTable.ts
rename to frontend/src/utils/schemaEditor/diffTable.ts
index 4f4674b17c..928220dd91 100644
--- a/frontend/src/utils/UIEditor/diffTable.ts
+++ b/frontend/src/utils/schemaEditor/diffTable.ts
@@ -5,7 +5,7 @@ import type {
DropTableContext,
RenameTableContext,
} from "@/types";
-import { Table } from "@/types/UIEditor";
+import { Table } from "@/types/schemaEditor";
import { transformTableToCreateTableContext } from "./transform";
import { diffColumnList } from "./diffColumn";
diff --git a/frontend/src/utils/UIEditor/index.ts b/frontend/src/utils/schemaEditor/index.ts
similarity index 77%
rename from frontend/src/utils/UIEditor/index.ts
rename to frontend/src/utils/schemaEditor/index.ts
index cad2597922..319412710a 100644
--- a/frontend/src/utils/UIEditor/index.ts
+++ b/frontend/src/utils/schemaEditor/index.ts
@@ -1,7 +1,7 @@
import { Database, EngineType } from "@/types";
-// Only allow using UI Editor with MySQL.
-export const allowUsingUIEditor = (databaseList: Database[]): boolean => {
+// Only allow using Schema Editor with MySQL.
+export const allowUsingSchemaEditor = (databaseList: Database[]): boolean => {
return databaseList.every((db) => {
return db.instance.engine === "MYSQL";
});
diff --git a/frontend/src/utils/UIEditor/transform.ts b/frontend/src/utils/schemaEditor/transform.ts
similarity index 97%
rename from frontend/src/utils/UIEditor/transform.ts
rename to frontend/src/utils/schemaEditor/transform.ts
index fae78d9ebe..ae43c10a89 100644
--- a/frontend/src/utils/UIEditor/transform.ts
+++ b/frontend/src/utils/schemaEditor/transform.ts
@@ -6,7 +6,7 @@ import {
Column as ColumnData,
Table as TableData,
} from "@/types";
-import { Column, Table } from "@/types/UIEditor";
+import { Column, Table } from "@/types/schemaEditor";
export const transformTableDataToTable = (tableData: TableData): Table => {
const columnList = tableData.columnList.map((columnData) =>
diff --git a/frontend/src/utils/UIEditor/validate.ts b/frontend/src/utils/schemaEditor/validate.ts
similarity index 100%
rename from frontend/src/utils/UIEditor/validate.ts
rename to frontend/src/utils/schemaEditor/validate.ts
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index caea395e59..17d3a553ea 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -321,7 +321,7 @@ import {
allowGhostMigration,
isPITRDatabase,
isDatabaseAccessible,
- allowUsingUIEditor,
+ allowUsingSchemaEditor,
isArchivedDatabase,
} from "@/utils";
import {
@@ -578,7 +578,7 @@ const createMigration = async (
if (database.value.project.workflowType == "UI") {
let mode: "online" | "normal" | false = "normal";
if (type === "bb.issue.database.schema.update") {
- if (allowUsingUIEditor([database.value])) {
+ if (allowUsingSchemaEditor([database.value])) {
state.showSchemaEditorModal = true;
return;
}