Skip to content

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

fix: i18n for tables (#2008)

boojack7e476e38ca2e
diff --git a/frontend/src/components/ActivityTable.vue b/frontend/src/components/ActivityTable.vue
index 773f8a2620..7f226ed847 100644
--- a/frontend/src/components/ActivityTable.vue
+++ b/frontend/src/components/ActivityTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="activityList"
:show-header="true"
:row-clickable="false"
@@ -64,7 +64,7 @@ export default {
setup() {
const { t } = useI18n();
- const COLUMN_LIST = computed((): BBTableColumn[] => [
+ const columnList = computed((): BBTableColumn[] => [
{
title: t("activity.name"),
},
@@ -81,7 +81,7 @@ export default {
return {
activityName,
- COLUMN_LIST,
+ columnList,
};
},
};
diff --git a/frontend/src/components/AnomalyTable.vue b/frontend/src/components/AnomalyTable.vue
index ac4fd0a4d0..0452d3f083 100644
--- a/frontend/src/components/AnomalyTable.vue
+++ b/frontend/src/components/AnomalyTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:section-data-source="anomalySectionList"
:compact-section="compactSection"
:show-header="true"
@@ -11,12 +11,12 @@
<BBTableHeaderCell
:left-padding="4"
class="w-4"
- :title="COLUMN_LIST[0].title"
+ :title="columnList[0].title"
/>
- <BBTableHeaderCell :title="COLUMN_LIST[1].title" />
- <BBTableHeaderCell :title="COLUMN_LIST[2].title" />
- <BBTableHeaderCell :title="COLUMN_LIST[3].title" />
- <BBTableHeaderCell :title="COLUMN_LIST[4].title" />
+ <BBTableHeaderCell :title="columnList[1].title" />
+ <BBTableHeaderCell :title="columnList[2].title" />
+ <BBTableHeaderCell :title="columnList[3].title" />
+ <BBTableHeaderCell :title="columnList[4].title" />
</template>
<template #body="{ rowData: anomaly }">
<BBTableCell :left-padding="4">
@@ -73,12 +73,11 @@
</template>
<script lang="ts">
-import { defineComponent, PropType, reactive } from "vue";
+import { computed, defineComponent, PropType, reactive } from "vue";
import { useRouter } from "vue-router";
import { CodeDiff } from "v-code-diff";
import { useI18n } from "vue-i18n";
-
-import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
+import { BBTableSectionDataSource } from "../bbkit/types";
import {
Anomaly,
AnomalyDatabaseBackupMissingPayload,
@@ -122,7 +121,7 @@ export default defineComponent({
showModal: false,
});
- const COLUMN_LIST: BBTableColumn[] = reactive([
+ const columnList = computed(() => [
{
title: "",
},
@@ -279,7 +278,7 @@ export default defineComponent({
};
return {
- COLUMN_LIST,
+ columnList,
state,
typeName,
detail,
diff --git a/frontend/src/components/ColumnTable.vue b/frontend/src/components/ColumnTable.vue
index d143a5e90c..5670c1fef4 100644
--- a/frontend/src/components/ColumnTable.vue
+++ b/frontend/src/components/ColumnTable.vue
@@ -44,7 +44,6 @@
<script lang="ts">
import { computed, defineComponent, PropType } from "vue";
-import { BBTableColumn } from "../bbkit/types";
import { Column, EngineType } from "../types";
import { useI18n } from "vue-i18n";
@@ -63,7 +62,8 @@ export default defineComponent({
},
setup(props) {
const { t } = useI18n();
- const NORMAL_COLUMN_LIST: BBTableColumn[] = [
+
+ const NORMAL_COLUMN_LIST = computed(() => [
{
title: t("common.name"),
},
@@ -85,8 +85,8 @@ export default defineComponent({
{
title: t("database.comment"),
},
- ];
- const POSTGRES_COLUMN_LIST: BBTableColumn[] = [
+ ]);
+ const POSTGRES_COLUMN_LIST = computed(() => [
{
title: t("common.name"),
},
@@ -105,9 +105,8 @@ export default defineComponent({
{
title: t("database.comment"),
},
- ];
-
- const CLICKHOUSE_SNOWFLAKE_COLUMN_LIST: BBTableColumn[] = [
+ ]);
+ const CLICKHOUSE_SNOWFLAKE_COLUMN_LIST = computed(() => [
{
title: t("common.name"),
},
@@ -123,18 +122,20 @@ export default defineComponent({
{
title: t("database.comment"),
},
- ];
+ ]);
+
const columnNameList = computed(() => {
switch (props.engine) {
case "POSTGRES":
- return POSTGRES_COLUMN_LIST;
+ return POSTGRES_COLUMN_LIST.value;
case "CLICKHOUSE":
case "SNOWFLAKE":
- return CLICKHOUSE_SNOWFLAKE_COLUMN_LIST;
+ return CLICKHOUSE_SNOWFLAKE_COLUMN_LIST.value;
default:
- return NORMAL_COLUMN_LIST;
+ return NORMAL_COLUMN_LIST.value;
}
});
+
return {
columnNameList,
};
diff --git a/frontend/src/components/DBExtensionTable.vue b/frontend/src/components/DBExtensionTable.vue
index e720954821..b35c488299 100644
--- a/frontend/src/components/DBExtensionTable.vue
+++ b/frontend/src/components/DBExtensionTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="dbExtensionList"
:show-header="true"
:left-bordered="true"
@@ -25,8 +25,7 @@
</template>
<script lang="ts">
-import { PropType } from "vue";
-import { BBTableColumn } from "../bbkit/types";
+import { computed, PropType } from "vue";
import { DBExtension } from "../types";
import { useI18n } from "vue-i18n";
@@ -41,7 +40,7 @@ export default {
},
setup() {
const { t } = useI18n();
- const COLUMN_LIST: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.name"),
},
@@ -54,9 +53,9 @@ export default {
{
title: t("common.description"),
},
- ];
+ ]);
return {
- COLUMN_LIST,
+ columnList,
};
},
};
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index 689ebacd10..cdda75f47f 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -94,8 +94,6 @@
import { computed, reactive, PropType, defineComponent } from "vue";
import { useRouter } from "vue-router";
import DataSourceCreateForm from "../components/DataSourceCreateForm.vue";
-import { BBTableColumn } from "../bbkit/types";
-
import { databaseSlug, dataSourceSlug } from "../utils";
import { Instance, Database, DataSource, DataSourceCreate } from "../types";
import { useI18n } from "vue-i18n";
@@ -129,7 +127,7 @@ export default defineComponent({
const { t } = useI18n();
const dataSourceStore = useDataSourceStore();
- const columnList: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.name"),
},
@@ -148,7 +146,7 @@ export default defineComponent({
{
title: t("common.created-at"),
},
- ];
+ ]);
const state = reactive<LocalState>({
searchText: "",
diff --git a/frontend/src/components/EnvironmentTable.vue b/frontend/src/components/EnvironmentTable.vue
index e78aa42a81..b8c65f345a 100644
--- a/frontend/src/components/EnvironmentTable.vue
+++ b/frontend/src/components/EnvironmentTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="environmentList"
:show-header="true"
:left-bordered="false"
@@ -25,7 +25,7 @@
</template>
<script lang="ts">
-import { defineComponent, PropType } from "vue";
+import { computed, defineComponent, PropType } from "vue";
import { useRouter } from "vue-router";
import { Environment } from "../types";
import { environmentSlug } from "../utils";
@@ -44,7 +44,7 @@ export default defineComponent({
const { t } = useI18n();
- const COLUMN_LIST = [
+ const columnList = computed(() => [
{
title: t("common.id"),
},
@@ -57,7 +57,7 @@ export default defineComponent({
{
title: t("common.updated-at"),
},
- ];
+ ]);
const clickEnvironment = function (section: number, row: number) {
const environment = props.environmentList[row];
@@ -65,7 +65,7 @@ export default defineComponent({
};
return {
- COLUMN_LIST,
+ columnList,
clickEnvironment,
};
},
diff --git a/frontend/src/components/IndexTable.vue b/frontend/src/components/IndexTable.vue
index c3cdc6064a..f8c1be0302 100644
--- a/frontend/src/components/IndexTable.vue
+++ b/frontend/src/components/IndexTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:section-data-source="sectionList"
:show-header="true"
:compact-section="false"
@@ -9,16 +9,16 @@
<BBTableHeaderCell
:left-padding="4"
class="w-16"
- :title="COLUMN_LIST[0].title"
+ :title="columnList[0].title"
/>
- <BBTableHeaderCell class="w-4" :title="COLUMN_LIST[1].title" />
- <BBTableHeaderCell class="w-4" :title="COLUMN_LIST[2].title" />
+ <BBTableHeaderCell class="w-4" :title="columnList[1].title" />
+ <BBTableHeaderCell class="w-4" :title="columnList[2].title" />
<BBTableHeaderCell
v-if="showVisibleColumn"
class="w-4"
- :title="COLUMN_LIST[3].title"
+ :title="columnList[3].title"
/>
- <BBTableHeaderCell class="w-16" :title="COLUMN_LIST[4].title" />
+ <BBTableHeaderCell class="w-16" :title="columnList[4].title" />
</template>
<template #body="{ rowData: index }">
<BBTableCell :left-padding="4">
@@ -42,7 +42,7 @@
<script lang="ts">
import { computed, defineComponent, PropType } from "vue";
-import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
+import { BBTableSectionDataSource } from "../bbkit/types";
import { Database, TableIndex } from "../types";
import { useI18n } from "vue-i18n";
@@ -64,7 +64,7 @@ export default defineComponent({
const showVisibleColumn = computed(() => {
return props.database.instance.engine !== "POSTGRES";
});
- const COLUMN_LIST: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("database.expression"),
},
@@ -80,7 +80,7 @@ export default defineComponent({
{
title: t("database.comment"),
},
- ];
+ ]);
const sectionList = computed(() => {
const sectionList: BBTableSectionDataSource<TableIndex>[] = [];
@@ -100,7 +100,7 @@ export default defineComponent({
});
return {
- COLUMN_LIST,
+ columnList,
sectionList,
showVisibleColumn,
};
diff --git a/frontend/src/components/InstanceUserTable.vue b/frontend/src/components/InstanceUserTable.vue
index a7e17c030f..8e09379a38 100644
--- a/frontend/src/components/InstanceUserTable.vue
+++ b/frontend/src/components/InstanceUserTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="instanceUserList"
:show-header="true"
:row-clickable="false"
@@ -19,8 +19,7 @@
</template>
<script lang="ts">
-import { PropType } from "vue";
-import { BBTableColumn } from "../bbkit/types";
+import { computed, PropType } from "vue";
import { InstanceUser } from "../types/InstanceUser";
import { useI18n } from "vue-i18n";
@@ -35,16 +34,16 @@ export default {
},
setup() {
const { t } = useI18n();
- const COLUMN_LIST: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.User"),
},
{
title: t("instance.grants"),
},
- ];
+ ]);
return {
- COLUMN_LIST,
+ columnList,
};
},
};
diff --git a/frontend/src/components/Issue/TaskCheckRunPanel.vue b/frontend/src/components/Issue/TaskCheckRunPanel.vue
index f9bf929be7..76041b6de9 100644
--- a/frontend/src/components/Issue/TaskCheckRunPanel.vue
+++ b/frontend/src/components/Issue/TaskCheckRunPanel.vue
@@ -52,12 +52,10 @@
<script lang="ts">
import { computed, defineComponent, PropType } from "vue";
import { useI18n } from "vue-i18n";
-import { BBTableColumn } from "../../bbkit/types";
import {
TaskCheckStatus,
TaskCheckRun,
TaskCheckResult,
- ErrorCode,
GeneralErrorCode,
ruleTemplateMap,
getRuleLocalization,
@@ -66,7 +64,7 @@ import {
RuleType,
} from "@/types";
-const columnList: BBTableColumn[] = [
+const columnList = computed(() => [
{
title: "",
},
@@ -76,7 +74,7 @@ const columnList: BBTableColumn[] = [
{
title: "Detail",
},
-];
+]);
interface ErrorCodeLink {
title: string;
diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vue
index 6bac330fdc..a912ee2e7b 100644
--- a/frontend/src/components/MemberTable.vue
+++ b/frontend/src/components/MemberTable.vue
@@ -1,7 +1,7 @@
<template>
<BBTable
class="mt-2"
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:section-data-source="dataSource"
:compact-section="true"
:show-header="true"
@@ -11,19 +11,19 @@
<BBTableHeaderCell
:left-padding="4"
class="w-auto table-cell"
- :title="$t(COLUMN_LIST[0].title)"
+ :title="$t(columnList[0].title)"
/>
<BBTableHeaderCell
class="w-8 table-cell"
- :title="$t(COLUMN_LIST[1].title)"
+ :title="$t(columnList[1].title)"
/>
<BBTableHeaderCell
class="w-72 table-cell"
- :title="$t(COLUMN_LIST[2].title)"
+ :title="$t(columnList[2].title)"
/>
<BBTableHeaderCell
class="w-auto table-cell"
- :title="$t(COLUMN_LIST[3].title)"
+ :title="$t(columnList[3].title)"
/>
</template>
<template #body="{ rowData: member }">
@@ -135,11 +135,11 @@ import {
RowStatus,
SYSTEM_BOT_ID,
} from "../types";
-import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
+import { BBTableSectionDataSource } from "../bbkit/types";
import { isOwner } from "../utils";
import { featureToRef, useCurrentUser, useMemberStore } from "@/store";
-const COLUMN_LIST: BBTableColumn[] = [
+const columnList = computed(() => [
{
title: "settings.members.table.account",
},
@@ -152,7 +152,7 @@ const COLUMN_LIST: BBTableColumn[] = [
{
title: "",
},
-];
+]);
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface LocalState {}
@@ -285,7 +285,7 @@ export default defineComponent({
return {
SYSTEM_BOT_ID,
- COLUMN_LIST,
+ columnList,
state,
currentUser,
hasRBACFeature,
diff --git a/frontend/src/components/MigrationHistoryTable.vue b/frontend/src/components/MigrationHistoryTable.vue
index d382c6cd09..28d0c78666 100644
--- a/frontend/src/components/MigrationHistoryTable.vue
+++ b/frontend/src/components/MigrationHistoryTable.vue
@@ -100,18 +100,18 @@
</template>
<script lang="ts">
-import { defineComponent, PropType } from "vue";
import { NPopover } from "naive-ui";
-import { Database, MigrationHistory } from "../types";
+import { computed, defineComponent, PropType } from "vue";
+import { useRouter } from "vue-router";
+import { useI18n } from "vue-i18n";
+import { Database, MigrationHistory } from "@/types";
+import { BBTableSectionDataSource } from "@/bbkit/types";
import {
databaseSlug,
migrationHistorySlug,
nanosecondsToString,
-} from "../utils";
-import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
+} from "@/utils";
import MigrationHistoryStatusIcon from "./MigrationHistoryStatusIcon.vue";
-import { useRouter } from "vue-router";
-import { useI18n } from "vue-i18n";
type Mode = "DATABASE" | "PROJECT";
@@ -140,10 +140,9 @@ export default defineComponent({
const { t } = useI18n();
- const columnListMap: Map<Mode, BBTableColumn[]> = new Map([
- [
- "DATABASE",
- [
+ const columnList = computed(() => {
+ if (props.mode === "DATABASE") {
+ return [
{
title: "",
},
@@ -168,11 +167,9 @@ export default defineComponent({
{
title: t("common.creator"),
},
- ],
- ],
- [
- "PROJECT",
- [
+ ];
+ } else if (props.mode === "PROJECT") {
+ return [
{ title: "" },
{
title: t("common.version"),
@@ -192,11 +189,13 @@ export default defineComponent({
{
title: t("common.creator"),
},
- ],
- ],
- ]);
+ ];
+ } else {
+ return [];
+ }
+ });
- const clickHistory = function (section: number, row: number) {
+ const clickHistory = (section: number, row: number) => {
const history = props.historySectionList[section].list[row];
router.push(
`/db/${databaseSlug(
@@ -206,7 +205,7 @@ export default defineComponent({
};
return {
- columnList: columnListMap.get(props.mode)!,
+ columnList,
nanosecondsToString,
clickHistory,
};
diff --git a/frontend/src/components/ProjectTable.vue b/frontend/src/components/ProjectTable.vue
index 195bd67835..d1a3ac4c46 100644
--- a/frontend/src/components/ProjectTable.vue
+++ b/frontend/src/components/ProjectTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="projectList"
:show-header="true"
:left-bordered="false"
@@ -8,9 +8,9 @@
@click-row="clickProject"
>
<template #header>
- <BBTableHeaderCell class="table-cell" :title="COLUMN_LIST[0].title" />
- <BBTableHeaderCell class="table-cell" :title="COLUMN_LIST[1].title" />
- <BBTableHeaderCell class="table-cell" :title="COLUMN_LIST[2].title" />
+ <BBTableHeaderCell class="table-cell" :title="columnList[0].title" />
+ <BBTableHeaderCell class="table-cell" :title="columnList[1].title" />
+ <BBTableHeaderCell class="table-cell" :title="columnList[2].title" />
</template>
<template #body="{ rowData: project }">
<BBTableCell :left-padding="4" class="table-cell text-gray-500 w-[30%]">
@@ -69,7 +69,7 @@ export default defineComponent({
setup(props) {
const router = useRouter();
const { t } = useI18n();
- const COLUMN_LIST = computed(() => [
+ const columnList = computed(() => [
{
title: t("project.table.key"),
},
@@ -96,7 +96,7 @@ export default defineComponent({
};
return {
- COLUMN_LIST,
+ columnList,
clickProject,
};
},
diff --git a/frontend/src/components/RepositoryTable.vue b/frontend/src/components/RepositoryTable.vue
index 4f4b93e897..32320e3a2d 100644
--- a/frontend/src/components/RepositoryTable.vue
+++ b/frontend/src/components/RepositoryTable.vue
@@ -28,10 +28,9 @@
</template>
<script lang="ts">
-import { defineComponent, PropType } from "vue";
+import { computed, defineComponent, PropType } from "vue";
import { useRouter } from "vue-router";
import PrincipalAvatar from "./PrincipalAvatar.vue";
-import { BBTableColumn } from "../bbkit/types";
import { projectSlug } from "../utils";
import { Repository } from "../types";
import { useI18n } from "vue-i18n";
@@ -50,7 +49,7 @@ export default defineComponent({
const router = useRouter();
- const columnList: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.project"),
},
@@ -63,7 +62,7 @@ export default defineComponent({
{
title: t("common.created-at"),
},
- ];
+ ]);
const clickRepository = function (section: number, row: number) {
const repository = props.repositoryList[row];
diff --git a/frontend/src/components/TableTable.vue b/frontend/src/components/TableTable.vue
index 07ae44d322..b975b71edc 100644
--- a/frontend/src/components/TableTable.vue
+++ b/frontend/src/components/TableTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="mixedTableList"
:show-header="true"
:left-bordered="true"
@@ -41,7 +41,7 @@
<template v-if="hasReservedTables && !state.showReservedTableList" #footer>
<tfoot>
<tr>
- <td :colspan="COLUMN_LIST.length" class="p-0">
+ <td :colspan="columnList.length" class="p-0">
<div
class="flex items-center justify-center cursor-pointer hover:bg-gray-200 py-2 text-gray-400 text-sm"
@click="state.showReservedTableList = true"
@@ -57,11 +57,10 @@
<script lang="ts">
import { computed, defineComponent, PropType, reactive } from "vue";
-import { BBTableColumn } from "../bbkit/types";
-import { Table } from "../types";
-import { bytesToString, databaseSlug } from "../utils";
import { useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
+import { Table } from "@/types";
+import { bytesToString, databaseSlug } from "@/utils";
type LocalState = {
showReservedTableList: boolean;
@@ -83,7 +82,7 @@ export default defineComponent({
showReservedTableList: false,
});
- const COLUMN_LIST: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.name"),
},
@@ -102,7 +101,7 @@ export default defineComponent({
{
title: t("common.created-at"),
},
- ];
+ ]);
const regularTableList = computed(() =>
props.tableList.filter((table) => !isGhostTable(table))
@@ -134,7 +133,7 @@ export default defineComponent({
};
return {
- COLUMN_LIST,
+ columnList,
state,
bytesToString,
clickTable,
diff --git a/frontend/src/components/ViewTable.vue b/frontend/src/components/ViewTable.vue
index 14fccd0bf0..2a2999a9b3 100644
--- a/frontend/src/components/ViewTable.vue
+++ b/frontend/src/components/ViewTable.vue
@@ -1,6 +1,6 @@
<template>
<BBTable
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="viewList"
:show-header="true"
:left-bordered="true"
@@ -25,10 +25,9 @@
</template>
<script lang="ts">
-import { PropType } from "vue";
-import { BBTableColumn } from "../bbkit/types";
-import { View } from "../types";
+import { computed, PropType } from "vue";
import { useI18n } from "vue-i18n";
+import { View } from "@/types";
export default {
name: "ViewTable",
@@ -41,7 +40,7 @@ export default {
},
setup() {
const { t } = useI18n();
- const COLUMN_LIST: BBTableColumn[] = [
+ const columnList = computed(() => [
{
title: t("common.name"),
},
@@ -54,9 +53,10 @@ export default {
{
title: t("common.created-at"),
},
- ];
+ ]);
+
return {
- COLUMN_LIST,
+ columnList,
};
},
};
diff --git a/frontend/src/views/SettingWorkspaceLabel.vue b/frontend/src/views/SettingWorkspaceLabel.vue
index a4a2bb830c..47c0a2f6a8 100644
--- a/frontend/src/views/SettingWorkspaceLabel.vue
+++ b/frontend/src/views/SettingWorkspaceLabel.vue
@@ -17,7 +17,7 @@
<div>
<BBTable
class="mt-2"
- :column-list="COLUMN_LIST"
+ :column-list="columnList"
:data-source="labelList"
:show-header="true"
:row-clickable="false"
@@ -123,7 +123,7 @@ export default defineComponent({
});
};
- const COLUMN_LIST = computed((): BBTableColumn[] => [
+ const columnList = computed((): BBTableColumn[] => [
{
title: t("setting.label.key"),
},
@@ -133,7 +133,7 @@ export default defineComponent({
]);
return {
- COLUMN_LIST,
+ columnList,
labelList,
hidePrefix,
allowEdit,