Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Make BBTabe accept BBTabItem including title and id. And make EnvironmentDashboard use that.
天舟826764b3c776
diff --git a/frontend/src/bbkit/BBTab.vue b/frontend/src/bbkit/BBTab.vueindex e8603f13f1..8ce8255cc1 100644--- a/frontend/src/bbkit/BBTab.vue+++ b/frontend/src/bbkit/BBTab.vue@@ -1,12 +1,14 @@<template><div class="border-b border-block-border"><nav class="-mb-px flex" aria-label="Tabs">- <div- v-for="(title, index) in tabTitleList"+ <a+ v-for="(item, index) in tabItemList":key="index"+ :id="item.id"+ :href="`#${item.id}`"class="select-none cursor-pointer flex justify-between py-2 px-1 font-medium border-b-2 border-transparent"v-bind:class="tabClass(index == selectedIndex)"- @click.self="$emit('select-index', index)"+ @click.self="selectTabIndex(index)"@mouseenter="state.hoverIndex = index"@mouseleave="state.hoverIndex = -1">@@ -18,7 +20,7 @@"@click.prevent="() => {- $emit('select-index', index);+ selectTabIndex(index);$emit('reorder-index', index, index - 1);}"@@ -39,16 +41,16 @@</svg></button><div v-else class="pl-6"></div>- {{ title }}+ {{ item.title }}<buttonv-if="- index != tabTitleList.length - 1 &&+ index != tabItemList.length - 1 &&(reorderModel == 'ALWAYS' ||(reorderModel == 'HOVER' && state.hoverIndex == index))"@click.prevent="() => {- $emit('select-index', index);+ selectTabIndex(index);$emit('reorder-index', index, index + 1);}"@@ -69,7 +71,7 @@</svg></button><div v-else class="pr-6"></div>- </div>+ </a><buttonv-if="allowCreate"@click.prevent="$emit('create')"@@ -99,14 +101,15 @@<script lang="ts">import { reactive, PropType } from "vue";+import { BBTabItem } from "./types";export default {name: "BBTab",emits: ["create", "reorder-index", "select-index"],props: {- tabTitleList: {+ tabItemList: {required: true,- type: Object as PropType<String[]>,+ type: Object as PropType<BBTabItem[]>,},selectedIndex: {required: true,@@ -124,14 +127,14 @@ export default {data: function () {return {};},- setup(props, ctx) {+ setup(props, { emit }) {const state = reactive({hoverIndex: -1,});const tabClass = (selected: boolean) => {const width =- "w-1/" + (props.tabTitleList.length + (props.allowCreate ? 1 : 0));+ "w-1/" + (props.tabItemList.length + (props.allowCreate ? 1 : 0));if (selected) {return width + " text-control-hover border-accent";}@@ -142,15 +145,20 @@ export default {};const addTabClass = () => {- if (props.tabTitleList.length == 0) {+ if (props.tabItemList.length == 0) {return "w-1/6 ";}return "w-1/12";};+ const selectTabIndex = (index: number) => {+ emit("select-index", index);+ };+return {tabClass,addTabClass,+ selectTabIndex,state,};},diff --git a/frontend/src/bbkit/BBTabPanel.vue b/frontend/src/bbkit/BBTabPanel.vueindex a282ae2f56..ad89e1b3ad 100644--- a/frontend/src/bbkit/BBTabPanel.vue+++ b/frontend/src/bbkit/BBTabPanel.vue@@ -1,5 +1,5 @@<template>- <section v-if="active" :aria-hiddem="!active" :id="$props.id">+ <section v-if="active" :aria-hiddem="!active"><slot /></section></template>@@ -12,10 +12,6 @@ export default {required: true,type: Boolean,},- id: {- required: true,- type: String,- },},setup(props, ctx) {},};diff --git a/frontend/src/bbkit/types.ts b/frontend/src/bbkit/types.tsindex fc24cd0176..962ac256fe 100644--- a/frontend/src/bbkit/types.ts+++ b/frontend/src/bbkit/types.ts@@ -8,6 +8,12 @@ export type BBTableSectionDataSource<T> = {list: T[];};+export type BBTabItem = {+ title: string;+ // Used as the anchor+ id: string;+};+export type BBStepStatus =| "PENDING"| "PENDING_ACTIVE"diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vueindex 6031803f50..c7ef6cd896 100644--- a/frontend/src/views/EnvironmentDashboard.vue+++ b/frontend/src/views/EnvironmentDashboard.vue@@ -1,7 +1,7 @@<template><div><BBTab- :tabTitleList="tabTitleList"+ :tabItemList="tabItemList":selectedIndex="state.selectedIndex":reorderModel="state.reorder ? 'ALWAYS' : 'NEVER'"@reorder-index="reorderEnvironment"@@ -10,7 +10,6 @@<BBTabPanelv-for="(item, index) in environmentList":key="item.id"- :id="item.id":active="index == state.selectedIndex"><div v-if="state.reorder" class="flex justify-center pt-5">@@ -69,12 +68,14 @@</template><script lang="ts">-import { onMounted, onUnmounted, computed, reactive } from "vue";+import { onMounted, onUnmounted, computed, reactive, watch } from "vue";import { useStore } from "vuex";+import { useRouter } from "vue-router";import { array_swap } from "../utils";import EnvironmentForm from "../components/EnvironmentForm.vue";import EnvironmentDetail from "../views/EnvironmentDetail.vue";import { Environment, EnvironmentNew } from "../types";+import { BBTabItem } from "../bbkit/types";interface LocalState {reorderedEnvironmentList: Environment[];@@ -93,6 +94,7 @@ export default {props: {},setup(props, ctx) {const store = useStore();+ const router = useRouter();const state = reactive<LocalState>({reorderedEnvironmentList: [],@@ -140,22 +142,36 @@ export default {});});+ watch(+ () => router.currentRoute.value.hash,+ () => {+ for (let i = 0; i < environmentList.value.length; i++) {+ if (+ environmentList.value[i].id ==+ router.currentRoute.value.hash.slice(1)+ ) {+ selectEnvironment(i);+ break;+ }+ }+ }+ );+const environmentList = computed(() => {return store.getters["environment/environmentList"]();});- const tabTitleList = computed(() => {+ const tabItemList = computed((): BBTabItem[] => {if (environmentList) {- if (state.reorder) {- return state.reorderedEnvironmentList.map(- (item: Environment, index: number) =>- (index + 1).toString() + ". " + item.name- );- }- return environmentList.value.map(- (item: Environment, index: number) =>- (index + 1).toString() + ". " + item.name- );+ const list = state.reorder+ ? state.reorderedEnvironmentList+ : environmentList.value;+ return list.map((item: Environment, index: number) => {+ return {+ title: (index + 1).toString() + ". " + item.name,+ id: item.id,+ };+ });}return [];});@@ -249,6 +265,10 @@ export default {const selectEnvironment = (index: number) => {state.selectedIndex = index;+ router.replace({+ name: "workspace.environment",+ hash: "#" + environmentList.value[index].id,+ });};const tabClass = computed(() => "w-1/" + environmentList.value.length);@@ -256,7 +276,7 @@ export default {return {state,environmentList,- tabTitleList,+ tabItemList,createEnvironment,doCreate,doDismissGuide,diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vueindex 52ae8db054..f56fdb66d8 100644--- a/frontend/src/views/Inbox.vue+++ b/frontend/src/views/Inbox.vue@@ -47,7 +47,10 @@><template v-if="message.type == 'bb.msg.environment.create'"><span class="ml-1"> created environment</span>- <router-link :to="`/environment`" class="normal-link ml-1">+ <router-link+ :to="`/environment#${message.containerId}`"+ class="normal-link ml-1"+ >{{ message.payload.environmentName }}</router-link></template>