Skip to content

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

feat: ui improvement (#3591)

Liu Ji79ba3e5ca45e
diff --git a/frontend/src/components/DatabaseListSidePanel.vue b/frontend/src/components/DatabaseListSidePanel.vue
index 1a224b699c..f680d3b741 100644
--- a/frontend/src/components/DatabaseListSidePanel.vue
+++ b/frontend/src/components/DatabaseListSidePanel.vue
@@ -149,13 +149,19 @@ export default defineComponent({
return {
id: `bb.project.${project.id}.databases`,
name: project.name,
- childList: databaseListGroupByNameAndCount.map(
+ childList: databaseListGroupByNameAndCount.map<BBOutlineItem>(
({ name, count }) => {
+ const label = [name];
+ if (count > 1) {
+ // Add a number beside the name when there are more than 1
+ // databases in single group.
+ label.push(`(${count})`);
+ }
return {
id: `bb.project.${project.id}.database.${name}`,
- name: `${name} (${count})`,
+ name: label.join(" "),
link: `/project/${projectSlug(project)}`,
- } as BBOutlineItem;
+ };
}
),
childCollapse: true,
diff --git a/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue b/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue
index b53df672d9..23ee00e19a 100644
--- a/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue
+++ b/frontend/src/components/DeploymentConfigTool/DeploymentMatrix.vue
@@ -18,19 +18,22 @@
<template v-else>
<div class="flex justify-between items-center py-0.5 space-x-2">
- <select
- v-model="state.selectedDatabaseName"
- class="btn-select w-40 disabled:cursor-not-allowed"
- >
- <option disabled>{{ $t("db.select") }}</option>
- <option
- v-for="(group, i) in databaseListGroupByName"
- :key="i"
- :value="group.name"
+ <div class="flex-1">
+ <select
+ v-if="databaseListGroupByName.length > 1"
+ v-model="state.selectedDatabaseName"
+ class="btn-select w-40 disabled:cursor-not-allowed"
>
- {{ group.name }}
- </option>
- </select>
+ <option disabled>{{ $t("db.select") }}</option>
+ <option
+ v-for="(group, i) in databaseListGroupByName"
+ :key="i"
+ :value="group.name"
+ >
+ {{ group.name }}
+ </option>
+ </select>
+ </div>
<YAxisRadioGroup
v-model:label="state.label"
@@ -87,6 +90,10 @@ const state = reactive({
const databaseListGroupByName = computed((): DatabaseGroup[] => {
const { dbNameTemplate } = props.project;
+ if (!dbNameTemplate) {
+ return [{ name: "", list: props.databaseList }];
+ }
+
if (dbNameTemplate && props.labelList.length === 0) {
// We can't calculate dbname correctly if labelList hasn't been fetched
// So return empty array as a fallback
@@ -124,8 +131,6 @@ watch(
);
const selectedDatabaseGroup = computed((): DatabaseGroup | undefined => {
- if (!state.selectedDatabaseName) return undefined;
-
return databaseListGroupByName.value.find(
(group) => group.name === state.selectedDatabaseName
);