Skip to content

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

chore: hide some field for postgres database and table (#2315)

boojack4371120c26ee
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index 2f55db92cf..a840f59d6b 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -69,7 +69,7 @@
</dd>
</div>
- <div class="col-span-1 col-start-1">
+ <div v-if="!isPostgres" class="col-span-1 col-start-1">
<dt class="text-sm font-medium text-control-light">
{{ $t("common.created-at") }}
</dt>
@@ -78,7 +78,7 @@
</dd>
</div>
- <div class="col-span-1">
+ <div v-if="!isPostgres" class="col-span-1">
<dt class="text-sm font-medium text-control-light">
{{ $t("common.updated-at") }}
</dt>
@@ -92,7 +92,7 @@
<div class="text-lg leading-6 font-medium text-main mb-4">
{{ $t("db.tables") }}
</div>
- <TableTable :table-list="tableList" />
+ <TableTable :database-engine="databaseEngine" :table-list="tableList" />
<div class="mt-6 text-lg leading-6 font-medium text-main mb-4">
{{ $t("db.views") }}
@@ -214,7 +214,13 @@ import DataSourceConnectionPanel from "../components/DataSourceConnectionPanel.v
import TableTable from "../components/TableTable.vue";
import ViewTable from "../components/ViewTable.vue";
import { timezoneString, instanceSlug, isDBAOrOwner } from "../utils";
-import { Anomaly, Database, DataSource, DataSourcePatch } from "../types";
+import {
+ Anomaly,
+ Database,
+ DataSource,
+ DataSourcePatch,
+ EngineType,
+} from "../types";
import { cloneDeep, isEqual } from "lodash-es";
import { BBTableSectionDataSource } from "../bbkit/types";
import {
@@ -256,6 +262,9 @@ export default defineComponent({
const viewStore = useViewStore();
const dbExtensionStore = useDBExtensionStore();
+ const databaseEngine = props.database.instance.engine as EngineType;
+ const isPostgres = computed(() => databaseEngine === "POSTGRES");
+
const prepareTableList = () => {
tableStore.fetchTableListByDatabaseId(props.database.id);
};
@@ -367,10 +376,10 @@ export default defineComponent({
};
const saveEditDataSource = () => {
- const dataSourcePatch: DataSourcePatch = {
+ const dataSourcePatch = {
username: state.editingDataSource?.username,
password: state.editingDataSource?.password,
- };
+ } as DataSourcePatch;
dataSourceStore
.patchDataSource({
databaseId: state.editingDataSource?.databaseId as number,
@@ -405,6 +414,8 @@ export default defineComponent({
cancelEditDataSource,
saveEditDataSource,
configInstance,
+ databaseEngine,
+ isPostgres,
};
},
});
diff --git a/frontend/src/components/TableTable.vue b/frontend/src/components/TableTable.vue
index 6a0f0e55c4..e6aa8f22b6 100644
--- a/frontend/src/components/TableTable.vue
+++ b/frontend/src/components/TableTable.vue
@@ -21,7 +21,7 @@
/>
</div>
</BBTableCell>
- <BBTableCell class="w-[14%]">
+ <BBTableCell v-if="!isPostgres" class="w-[14%]">
{{ table.engine }}
</BBTableCell>
<BBTableCell class="w-[14%]">
@@ -33,7 +33,7 @@
<BBTableCell class="w-[14%]">
{{ bytesToString(table.indexSize) }}
</BBTableCell>
- <BBTableCell class="w-[14%]">
+ <BBTableCell v-if="!isPostgres" class="w-[14%]">
{{ humanizeTs(table.createdTs) }}
</BBTableCell>
</template>
@@ -71,6 +71,10 @@ export default defineComponent({
name: "TableTable",
components: { EllipsisText },
props: {
+ databaseEngine: {
+ type: String,
+ default: "MYSQL",
+ },
tableList: {
required: true,
type: Object as PropType<Table[]>,
@@ -80,30 +84,51 @@ export default defineComponent({
const router = useRouter();
const { t } = useI18n();
+ const isPostgres = computed(() => props.databaseEngine === "POSTGRES");
+
const state = reactive<LocalState>({
showReservedTableList: false,
});
- const columnList = computed(() => [
- {
- title: t("common.name"),
- },
- {
- title: t("database.engine"),
- },
- {
- title: t("database.row-count-est"),
- },
- {
- title: t("database.data-size"),
- },
- {
- title: t("database.index-size"),
- },
- {
- title: t("common.created-at"),
- },
- ]);
+ const columnList = computed(() => {
+ if (isPostgres.value) {
+ return [
+ {
+ title: t("common.name"),
+ },
+ {
+ title: t("database.row-count-est"),
+ },
+ {
+ title: t("database.data-size"),
+ },
+ {
+ title: t("database.index-size"),
+ },
+ ];
+ } else {
+ return [
+ {
+ title: t("common.name"),
+ },
+ {
+ title: t("database.engine"),
+ },
+ {
+ title: t("database.row-count-est"),
+ },
+ {
+ title: t("database.data-size"),
+ },
+ {
+ title: t("database.index-size"),
+ },
+ {
+ title: t("common.created-at"),
+ },
+ ];
+ }
+ });
const regularTableList = computed(() =>
props.tableList.filter((table) => !isGhostTable(table))
@@ -137,6 +162,7 @@ export default defineComponent({
return {
columnList,
state,
+ isPostgres,
bytesToString,
clickTable,
hasReservedTables,