Skip to content

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

Move inbox to the upper right

天舟562b7f8eab1a
diff --git a/frontend/src/views/DashboardHeader.vue b/frontend/src/views/DashboardHeader.vue
index 4d32fdfdb3..985b94d3da 100644
--- a/frontend/src/views/DashboardHeader.vue
+++ b/frontend/src/views/DashboardHeader.vue
@@ -116,6 +116,35 @@
</div>
<div v-else class="underline">Developer</div>
</div>
+ <router-link to="/inbox" exact-active-class="">
+ <span
+ v-if="inboxSummary.hasUnread"
+ class="
+ absolute
+ rounded-full
+ ml-4
+ -mt-1
+ h-2.5
+ w-2.5
+ bg-accent
+ opacity-75
+ "
+ ></span>
+ <svg
+ class="w-6 h-6"
+ fill="none"
+ stroke="currentColor"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
+ ></path>
+ </svg>
+ </router-link>
<div class="ml-2">
<ProfileDropdown />
</div>
@@ -185,10 +214,10 @@
</template>
<script lang="ts">
-import { computed, reactive } from "vue";
+import { computed, reactive, watchEffect } from "vue";
import { useStore } from "vuex";
import ProfileDropdown from "../components/ProfileDropdown.vue";
-import { PlanType } from "../types";
+import { InboxSummary, PlanType, UNKNOWN_ID } from "../types";
import { isDBAOrOwner, isDev, isOwner } from "../utils";
interface LocalState {
@@ -220,6 +249,19 @@ export default {
return isDev();
});
+ const prepareInboxSummary = () => {
+ // It will also be called when user logout
+ if (currentUser.value.id != UNKNOWN_ID) {
+ store.dispatch("inbox/fetchInboxSummaryByUser", currentUser.value.id);
+ }
+ };
+
+ watchEffect(prepareInboxSummary);
+
+ const inboxSummary = computed((): InboxSummary => {
+ return store.getters["inbox/inboxSummaryByUser"](currentUser.value.id);
+ });
+
const switchToOwner = () => {
store.dispatch("auth/login", {
@@ -259,6 +301,7 @@ export default {
currentPlan,
showDBAItem,
showSwitchPlan,
+ inboxSummary,
switchToOwner,
switchToDBA,
switchToDeveloper,
diff --git a/frontend/src/views/DashboardSidebar.vue b/frontend/src/views/DashboardSidebar.vue
index aecab366d4..e8451ed5d3 100644
--- a/frontend/src/views/DashboardSidebar.vue
+++ b/frontend/src/views/DashboardSidebar.vue
@@ -14,56 +14,6 @@
</svg>
Home
</router-link>
- <router-link
- to="/inbox"
- class="outline-item group flex items-center justify-between px-2 py-2"
- >
- <div class="flex">
- <svg
- v-if="inboxSummary.hasUnread"
- class="w-5 h-5 mr-2"
- fill="currentColor"
- viewBox="0 0 20 20"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- d="M8.707 7.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l2-2a1 1 0 00-1.414-1.414L11 7.586V3a1 1 0 10-2 0v4.586l-.293-.293z"
- ></path>
- <path
- d="M3 5a2 2 0 012-2h1a1 1 0 010 2H5v7h2l1 2h4l1-2h2V5h-1a1 1 0 110-2h1a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2V5z"
- ></path>
- </svg>
- <svg
- v-else
- class="w-5 h-5 mr-2"
- fill="currentColor"
- viewBox="0 0 20 20"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- fill-rule="evenodd"
- d="M5 3a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V5a2 2 0 00-2-2H5zm0 2h10v7h-2l-1 2H8l-1-2H5V5z"
- clip-rule="evenodd"
- ></path>
- </svg>
- Inbox
- </div>
- <svg
- v-if="inboxSummary.hasUnreadError"
- class="w-5 h-5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- xmlns="http://www.w3.org/2000/svg"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
- ></path>
- </svg>
- </router-link>
<router-link
to="/anomaly-center"
class="outline-item group flex items-center px-2 py-2"
@@ -98,9 +48,6 @@
import BookmarkListSidePanel from "../components/BookmarkListSidePanel.vue";
import ProjectListSidePanel from "../components/ProjectListSidePanel.vue";
import DatabaseListSidePanel from "../components/DatabaseListSidePanel.vue";
-import { computed, watchEffect } from "@vue/runtime-core";
-import { useStore } from "vuex";
-import { InboxSummary, UNKNOWN_ID } from "../types";
export default {
name: "DashboardSidebar",
@@ -111,24 +58,7 @@ export default {
DatabaseListSidePanel,
},
setup(props, ctx) {
- const store = useStore();
-
- const currentUser = computed(() => store.getters["auth/currentUser"]());
-
- const prepareInboxSummary = () => {
- // It will also be called when user logout
- if (currentUser.value.id != UNKNOWN_ID) {
- store.dispatch("inbox/fetchInboxSummaryByUser", currentUser.value.id);
- }
- };
-
- watchEffect(prepareInboxSummary);
-
- const inboxSummary = computed((): InboxSummary => {
- return store.getters["inbox/inboxSummaryByUser"](currentUser.value.id);
- });
-
- return { inboxSummary };
+ return {};
},
};
</script>