Skip to content

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

feat(frontend): put issue category onto issue navigation bar (#8312)

Liu Ji73479f411a44
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
index 531722ed70..ccaa45a4f2 100644
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue
@@ -1,5 +1,6 @@
<template>
<div
+ v-if="title"
class="text-left pl-4 pt-4 pb-2 py-text-base leading-6 font-medium text-gray-900"
>
{{ title }}
diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vue
index 70c1b1c126..ff1f07986f 100644
--- a/frontend/src/components/ProjectOverviewPanel.vue
+++ b/frontend/src/components/ProjectOverviewPanel.vue
@@ -62,16 +62,23 @@
<heroicons-outline:search class="h-3.5 w-3.5 text-control" />
</button>
</div>
+ </div>
- <SearchBox
- :value="state.searchText"
- :placeholder="$t('issue.filter-issue-by-name')"
- :autofocus="true"
- @update:value="changeSearchText($event)"
- />
+ <div class="flex items-center">
+ <div class="flex-1 overflow-hidden">
+ <TabFilter v-model:value="state.tab" :items="tabItemList" />
+ </div>
+ <div class="flex flex-row space-x-4 p-0.5">
+ <SearchBox
+ :value="state.searchText"
+ :placeholder="$t('issue.filter-issue-by-name')"
+ :autofocus="true"
+ @update:value="changeSearchText($event)"
+ />
+ </div>
</div>
- <div>
+ <div v-show="state.tab === 'WAITING_APPROVAL'" class="mt-2">
<WaitingForMyApprovalIssueTableV1
v-if="hasCustomApprovalFeature"
session-key="project-waiting-approval"
@@ -85,12 +92,14 @@
<IssueTableV1
:mode="'PROJECT'"
:show-placeholder="!loading"
- :title="$t('issue.waiting-approval')"
:issue-list="issueList.filter(keywordFilter)"
+ title=""
/>
</template>
</WaitingForMyApprovalIssueTableV1>
+ </div>
+ <div v-show="state.tab === 'OPEN'" class="mt-2">
<!-- show OPEN issues with pageSize=10 -->
<PagedIssueTableV1
session-key="project-open"
@@ -105,13 +114,15 @@
<IssueTableV1
class="-mt-px"
:mode="'PROJECT'"
- :title="$t('project.overview.in-progress')"
:issue-list="issueList.filter(keywordFilter)"
:show-placeholder="!loading"
+ title=""
/>
</template>
</PagedIssueTableV1>
+ </div>
+ <div v-show="state.tab === 'RECENTLY_CLOSED'" class="mt-2">
<!-- show the first 5 DONE or CANCELED issues -->
<!-- But won't show "Load more", since we have a "View all closed" link below -->
<PagedIssueTableV1
@@ -149,7 +160,8 @@
</template>
<script lang="ts" setup>
-import { reactive, PropType, computed } from "vue";
+import { reactive, PropType, computed, watch } from "vue";
+import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { featureToRef } from "@/store";
import { IssueStatus } from "@/types/proto/v1/issue_service";
@@ -158,8 +170,14 @@ import { ComposedIssue, IssueFilter } from "../types";
import IssueTableV1 from "./IssueV1/components/IssueTableV1.vue";
import PagedIssueTableV1 from "./IssueV1/components/PagedIssueTableV1.vue";
import WaitingForMyApprovalIssueTableV1 from "./IssueV1/components/WaitingForMyApprovalIssueTableV1.vue";
+import { TabFilterItem } from "./v2";
+
+const TABS = ["WAITING_APPROVAL", "OPEN", "RECENTLY_CLOSED"] as const;
+
+type TabValue = typeof TABS[number];
interface LocalState {
+ tab: TabValue;
searchText: string;
isFetchingActivityList: boolean;
}
@@ -172,13 +190,28 @@ const props = defineProps({
});
const state = reactive<LocalState>({
+ tab: "WAITING_APPROVAL",
searchText: "",
isFetchingActivityList: false,
});
+const { t } = useI18n();
const router = useRouter();
const hasCustomApprovalFeature = featureToRef("bb.feature.custom-approval");
+const tabItemList = computed((): TabFilterItem<TabValue>[] => {
+ const WAITING_APPROVAL: TabFilterItem<TabValue> = {
+ value: "WAITING_APPROVAL",
+ label: t("issue.waiting-approval"),
+ };
+ const list = hasCustomApprovalFeature.value ? [WAITING_APPROVAL] : [];
+ return [
+ ...list,
+ { value: "OPEN", label: t("project.overview.in-progress") },
+ { value: "RECENTLY_CLOSED", label: t("project.overview.recently-closed") },
+ ];
+});
+
const commonIssueFilter = computed((): IssueFilter => {
return {
project: props.project.name,
@@ -199,4 +232,14 @@ const keywordFilter = (issue: ComposedIssue) => {
const changeSearchText = (searchText: string) => {
state.searchText = searchText;
};
+
+watch(
+ [hasCustomApprovalFeature, () => state.tab],
+ () => {
+ if (!hasCustomApprovalFeature.value && state.tab === "WAITING_APPROVAL") {
+ state.tab = "OPEN";
+ }
+ },
+ { immediate: true }
+);
</script>
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index d95ed73c05..1825115918 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -1,127 +1,140 @@
<template>
<div class="flex flex-col">
- <div class="px-4 py-2 flex justify-between items-center">
- <div><!-- empty --></div>
- <SearchBox
- :value="state.searchText"
- :placeholder="$t('issue.filter-issue-by-name')"
- :autofocus="true"
- @update:value="changeSearchText($event)"
- />
- </div>
-
- <WaitingForMyApprovalIssueTableV1
- v-if="hasCustomApprovalFeature"
- session-key="home-waiting-approval"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="border-x-0"
- :show-placeholder="!loading"
- :title="$t('issue.waiting-approval')"
- :issue-list="issueList.filter(keywordFilter)"
- :highlight-text="state.searchText"
+ <div class="px-2 flex items-center">
+ <div class="flex-1 overflow-hidden">
+ <TabFilter v-model:value="state.tab" :items="tabItemList" />
+ </div>
+ <div class="p-0.5">
+ <SearchBox
+ :value="state.searchText"
+ :placeholder="$t('issue.filter-issue-by-name')"
+ :autofocus="true"
+ @update:value="changeSearchText($event)"
/>
- </template>
- </WaitingForMyApprovalIssueTableV1>
+ </div>
+ </div>
+ <div v-show="state.tab === 'WAITING_APPROVAL'" class="mt-2">
+ <WaitingForMyApprovalIssueTableV1
+ v-if="hasCustomApprovalFeature"
+ session-key="home-waiting-approval"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(keywordFilter)"
+ :highlight-text="state.searchText"
+ title=""
+ />
+ </template>
+ </WaitingForMyApprovalIssueTableV1>
+ </div>
- <!-- show OPEN Assigned issues with pageSize=10 -->
- <PagedIssueTableV1
- method="LIST"
- session-key="home-assigned"
- :issue-filter="{
- ...commonIssueFilter,
- statusList: [IssueStatus.OPEN],
- assignee: `users/${currentUserV1.email}`,
- }"
- :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="-mt-px border-x-0"
- :show-placeholder="!loading"
- :title="$t('issue.waiting-rollout')"
- :issue-list="issueList.filter(keywordFilter)"
- :highlight-text="state.searchText"
- />
- </template>
- </PagedIssueTableV1>
+ <div v-show="state.tab === 'WAITING_ROLLOUT'" class="mt-2">
+ <!-- show OPEN Assigned issues with pageSize=10 -->
+ <PagedIssueTableV1
+ method="LIST"
+ session-key="home-assigned"
+ :issue-filter="{
+ ...commonIssueFilter,
+ statusList: [IssueStatus.OPEN],
+ assignee: `users/${currentUserV1.email}`,
+ }"
+ :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(keywordFilter)"
+ :highlight-text="state.searchText"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ </div>
- <!-- show OPEN Created issues with pageSize=10 -->
- <PagedIssueTableV1
- session-key="home-created"
- method="LIST"
- :issue-filter="{
- ...commonIssueFilter,
- statusList: [IssueStatus.OPEN],
- creator: `users/${currentUserV1.email}`,
- }"
- :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="-mt-px border-x-0"
- :show-placeholder="!loading"
- :title="$t('common.created')"
- :issue-list="issueList.filter(keywordFilter)"
- :highlight-text="state.searchText"
- />
- </template>
- </PagedIssueTableV1>
+ <div v-show="state.tab === 'CREATED'" class="mt-2">
+ <!-- show OPEN Created issues with pageSize=10 -->
+ <PagedIssueTableV1
+ session-key="home-created"
+ method="LIST"
+ :issue-filter="{
+ ...commonIssueFilter,
+ statusList: [IssueStatus.OPEN],
+ creator: `users/${currentUserV1.email}`,
+ }"
+ :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(keywordFilter)"
+ :highlight-text="state.searchText"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ </div>
- <!-- show OPEN Subscribed issues with pageSize=10 -->
- <PagedIssueTableV1
- session-key="home-subscribed"
- method="LIST"
- :issue-filter="{
- ...commonIssueFilter,
- statusList: [IssueStatus.OPEN],
- subscriber: `users/${currentUserV1.email}`,
- }"
- :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="-mt-px border-x-0"
- :show-placeholder="!loading"
- :title="$t('common.subscribed')"
- :issue-list="issueList.filter(keywordFilter)"
- :highlight-text="state.searchText"
- />
- </template>
- </PagedIssueTableV1>
+ <div v-show="state.tab === 'SUBSCRIBED'" class="mt-2">
+ <!-- show OPEN Subscribed issues with pageSize=10 -->
+ <PagedIssueTableV1
+ session-key="home-subscribed"
+ method="LIST"
+ :issue-filter="{
+ ...commonIssueFilter,
+ statusList: [IssueStatus.OPEN],
+ subscriber: `users/${currentUserV1.email}`,
+ }"
+ :page-size="OPEN_ISSUE_LIST_PAGE_SIZE"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(keywordFilter)"
+ :highlight-text="state.searchText"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ </div>
- <!-- show the first 5 DONE or CANCELED issues -->
- <!-- But won't show "Load more", since we have a "View all closed" link below -->
- <PagedIssueTableV1
- session-key="home-closed"
- method="LIST"
- :issue-filter="{
- ...commonIssueFilter,
- statusList: [IssueStatus.DONE, IssueStatus.CANCELED],
- principal: `users/${currentUserV1.email}`,
- }"
- :page-size="MAX_CLOSED_ISSUE"
- :hide-load-more="true"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="-mt-px border-x-0"
- :show-placeholder="!loading"
- :title="$t('project.overview.recently-closed')"
- :issue-list="issueList.filter(keywordFilter)"
- :highlight-text="state.searchText"
- />
- </template>
- </PagedIssueTableV1>
- </div>
- <div class="w-full flex justify-end mt-2 px-4">
- <router-link
- :to="`/issue?status=closed&user=${currentUserUID}`"
- class="normal-link"
- >
- {{ $t("project.overview.view-all-closed") }}
- </router-link>
+ <div v-show="state.tab === 'RECENTLY_CLOSED'" class="mt-2">
+ <!-- show the first 5 DONE or CANCELED issues -->
+ <!-- But won't show "Load more", since we have a "View all closed" link below -->
+ <PagedIssueTableV1
+ session-key="home-closed"
+ method="LIST"
+ :issue-filter="{
+ ...commonIssueFilter,
+ statusList: [IssueStatus.DONE, IssueStatus.CANCELED],
+ principal: `users/${currentUserV1.email}`,
+ }"
+ :page-size="MAX_CLOSED_ISSUE"
+ :hide-load-more="true"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(keywordFilter)"
+ :highlight-text="state.searchText"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ <div class="w-full flex justify-end mt-2 px-4">
+ <router-link
+ :to="`/issue?status=closed&user=${currentUserUID}`"
+ class="normal-link"
+ >
+ {{ $t("project.overview.view-all-closed") }}
+ </router-link>
+ </div>
+ </div>
</div>
<BBModal
@@ -188,11 +201,12 @@
</template>
<script lang="ts" setup>
-import { reactive, computed } from "vue";
+import { reactive, computed, watch } from "vue";
+import { useI18n } from "vue-i18n";
import IssueTableV1 from "@/components/IssueV1/components/IssueTableV1.vue";
import PagedIssueTableV1 from "@/components/IssueV1/components/PagedIssueTableV1.vue";
import WaitingForMyApprovalIssueTableV1 from "@/components/IssueV1/components/WaitingForMyApprovalIssueTableV1.vue";
-import { SearchBox } from "@/components/v2";
+import { SearchBox, TabFilter, TabFilterItem } from "@/components/v2";
import {
useSubscriptionV1Store,
useOnboardingStateStore,
@@ -203,19 +217,32 @@ import { IssueStatus } from "@/types/proto/v1/issue_service";
import { ComposedIssue, IssueFilter, planTypeToString } from "../types";
import { extractUserUID } from "../utils";
+const TABS = [
+ "WAITING_APPROVAL",
+ "WAITING_ROLLOUT",
+ "CREATED",
+ "SUBSCRIBED",
+ "RECENTLY_CLOSED",
+] as const;
+
+type TabValue = typeof TABS[number];
+
interface LocalState {
searchText: string;
+ tab: TabValue;
showTrialStartModal: boolean;
}
const OPEN_ISSUE_LIST_PAGE_SIZE = 10;
const MAX_CLOSED_ISSUE = 5;
+const { t } = useI18n();
const subscriptionStore = useSubscriptionV1Store();
const onboardingStateStore = useOnboardingStateStore();
const state = reactive<LocalState>({
searchText: "",
+ tab: "WAITING_APPROVAL",
showTrialStartModal: false,
});
@@ -223,6 +250,21 @@ const currentUserV1 = useCurrentUserV1();
const currentUserUID = computed(() => extractUserUID(currentUserV1.value.name));
const hasCustomApprovalFeature = featureToRef("bb.feature.custom-approval");
+const tabItemList = computed((): TabFilterItem<TabValue>[] => {
+ const WAITING_APPROVAL: TabFilterItem<TabValue> = {
+ value: "WAITING_APPROVAL",
+ label: t("issue.waiting-approval"),
+ };
+ const list = hasCustomApprovalFeature.value ? [WAITING_APPROVAL] : [];
+ return [
+ ...list,
+ { value: "WAITING_ROLLOUT", label: t("issue.waiting-rollout") },
+ { value: "CREATED", label: t("common.created") },
+ { value: "SUBSCRIBED", label: t("common.subscribed") },
+ { value: "RECENTLY_CLOSED", label: t("project.overview.recently-closed") },
+ ];
+});
+
const onTrialingModalClose = () => {
state.showTrialStartModal = false;
onboardingStateStore.consume("show-trialing-modal");
@@ -257,4 +299,14 @@ const keywordFilter = (issue: ComposedIssue) => {
const changeSearchText = (searchText: string) => {
state.searchText = searchText;
};
+
+watch(
+ [hasCustomApprovalFeature, () => state.tab],
+ () => {
+ if (!hasCustomApprovalFeature.value && state.tab === "WAITING_APPROVAL") {
+ state.tab = "WAITING_ROLLOUT";
+ }
+ },
+ { immediate: true }
+);
</script>
diff --git a/frontend/src/views/IssueDashboard.vue b/frontend/src/views/IssueDashboard.vue
index 0018db549b..7f36c7509d 100644
--- a/frontend/src/views/IssueDashboard.vue
+++ b/frontend/src/views/IssueDashboard.vue
@@ -13,9 +13,11 @@
feature="bb.feature.issue-advanced-search"
/>
- <div class="px-4 py-2 flex justify-between items-center">
- <div><!-- empty --></div>
- <div class="flex flex-row space-x-4">
+ <div class="px-2 flex items-center">
+ <div class="flex-1 overflow-hidden">
+ <TabFilter v-model:value="state.tab" :items="tabItemList" />
+ </div>
+ <div class="flex flex-row space-x-4 p-0.5">
<NButton v-if="project" @click="goProject">
{{ project.key }}
</NButton>
@@ -47,49 +49,52 @@
</div>
</div>
- <!-- show all OPEN issues with pageSize=10 -->
- <PagedIssueTableV1
- v-if="showOpen"
- session-key="dashboard-open"
- method="SEARCH"
- :issue-filter="{
- ...issueFilter,
- statusList: [IssueStatus.OPEN],
- }"
- :page-size="10"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="border-x-0"
- :show-placeholder="!loading"
- :title="$t('issue.table.open')"
- :issue-list="issueList.filter(filter)"
- :highlight-text="state.searchParams.query"
- />
- </template>
- </PagedIssueTableV1>
-
- <!-- show all DONE and CANCELED issues with pageSize=10 -->
- <PagedIssueTableV1
- v-if="showClosed"
- session-key="dashboard-closed"
- method="SEARCH"
- :issue-filter="{
- ...issueFilter,
- statusList: [IssueStatus.DONE, IssueStatus.CANCELED],
- }"
- :page-size="10"
- >
- <template #table="{ issueList, loading }">
- <IssueTableV1
- class="-mt-px border-x-0"
- :show-placeholder="!loading"
- :title="$t('issue.table.closed')"
- :issue-list="issueList.filter(filter)"
- :highlight-text="state.searchParams.query"
- />
- </template>
- </PagedIssueTableV1>
+ <div v-show="state.tab === 'OPEN'" class="mt-2">
+ <!-- show all OPEN issues with pageSize=10 -->
+ <PagedIssueTableV1
+ session-key="dashboard-open"
+ method="SEARCH"
+ :issue-filter="{
+ ...issueFilter,
+ statusList: [IssueStatus.OPEN],
+ }"
+ :page-size="10"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(filter)"
+ :highlight-text="state.searchParams.query"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ </div>
+
+ <div v-show="state.tab === 'CLOSED'" class="mt-2">
+ <!-- show all DONE and CANCELED issues with pageSize=10 -->
+ <PagedIssueTableV1
+ v-if="showClosed"
+ session-key="dashboard-closed"
+ method="SEARCH"
+ :issue-filter="{
+ ...issueFilter,
+ statusList: [IssueStatus.DONE, IssueStatus.CANCELED],
+ }"
+ :page-size="10"
+ >
+ <template #table="{ issueList, loading }">
+ <IssueTableV1
+ class="border-x-0"
+ :show-placeholder="!loading"
+ :issue-list="issueList.filter(filter)"
+ :highlight-text="state.searchParams.query"
+ title=""
+ />
+ </template>
+ </PagedIssueTableV1>
+ </div>
</div>
</template>
@@ -97,11 +102,12 @@
import dayjs from "dayjs";
import { NInputGroup, NButton, NDatePicker } from "naive-ui";
import { reactive, computed, watchEffect, onMounted } from "vue";
+import { useI18n } from "vue-i18n";
import { useRoute, useRouter } from "vue-router";
import AdvancedSearch, { SearchParams } from "@/components/AdvancedSearch.vue";
import IssueTableV1 from "@/components/IssueV1/components/IssueTableV1.vue";
import PagedIssueTableV1 from "@/components/IssueV1/components/PagedIssueTableV1.vue";
-import { UserSelect, SearchBox } from "@/components/v2";
+import { UserSelect, SearchBox, TabFilterItem } from "@/components/v2";
import { useCurrentUserV1, useProjectV1Store, useUserStore } from "@/store";
import {
projectNamePrefix,
@@ -116,7 +122,12 @@ import {
projectV1Slug,
} from "@/utils";
+const TABS = ["OPEN", "CLOSED"] as const;
+
+type TabValue = typeof TABS[number];
+
interface LocalState {
+ tab: TabValue;
filterText: string;
searchParams: SearchParams;
}
@@ -124,6 +135,7 @@ interface LocalState {
const router = useRouter();
const route = useRoute();
+const { t } = useI18n();
const currentUserV1 = useCurrentUserV1();
const projectV1Store = useProjectV1Store();
@@ -157,6 +169,7 @@ const initSearchParams = computed((): SearchParams => {
});
const state = reactive<LocalState>({
+ tab: "OPEN",
filterText: "",
searchParams: {
query: "",
@@ -178,6 +191,25 @@ const showClosed = computed(
() => statusList.value.length === 0 || statusList.value.includes("closed")
);
+const tabItemList = computed((): TabFilterItem<TabValue>[] => {
+ const OPEN: TabFilterItem<TabValue> = {
+ value: "OPEN",
+ label: t("issue.table.open"),
+ };
+ const CLOSED: TabFilterItem<TabValue> = {
+ value: "CLOSED",
+ label: t("issue.table.closed"),
+ };
+ const list: TabFilterItem<TabValue>[] = [];
+ if (showOpen.value) {
+ list.push(OPEN);
+ }
+ if (showClosed.value) {
+ list.push(CLOSED);
+ }
+ return list;
+});
+
const allowFilterUsers = computed(() => {
if (
hasWorkspacePermissionV1(