Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: update i18n for UI editor (#3672)
boojack65931ca59e1e
diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vueindex c89560fd45..e5f2479138 100644--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue@@ -1,7 +1,7 @@<template><BBModal- :title="'Alter Schema'"- class="ui-editor-modal-container !w-320 !max-w-[calc(100%-80px)]"+ :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)]"@close="dismissModal"><div@@ -15,7 +15,7 @@"@click="handleChangeTab('ui-editor')">- UI Editor+ {{ $t("ui-editor.self") }}</button><buttonclass="-mb-px px-3 leading-9 rounded-t-md text-sm text-gray-500 border border-b-0 border-transparent cursor-pointer select-none"@@ -25,10 +25,10 @@"@click="handleChangeTab('raw-sql')">- Raw SQL+ {{ $t("ui-editor.raw-sql") }}</button></div>- <div class="w-full h-144 border-b mb-4">+ <div class="w-full h-full max-h-full overflow-auto border-b mb-4"><UIEditorv-show="state.selectedTab === 'ui-editor'":database-id-list="props.databaseIdList"@@ -40,13 +40,13 @@<divclass="w-full h-full pl-3 shrink-0 flex flex-row justify-between items-center">- <div>SQL Editor</div>+ <div>{{ $t("sql-editor.self") }}</div><div><buttonclass="text-sm border px-3 leading-8 rounded cursor-pointer hover:bg-gray-100"@click="handleSyncSQLFromUIEditor">- Sync SQL from UI Editor+ {{ $t("ui-editor.sync-sql-from-ui-editor") }}</button></div></div>@@ -61,15 +61,12 @@/></div></div>- <div class="flex items-center justify-end">- <button type="button" class="btn-normal py-2 px-4" @click="dismissModal">+ <div class="w-full flex items-center justify-end mt-2 space-x-3">+ <button type="button" class="btn-normal" @click="dismissModal">{{ $t("common.cancel") }}</button>- <button- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"- @click="handlePreviewIssue"- >- {{ $t("database.ui-editor.preview-issue") }}+ <button class="btn-primary" @click="handlePreviewIssue">+ {{ $t("ui-editor.preview-issue") }}</button></div></BBModal>@@ -365,6 +362,7 @@ const generateIssueName = (<style>.ui-editor-modal-container > .modal-container {- @apply w-full h-full overflow-auto;+ @apply w-full h-160 overflow-auto grid;+ grid-template-rows: min-content 1fr min-content;}</style>diff --git a/frontend/src/components/UIEditor/DatabaseTree.vue b/frontend/src/components/UIEditor/DatabaseTree.vueindex 52bf7891ec..946a466634 100644--- a/frontend/src/components/UIEditor/DatabaseTree.vue+++ b/frontend/src/components/UIEditor/DatabaseTree.vue@@ -67,6 +67,7 @@ import InstanceEngineIcon from "@/components/InstanceEngineIcon.vue";import DatabaseIcon from "~icons/heroicons-outline/database";import TableIcon from "~icons/heroicons-outline/table";import EllipsisIcon from "~icons/heroicons-solid/ellipsis-horizontal";+import { useI18n } from "vue-i18n";interface BaseTreeNode extends TreeOption {key: string;@@ -107,6 +108,7 @@ interface LocalState {shouldRelocateTreeNode: boolean;}+const { t } = useI18n();const editorStore = useUIEditorStore();const instanceStore = useInstanceStore();const tableStore = useTableStore();@@ -136,8 +138,8 @@ const contextMenuOptions = computed(() => {if (treeNode?.type === "database") {const options = [];options.push({- key: "new-table",- label: "New Table",+ key: "create-table",+ label: t("ui-editor.actions.create-table"),});return options;} else if (treeNode?.type === "table") {@@ -146,12 +148,12 @@ const contextMenuOptions = computed(() => {if (isDropped) {options.push({key: "restore",- label: "Restore",+ label: t("ui-editor.actions.restore"),});} else {options.push({key: "drop",- label: "Drop",+ label: t("ui-editor.actions.drop"),});}return options;@@ -470,7 +472,7 @@ const nodeProps = ({ option: treeNode }: { option: TreeNode }) => {const handleContextMenuDropdownSelect = async (key: string) => {const treeNode = contextMenu.treeNode;if (treeNode?.type === "database") {- if (key === "new-table") {+ if (key === "create-table") {await editorStore.getOrFetchTableListByDatabaseId(treeNode.databaseId);const table = editorStore.createNewTable(treeNode.databaseId);editorStore.addTab({diff --git a/frontend/src/components/UIEditor/EmptyTips.vue b/frontend/src/components/UIEditor/EmptyTips.vueindex 11fd31c3d7..a25e2327fc 100644--- a/frontend/src/components/UIEditor/EmptyTips.vue+++ b/frontend/src/components/UIEditor/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" />- Click a database/table to start.+ {{ $t("ui-editor.use-tips") }}</div></template>diff --git a/frontend/src/components/UIEditor/Panels/DatabaseEditor.vue b/frontend/src/components/UIEditor/Panels/DatabaseEditor.vueindex e6be7258bd..b34efe9ab4 100644--- a/frontend/src/components/UIEditor/Panels/DatabaseEditor.vue+++ b/frontend/src/components/UIEditor/Panels/DatabaseEditor.vue@@ -10,7 +10,7 @@'bg-white border-gray-300 text-gray-800'"@click="handleChangeTab('list')"- >List</span+ >{{ $t("ui-editor.list") }}</span><spanclass="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,20 +28,22 @@'bg-white border-gray-300 text-gray-800'"@click="handleChangeTab('raw-sql')"- >Raw SQL</span+ >{{ $t("ui-editor.raw-sql") }}</span></div><!-- List view --><template v-if="state.selectedTab === 'list'"><div class="py-2 w-full flex justify-between items-center space-x-2">- <span class="ml-3 text-sm text-gray-500">Tables</span>+ <span class="ml-3 text-sm text-gray-500">{{+ $t("ui-editor.tables")+ }}</span><buttonclass="flex flex-row justify-center items-center border px-3 py-1 leading-6 rounded text-sm hover:bg-gray-100"@click="handleCreateNewTable"><heroicons-outline:plus class="w-4 h-auto mr-1 text-gray-400" />- New Table+ {{ $t("ui-editor.actions.create-table") }}</button></div><!-- table list -->@@ -92,12 +94,12 @@<div class="w-full flex justify-start items-center"><n-tooltip trigger="hover"><template #trigger>- <heroicons-solid:x-mark+ <heroicons:trashclass="w-[14px] h-auto text-gray-500 cursor-pointer hover:opacity-80"@click="handleDropTable(table)"/></template>- <span>Drop Table</span>+ <span>{{ $t("ui-editor.actions.drop-table") }}</span></n-tooltip></div></div>@@ -105,7 +107,7 @@</div></template><template v-else-if="state.selectedTab === 'er-diagram'">- <p class="px-3 py-2 italic">ER Diagram by zp</p>+ <!-- TODO: ER diagram placeholder --></template><divv-else-if="state.selectedTab === 'raw-sql'"@@ -124,7 +126,9 @@language="sql":code="state.statement"></HighlightCodeBlock>- <span v-else class="px-3 my-2 italic">Nothing changed</span>+ <div v-else class="flex px-3 py-2 italic text-sm text-gray-600">+ {{ $t("ui-editor.nothing-changed") }}+ </div></template></div></div>@@ -142,6 +146,7 @@ import {import { DatabaseTabContext, Table, UIEditorTabType } from "@/types";import { diffTableList } from "@/utils/UIEditor/diffTable";import HighlightCodeBlock from "@/components/HighlightCodeBlock";+import { useI18n } from "vue-i18n";type TabType = "list" | "er-diagram" | "raw-sql";@@ -151,6 +156,7 @@ interface LocalState {statement: string;}+const { t } = useI18n();const editorStore = useUIEditorStore();const databaseStore = useDatabaseStore();const tableStore = useTableStore();@@ -166,27 +172,27 @@ const tableHeaderList = computed(() => {return [{key: "name",- label: "Name",+ label: t("ui-editor.database.name"),},{key: "raw-count",- label: "Row Count",+ label: t("ui-editor.database.row-count"),},{key: "data-size",- label: "Data Size",+ label: t("ui-editor.database.data-size"),},{key: "engine",- label: "Engine",+ label: t("ui-editor.database.engine"),},{key: "collation",- label: "Collation",+ label: t("ui-editor.database.collation"),},{key: "comment",- label: "Comment",+ label: t("ui-editor.database.comment"),},];});diff --git a/frontend/src/components/UIEditor/Panels/TableEditor.vue b/frontend/src/components/UIEditor/Panels/TableEditor.vueindex 83adb70d91..fb25beacee 100644--- a/frontend/src/components/UIEditor/Panels/TableEditor.vue+++ b/frontend/src/components/UIEditor/Panels/TableEditor.vue@@ -6,7 +6,7 @@<div class="flex flex-row items-center space-x-2"><div class="flex flex-row justify-start items-center"><span class="mr-1 text-sm ml-3 whitespace-nowrap text-gray-500"- >Table Name:+ >{{ $t("ui-editor.table.name") }}:</span><inputv-model="tableCache.name"@@ -26,7 +26,7 @@<buttonclass="flex flex-row justify-center items-center border px-3 py-1 leading-6 text-sm text-gray-700 rounded cursor-pointer hover:bg-gray-100">- SQL Preview+ {{ $t("ui-editor.actions.sql-preview") }}</button></template><div class="w-112 min-h-[16em] max-h-[32em] overflow-y-auto">@@ -43,7 +43,9 @@language="sql":code="state.statement"></HighlightCodeBlock>- <span v-else class="py-2 italic">Nothing changed</span>+ <span v-else class="py-2 italic">{{+ $t("ui-editor.nothing-changed")+ }}</span></template></div></NPopover>@@ -55,7 +57,7 @@<heroicons-solid:arrow-uturn-leftclass="w-4 h-auto mr-1 text-gray-400"/>- Discard changes+ {{ $t("ui-editor.actions.discard-changes") }}</button><buttonclass="flex flex-row bg-accent text-white justify-center items-center px-3 py-1 leading-6 text-sm rounded cursor-pointer hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-60"@@ -63,20 +65,22 @@@click="handleSaveChanges"><heroicons-outline:save class="w-4 h-auto mr-1" />- Save+ {{ $t("ui-editor.actions.save") }}</button></div></div><!-- column table --><div class="w-full py-2 flex flex-row justify-between items-center">- <span class="ml-3 text-gray-500 font-normal text-sm">Columns</span>+ <span class="ml-3 text-gray-500 font-normal text-sm">{{+ t("ui-editor.columns")+ }}</span><div><buttonclass="flex flex-row justify-center items-center border px-3 py-1 leading-6 text-sm text-gray-700 rounded cursor-pointer hover:bg-gray-100"@click="handleAddColumn"><heroicons-outline:plus class="w-4 h-auto mr-1 text-gray-400" />- Add column+ {{ $t("ui-editor.actions.add-column") }}</button></div></div>@@ -85,7 +89,7 @@><!-- column table header --><div- class="sticky top-0 z-10 grid grid-cols-[repeat(5,_minmax(0,_1fr))_32px] w-full text-sm leading-6 select-none bg-gray-50 text-gray-400"+ class="sticky top-0 z-10 grid grid-cols-[repeat(4,_minmax(0,_1fr))_112px_32px] w-full text-sm leading-6 select-none bg-gray-50 text-gray-400":class="tableCache.columnList.length > 0 && 'border-b'"><span@@ -101,7 +105,7 @@<divv-for="(column, index) in tableCache.columnList":key="`${index}-${column.id}`"- class="grid grid-cols-[repeat(5,_minmax(0,_1fr))_32px] gr text-sm even:bg-gray-50"+ class="grid grid-cols-[repeat(4,_minmax(0,_1fr))_112px_32px] gr text-sm even:bg-gray-50"><div class="table-body-item-container"><input@@ -132,15 +136,6 @@</button></NDropdown></div>- <div- class="table-body-item-container flex justify-start items-center"- >- <BBCheckbox- class="ml-3"- :value="column.nullable"- @toggle="(value) => (column.nullable = value)"- />- </div><div class="table-body-item-container"><inputv-model="column.default"@@ -157,10 +152,19 @@type="text"/></div>+ <div+ class="table-body-item-container flex justify-start items-center"+ >+ <BBCheckbox+ class="ml-3"+ :value="column.nullable"+ @toggle="(value) => (column.nullable = value)"+ />+ </div><div class="w-full flex justify-start items-center"><n-tooltip trigger="hover"><template #trigger>- <heroicons-solid:x-mark+ <heroicons:trashclass="w-[14px] h-auto text-gray-500 cursor-pointer hover:opacity-80"@click="handleRemoveColumn(column)"/>@@ -177,6 +181,7 @@<script lang="ts" setup>import { cloneDeep, isEqual } from "lodash-es";import { computed, reactive } from "vue";+import { useI18n } from "vue-i18n";import {useNotificationStore,useTableStore,@@ -196,6 +201,7 @@ interface LocalState {statement: string;}+const { t } = useI18n();const state = reactive<LocalState>({isFetchingDDL: false,statement: "",@@ -215,23 +221,23 @@ const columnHeaderList = computed(() => {return [{key: "name",- label: "Name",+ label: t("ui-editor.column.name"),},{key: "type",- label: "Type",- },- {- key: "nullable",- label: "Nullable",+ label: t("ui-editor.column.type"),},{key: "default",- label: "Default",+ label: t("ui-editor.column.default"),},{key: "comment",- label: "Comment",+ label: t("ui-editor.column.comment"),+ },+ {+ key: "nullable",+ label: t("ui-editor.column.is-nullable"),},];});diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex cce504a3c0..12b3168ecb 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -967,9 +967,6 @@"character-sets-diff-found": "There are differences between character sets.","preview-issue": "Preview issue"},- "ui-editor": {- "preview-issue": "Preview issue"- },"sensitive": "Sensitive","access-denied": "You don't have the permission to access this database."},@@ -1393,6 +1390,46 @@},"close-sheet": "Close sheet"},+ "ui-editor": {+ "self": "UI Editor",+ "use-tips": "Click a database/table to start.",+ "preview-issue": "Preview issue",+ "sync-sql-from-ui-editor": "Sync SQL from UI Editor",+ "list": "List",+ "raw-sql": "Raw SQL",+ "actions": {+ "create-table": "New table",+ "drop-table": "Drop table",+ "drop": "Drop",+ "restore": "Restore",+ "add-column": "Add column",+ "drop-column": "Drop column",+ "sql-preview": "SQL Preview",+ "discard-changes": "Discard Changes",+ "save": "Save"+ },+ "database": {+ "name": "Name",+ "row-count": "Row count",+ "data-size": "Data size",+ "engine": "Engine",+ "collation": "Collation",+ "comment": "Comment"+ },+ "tables": "Tables",+ "table": {+ "name": "Table Name"+ },+ "columns": "Columns",+ "column": {+ "name": "Name",+ "type": "Type",+ "default": "Default",+ "comment": "Comment",+ "is-nullable": "Is Nullable"+ },+ "nothing-changed": "Nothing changed"+ },"label": {"empty-label-value": "<Empty Value>","no-label": "No labels",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 5050d0bba0..b446808705 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -967,9 +967,6 @@"character-sets-diff-found": "Schema 之间的字符集不同","preview-issue": "预览工单"},- "ui-editor": {- "preview-issue": "预览工单"- },"sensitive": "敏感","access-denied": "你没有访问该数据库的权限"},@@ -1393,6 +1390,46 @@},"close-sheet": "关闭工作表"},+ "ui-editor": {+ "self": "UI 编辑器",+ "use-tips": "选择需要编辑的数据库或者表",+ "preview-issue": "预览工单",+ "sync-sql-from-ui-editor": "从 UI 编辑器中同步 SQL",+ "list": "列表",+ "raw-sql": "SQL 语句",+ "actions": {+ "create-table": "新建表",+ "drop-table": "删除表",+ "drop": "删除",+ "restore": "恢复",+ "add-column": "添加列",+ "drop-column": "删除列",+ "sql-preview": "预览 SQL",+ "discard-changes": "撤销更改",+ "save": "保存"+ },+ "database": {+ "name": "名称",+ "row-count": "数据行数",+ "data-size": "数据大小",+ "engine": "引擎",+ "collation": "字符排序规则",+ "comment": "注释"+ },+ "tables": "数据表",+ "table": {+ "name": "表名"+ },+ "columns": "数据列",+ "column": {+ "name": "名称",+ "type": "类型",+ "default": "默认值",+ "comment": "注释",+ "nullable": "是否可为空"+ },+ "nothing-changed": "无任何改动"+ },"label": {"empty-label-value": "<空值>","no-label": "没有标签",