Skip to content

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

chore: update inbox page (#9857)

boojack97ca6aa0dbd4
diff --git a/frontend/src/components/InboxList.vue b/frontend/src/components/InboxList.vue
index 1308ebf297..c87f7e32f4 100644
--- a/frontend/src/components/InboxList.vue
+++ b/frontend/src/components/InboxList.vue
@@ -55,7 +55,9 @@
</div>
</li>
</ul>
- <div v-else class="text-center text-control-light">No items</div>
+ <div v-else class="text-center text-control-light py-4">
+ {{ $t("common.no-data") }}
+ </div>
</template>
<script lang="ts" setup>
diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vue
index 494ce99594..1bc575d6d8 100644
--- a/frontend/src/views/Inbox.vue
+++ b/frontend/src/views/Inbox.vue
@@ -1,6 +1,5 @@
<template>
- <!-- This example requires Tailwind CSS v2.0+ -->
- <div class="space-y-4">
+ <div class="space-y-4 py-4">
<div class="mx-6 space-y-2">
<div
class="flex items-center justify-between pb-2 border-b border-block-border"
@@ -8,12 +7,10 @@
<div class="text-lg leading-6 font-medium text-main">
{{ $t("common.unread") }}
</div>
- <button type="button" class="btn-normal" @click.prevent="markAllAsRead">
- <heroicons-outline:check
- class="-ml-1 mr-2 h-5 w-5 text-control-light"
- />
- <span>{{ $t("inbox.mark-all-as-read") }}</span>
- </button>
+ <NButton @click="markAllAsRead">
+ <Check class="h-auto w-4 mr-1" />
+ {{ $t("inbox.mark-all-as-read") }}
+ </NButton>
</div>
<InboxList :inbox-list="state.unreadList" />
</div>
@@ -33,7 +30,9 @@
</div>
</template>
-<script lang="ts">
+<script lang="ts" setup>
+import { Check } from "lucide-vue-next";
+import { NButton } from "naive-ui";
import { reactive, watchEffect } from "vue";
import { useRouter } from "vue-router";
import { useCurrentUser, useInboxV1Store } from "@/store";
@@ -54,80 +53,68 @@ interface LocalState {
readCreatedAfterTs: number;
}
-export default {
- name: "Inbox",
- components: { InboxList },
- setup() {
- const inboxV1Store = useInboxV1Store();
- const router = useRouter();
+const inboxV1Store = useInboxV1Store();
+const router = useRouter();
- const state = reactive<LocalState>({
- readList: [],
- unreadList: [],
- readCreatedAfterTs:
- parseInt(router.currentRoute.value.query.created as string) ||
- Math.ceil(Date.now() / 1000) - READ_INBOX_DURATION_STEP,
- });
+const state = reactive<LocalState>({
+ readList: [],
+ unreadList: [],
+ readCreatedAfterTs:
+ parseInt(router.currentRoute.value.query.created as string) ||
+ Math.ceil(Date.now() / 1000) - READ_INBOX_DURATION_STEP,
+});
- const currentUser = useCurrentUser();
+const currentUser = useCurrentUser();
- const prepareInboxList = () => {
- // It will also be called when user logout
- if (currentUser.value.id != UNKNOWN_ID) {
- inboxV1Store.fetchInboxList(state.readCreatedAfterTs).then((list) => {
- state.readList = [];
- state.unreadList = [];
+const prepareInboxList = () => {
+ // It will also be called when user logout
+ if (currentUser.value.id != UNKNOWN_ID) {
+ inboxV1Store.fetchInboxList(state.readCreatedAfterTs).then((list) => {
+ state.readList = [];
+ state.unreadList = [];
- for (const item of list) {
- if (!item.activity) {
- continue;
- }
- if (item.status == InboxMessage_Status.STATUS_READ) {
- state.readList.push(item);
- } else if (item.status == InboxMessage_Status.STATUS_UNREAD) {
- state.unreadList.push(item);
- }
- }
- });
+ for (const item of list) {
+ if (!item.activity) {
+ continue;
+ }
+ if (item.status == InboxMessage_Status.STATUS_READ) {
+ state.readList.push(item);
+ } else if (item.status == InboxMessage_Status.STATUS_UNREAD) {
+ state.unreadList.push(item);
+ }
}
- };
-
- watchEffect(prepareInboxList);
+ });
+ }
+};
- const markAllAsRead = async () => {
- const list = await Promise.all(
- state.unreadList.map(async (item) => {
- item.status = InboxMessage_Status.STATUS_READ;
- // TODO: use batch instead.
- await inboxV1Store.patchInbox(item);
- return item;
- })
- );
- state.readList.push(...list);
- state.unreadList = [];
- await inboxV1Store.fetchInboxSummary();
- };
+watchEffect(prepareInboxList);
- const viewOlder = () => {
- state.readCreatedAfterTs -= READ_INBOX_DURATION_STEP;
- router
- .replace({
- name: "workspace.inbox",
- query: {
- ...router.currentRoute.value.query,
- created: state.readCreatedAfterTs,
- },
- })
- .then(() => {
- prepareInboxList();
- });
- };
+const markAllAsRead = async () => {
+ const list = await Promise.all(
+ state.unreadList.map(async (item) => {
+ item.status = InboxMessage_Status.STATUS_READ;
+ // TODO: use batch instead.
+ await inboxV1Store.patchInbox(item);
+ return item;
+ })
+ );
+ state.readList.push(...list);
+ state.unreadList = [];
+ await inboxV1Store.fetchInboxSummary();
+};
- return {
- state,
- markAllAsRead,
- viewOlder,
- };
- },
+const viewOlder = () => {
+ state.readCreatedAfterTs -= READ_INBOX_DURATION_STEP;
+ router
+ .replace({
+ name: "workspace.inbox",
+ query: {
+ ...router.currentRoute.value.query,
+ created: state.readCreatedAfterTs,
+ },
+ })
+ .then(() => {
+ prepareInboxList();
+ });
};
</script>