Skip to content

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

Support alert icon in BBTabFilter

天舟768d68c19166
diff --git a/frontend/src/bbkit/BBTabFilter.vue b/frontend/src/bbkit/BBTabFilter.vue
index ebf9a54c14..6c58c01da5 100644
--- a/frontend/src/bbkit/BBTabFilter.vue
+++ b/frontend/src/bbkit/BBTabFilter.vue
@@ -13,25 +13,54 @@
"
>
<option
- v-for="(item, index) in tabList"
+ v-for="(item, index) in tabItemList"
:key="index"
:value="index"
:selected="index == selectedIndex"
>
- {{ item }}
+ {{ item.title }}
</option>
</select>
</div>
<div :class="responsive ? 'hidden sm:block' : 'block'">
<div class="flex space-x-4" aria-label="Tabs">
<button
- v-for="(item, index) in tabList"
+ v-for="(item, index) in tabItemList"
:key="index"
- class="tab px-3 py-1"
+ class="tab px-3 py-1 flex items-center"
:class="buttonClass(index == selectedIndex)"
@click.prevent="$emit('select-index', index)"
>
- {{ item }}
+ {{ item.title }}
+ <span
+ v-if="item.alert"
+ class="
+ flex
+ items-center
+ justify-center
+ rounded-full
+ select-none
+ ml-2
+ w-4
+ h-4
+ text-white
+ "
+ :class="index == selectedIndex ? 'bg-gray-600' : 'bg-red-600'"
+ >
+ <span
+ class="
+ h-2
+ w-2
+ rounded-full
+ text-center
+ pb-6
+ font-normal
+ text-base
+ "
+ aria-hidden="true"
+ >!</span
+ >
+ </span>
</button>
</div>
</div>
@@ -40,14 +69,15 @@
<script lang="ts">
import { PropType } from "vue";
+import { BBTabFilterItem } from "./types";
export default {
name: "BBTabFilter",
emits: ["select-index"],
props: {
- tabList: {
+ tabItemList: {
required: true,
- type: Object as PropType<String[]>,
+ type: Object as PropType<BBTabFilterItem[]>,
},
selectedIndex: {
required: true,
diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.ts
index 220870827f..84ba3512d6 100644
--- a/frontend/src/bbkit/types.ts
+++ b/frontend/src/bbkit/types.ts
@@ -22,6 +22,11 @@ export type BBTabItem = {
id: string;
};
+export type BBTabFilterItem = {
+ title: string;
+ alert: boolean;
+};
+
export type BBStepStatus =
| "PENDING"
| "PENDING_ACTIVE"
diff --git a/frontend/src/components/EnvironmentTabFilter.vue b/frontend/src/components/EnvironmentTabFilter.vue
index 0d59a1e9e6..da4a678b41 100644
--- a/frontend/src/components/EnvironmentTabFilter.vue
+++ b/frontend/src/components/EnvironmentTabFilter.vue
@@ -1,6 +1,6 @@
<template>
<BBTabFilter
- :tabList="tabList"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -19,7 +19,7 @@ import { computed, reactive, watch } from "vue";
import { useStore } from "vuex";
import cloneDeep from "lodash-es/cloneDeep";
import { Environment } from "../types";
-import environment from "../store/modules/environment";
+import { BBTabFilterItem } from "../bbkit/types";
interface LocalState {
selectedIndex: number;
@@ -64,11 +64,19 @@ export default {
}
);
- const tabList = computed(() => {
- const list = ["All"];
+ const tabItemList = computed((): BBTabFilterItem[] => {
+ const list: BBTabFilterItem[] = [
+ {
+ title: "All",
+ alert: false,
+ },
+ ];
list.push(
...environmentList.value.map((environment: Environment) => {
- return environment.name;
+ return {
+ title: environment.name,
+ alert: false,
+ };
})
);
return list;
@@ -77,7 +85,7 @@ export default {
return {
state,
environmentList,
- tabList,
+ tabItemList,
};
},
};
diff --git a/frontend/src/components/IssueStagePanel.vue b/frontend/src/components/IssueStagePanel.vue
index 9c4ecbd431..aaeeb8a023 100644
--- a/frontend/src/components/IssueStagePanel.vue
+++ b/frontend/src/components/IssueStagePanel.vue
@@ -22,7 +22,7 @@
</div>
<div class="mb-2">
<BBTabFilter
- :tabList="tabList"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -49,6 +49,7 @@ import TaskCheckRunTable from "../components/TaskCheckRunTable.vue";
import TaskRunTable from "../components/TaskRunTable.vue";
import { Stage, Task } from "../types";
import { activeTaskInStage } from "../utils";
+import { BBTabFilterItem } from "../bbkit/types";
const RUN_TAB = 0;
const CHECK_TAB = 1;
@@ -76,15 +77,18 @@ export default {
(curStage, _) => {}
);
- const tabList = computed((): string[] => {
- return ["Run", "Check"];
+ const tabItemList = computed((): BBTabFilterItem[] => {
+ return [
+ { title: "Run", alert: false },
+ { title: "Check", alert: false },
+ ];
});
const activeTask = computed((): Task => {
return activeTaskInStage(props.stage);
});
- return { RUN_TAB, CHECK_TAB, state, tabList, activeTask };
+ return { RUN_TAB, CHECK_TAB, state, tabItemList, activeTask };
},
};
</script>
diff --git a/frontend/src/layouts/ProjectLayout.vue b/frontend/src/layouts/ProjectLayout.vue
index b85cf493cb..564c06901b 100644
--- a/frontend/src/layouts/ProjectLayout.vue
+++ b/frontend/src/layouts/ProjectLayout.vue
@@ -8,7 +8,7 @@
<BBTabFilter
class="px-3 pb-2 border-b border-block-border"
:responsive="false"
- :tabList="projectTabItemList.map((item) => item.name)"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -33,6 +33,7 @@ import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { idFromSlug, isProjectOwner } from "../utils";
import ArchiveBanner from "../components/ArchiveBanner.vue";
+import { BBTabFilterItem } from "../bbkit/types";
const OVERVIEW_TAB = 0;
const WEBHOOK_TAB = 3;
@@ -104,6 +105,15 @@ export default {
return false;
});
+ const tabItemList = computed((): BBTabFilterItem[] => {
+ return projectTabItemList.map((item) => {
+ return {
+ title: item.name,
+ alert: false,
+ };
+ });
+ });
+
const selectProjectTabOnHash = () => {
if (router.currentRoute.value.name == "workspace.project.detail") {
if (router.currentRoute.value.hash) {
@@ -150,8 +160,8 @@ export default {
state,
project,
allowEdit,
+ tabItemList,
selectTab,
- projectTabItemList,
};
},
};
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index 758b7b4a84..f59dee3064 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -2,7 +2,7 @@
<div class="flex flex-col">
<div class="px-4 py-2 flex justify-between items-center">
<BBTabFilter
- :tabList="tabList"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -52,6 +52,7 @@ import {
UNKNOWN_ID,
} from "../types";
import { isDBAOrOwner } from "../utils";
+import { BBTabFilterItem } from "../bbkit/types";
const PROJECT_TAB = 0;
const INSTANCE_TAB = 1;
@@ -109,10 +110,14 @@ export default {
return store.getters["environment/environmentList"](["ARCHIVED"]);
});
- const tabList = computed((): string[] => {
+ const tabItemList = computed((): BBTabFilterItem[] => {
return isDBAOrOwner(currentUser.value.role)
- ? ["Project", "Instance", "Environment"]
- : ["Project"];
+ ? [
+ { title: "Project", alert: false },
+ { title: "Instance", alert: false },
+ { title: "Environment", alert: false },
+ ]
+ : [{ title: "Project", alert: false }];
});
const filteredProjectList = (list: Project[]) => {
@@ -160,7 +165,7 @@ export default {
projectList,
instanceList,
environmentList,
- tabList,
+ tabItemList,
filteredProjectList,
filteredInstanceList,
filteredEnvironmentList,
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 62580efe55..cb30170d30 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -198,7 +198,7 @@
<BBTabFilter
class="px-3 pb-2 border-b border-block-border"
:responsive="false"
- :tabList="databaseTabItemList.map((item) => item.name)"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -242,6 +242,7 @@ import {
baseDirectoryWebURL,
} from "../types";
import { isEmpty } from "lodash";
+import { BBTabFilterItem } from "../bbkit/types";
const OVERVIEW_TAB = 0;
const MIGRAITON_HISTORY_TAB = 1;
@@ -384,6 +385,12 @@ export default {
return "Alter Schema";
});
+ const tabItemList = computed((): BBTabFilterItem[] => {
+ return databaseTabItemList.map((item) => {
+ return { title: item.name, alert: false };
+ });
+ });
+
const tryTransferProject = () => {
state.editingProjectId = database.value.project.id;
state.showModal = true;
@@ -477,12 +484,12 @@ export default {
allowChangeProject,
allowAdmin,
allowEdit,
+ tabItemList,
tryTransferProject,
alterSchema,
alterSchemaText,
updateProject,
selectTab,
- databaseTabItemList,
};
},
};
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index 7b595d4f25..704c12d586 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -20,7 +20,7 @@
<div v-else>
<div class="mb-4 flex items-center justify-between">
<BBTabFilter
- :tabList="['Databases', 'Users']"
+ :tabItemList="tabItemList"
:selectedIndex="state.selectedIndex"
@select-index="
(index) => {
@@ -107,6 +107,7 @@ import {
MigrationSchemaStatus,
SqlResultSet,
} from "../types";
+import { BBTabFilterItem } from "../bbkit/types";
const DATABASE_TAB = 0;
const USER_TAB = 1;
@@ -229,6 +230,19 @@ export default {
);
});
+ const tabItemList = computed((): BBTabFilterItem[] => {
+ return [
+ {
+ title: "Databases",
+ alert: false,
+ },
+ {
+ title: "Users",
+ alert: false,
+ },
+ ];
+ });
+
const doArchive = () => {
store
.dispatch("instance/patchInstance", {
@@ -319,6 +333,7 @@ export default {
databaseList,
instanceUserList,
allowEdit,
+ tabItemList,
doArchive,
doRestore,
doCreateMigrationSchema,