Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: project sidebar (#8873)
ecmadao6ca9ddb57579
diff --git a/frontend/src/components/Project/ProjectIssuesPanel.vue b/frontend/src/components/Project/ProjectIssuesPanel.vuenew file mode 100644index 0000000000..1f67d5bce9--- /dev/null+++ b/frontend/src/components/Project/ProjectIssuesPanel.vue@@ -0,0 +1,215 @@+<template>+ <div class="space-y-2">+ <div class="flex justify-between">+ <div class="flex items-center gap-x-1">+ <p class="text-lg font-medium leading-7 text-main">+ {{ $t("common.issue") }}+ </p>+ <button+ type="button"+ class="p-1 rounded bg-gray-200 hover:bg-gray-300 border border-gray-300"+ @click="+ () => {+ router.replace({+ name: 'workspace.issue',+ query: {+ project: project.uid,+ autofocus: 1,+ },+ });+ }+ "+ >+ <heroicons-outline:search class="h-3.5 w-3.5 text-control" />+ </button>+ </div>+ </div>++ <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('common.filter-by-name')"+ :autofocus="true"+ @update:value="changeSearchText($event)"+ />+ </div>+ </div>++ <div v-show="state.tab === 'WAITING_APPROVAL'" class="mt-2">+ <WaitingForMyApprovalIssueTableV1+ v-if="hasCustomApprovalFeature"+ session-key="project-waiting-approval"+ :project="commonIssueFilter.project"+ >+ <template #table="{ issueList, loading }">+ <IssueTableV1+ :mode="'PROJECT'"+ :show-placeholder="!loading"+ :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"+ method="LIST"+ :issue-filter="{+ ...commonIssueFilter,+ statusList: [IssueStatus.OPEN],+ }"+ :page-size="10"+ >+ <template #table="{ issueList, loading }">+ <IssueTableV1+ class="-mt-px"+ :mode="'PROJECT'"+ :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+ session-key="project-closed"+ method="LIST"+ :issue-filter="{+ ...commonIssueFilter,+ statusList: [IssueStatus.DONE, IssueStatus.CANCELED],+ }"+ :page-size="5"+ :hide-load-more="true"+ >+ <template #table="{ issueList, loading }">+ <IssueTableV1+ class="-mt-px"+ :mode="'PROJECT'"+ :title="$t('project.overview.recently-closed')"+ :issue-list="issueList.filter(keywordFilter)"+ :show-placeholder="!loading"+ />+ </template>+ </PagedIssueTableV1>++ <div class="w-full flex justify-end mt-2 px-4">+ <router-link+ :to="`/issue?status=closed&project=${project.uid}`"+ class="normal-link"+ >+ {{ $t("project.overview.view-all-closed") }}+ </router-link>+ </div>+ </div>+ </div>+</template>++<script lang="ts" setup>+import { reactive, PropType, computed, watch } from "vue";+import { useI18n } from "vue-i18n";+import { useRouter } from "vue-router";+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 { TabFilterItem } from "@/components/v2";+import { featureToRef, useCurrentUserV1 } from "@/store";+import { userNamePrefix } from "@/store/modules/v1/common";+import { ComposedIssue, IssueFilter } from "@/types";+import { IssueStatus } from "@/types/proto/v1/issue_service";+import { Project } from "@/types/proto/v1/project_service";+import { hasWorkspacePermissionV1 } from "@/utils";++const TABS = ["WAITING_APPROVAL", "OPEN", "RECENTLY_CLOSED"] as const;++type TabValue = typeof TABS[number];++interface LocalState {+ tab: TabValue;+ searchText: string;+ isFetchingActivityList: boolean;+}++const props = defineProps({+ project: {+ required: true,+ type: Object as PropType<Project>,+ },+});++const state = reactive<LocalState>({+ tab: "WAITING_APPROVAL",+ searchText: "",+ isFetchingActivityList: false,+});+const { t } = useI18n();+const router = useRouter();+const currentUserV1 = useCurrentUserV1();++const hasCustomApprovalFeature = featureToRef("bb.feature.custom-approval");+const hasPermission = computed(() => {+ return hasWorkspacePermissionV1(+ "bb.permission.workspace.manage-issue",+ currentUserV1.value.userRole+ );+});++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 => {+ let principal = "";+ if (!hasPermission.value) {+ principal = `${userNamePrefix}${currentUserV1.value.email}`;+ }+ return {+ project: props.project.name,+ query: "",+ principal,+ };+});++const keywordFilter = (issue: ComposedIssue) => {+ const keyword = state.searchText.trim().toLowerCase();+ if (keyword) {+ if (!issue.title.toLowerCase().includes(keyword)) {+ return false;+ }+ }+ return true;+};++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/components/Project/ProjectSidebar.vue b/frontend/src/components/Project/ProjectSidebar.vuenew file mode 100644index 0000000000..1d9f86e1b8--- /dev/null+++ b/frontend/src/components/Project/ProjectSidebar.vue@@ -0,0 +1,237 @@+<template>+ <nav class="flex-1 flex flex-col overflow-y-hidden">+ <BytebaseLogo class="w-full px-4 shrink-0" />+ <div class="space-y-1 flex-1 overflow-y-auto px-2 pb-4">+ <div v-for="(item, index) in projectSidebarItemList" :key="index">+ <div+ class="group flex items-center px-2 py-2 text-sm leading-5 font-medium rounded-md text-gray-700"+ :class="getItemClass(item.hash)"+ @click="onSelect(item.hash)"+ >+ <component :is="item.icon" class="mr-3 w-5 h-5" />+ {{ item.title }}+ </div>+ <div v-if="item.children" class="space-y-1">+ <div+ v-for="child in item.children"+ :key="child.hash"+ class="group w-full flex items-center pl-11 pr-2 py-1.5"+ :class="getItemClass(child.hash)"+ @click="onSelect(child.hash)"+ >+ {{ child.title }}+ </div>+ </div>+ </div>+ </div>+ </nav>+</template>++<script setup lang="ts">+import { startCase } from "lodash-es";+import { GitBranch, CircleDot } from "lucide-vue-next";+import { computed, VNode, h, reactive, watch, nextTick } from "vue";+import { useI18n } from "vue-i18n";+import { useRoute, useRouter } from "vue-router";+import CogIcon from "~icons/heroicons-outline/cog";+import DatabaseIcon from "~icons/heroicons-outline/database";+import LinkIcon from "~icons/heroicons-outline/link";+import UserGroupIcon from "~icons/heroicons-outline/user-group";+import BytebaseLogo from "@/components/BytebaseLogo.vue";+import { useCurrentUserIamPolicy, useProjectV1Store } from "@/store";+import { DEFAULT_PROJECT_V1_NAME } from "@/types";+import { TenantMode } from "@/types/proto/v1/project_service";+import { idFromSlug } from "@/utils";++interface ProjectSidebarItem {+ title: string;+ hash?: string;+ icon: VNode;+ hide?: boolean;+ children?: {+ title: string;+ hash: string;+ hide?: boolean;+ }[];+}++interface LocalState {+ selectedHash: string;+}++const { t } = useI18n();+const route = useRoute();+const router = useRouter();+const projectV1Store = useProjectV1Store();++const state = reactive<LocalState>({+ selectedHash: "",+});++const projectSlug = computed(() => route.params.projectSlug as string);+const project = computed(() => {+ return projectV1Store.getProjectByUID(String(idFromSlug(projectSlug.value)));+});+const currentUserIamPolicy = useCurrentUserIamPolicy();++const isDefaultProject = computed((): boolean => {+ return project.value.name === DEFAULT_PROJECT_V1_NAME;+});++const isTenantProject = computed((): boolean => {+ return project.value.tenantMode === TenantMode.TENANT_MODE_ENABLED;+});++const projectSidebarItemList = computed((): ProjectSidebarItem[] => {+ const fullList: ProjectSidebarItem[] = [+ {+ title: t("common.database"),+ icon: h(DatabaseIcon),+ children: [+ {+ title: t("common.databases"),+ hash: "databases",+ },+ {+ title: t("common.change-history"),+ hash: "change-history",+ hide:+ isTenantProject.value ||+ !currentUserIamPolicy.isMemberOfProject(project.value.name),+ },+ {+ title: startCase(t("slow-query.slow-queries")),+ hash: "slow-query",+ hide: !currentUserIamPolicy.isMemberOfProject(project.value.name),+ },+ // TODO: Anomaly+ {+ title: t("common.database-groups"),+ hash: "database-groups",+ hide:+ isTenantProject.value ||+ !currentUserIamPolicy.isMemberOfProject(project.value.name),+ },+ ],+ },+ {+ title: t("common.issues"),+ hash: "issues",+ icon: h(CircleDot),+ hide:+ isDefaultProject.value ||+ !currentUserIamPolicy.allowToChangeDatabaseOfProject(+ project.value.name+ ),+ },+ {+ title: t("common.branches"),+ hash: "branches",+ icon: h(GitBranch),+ hide: !currentUserIamPolicy.allowToChangeDatabaseOfProject(+ project.value.name+ ),+ },+ // TODO: Changelists+ // TODO: Sync schema+ {+ title: t("common.manage"),+ icon: h(UserGroupIcon),+ hide:+ isDefaultProject.value ||+ !currentUserIamPolicy.isMemberOfProject(project.value.name),+ children: [+ {+ title: t("common.members"),+ hash: "members",+ },+ {+ title: t("common.activities"),+ hash: "activities",+ },+ ],+ },+ {+ title: t("settings.sidebar.integration"),+ icon: h(LinkIcon),+ hide:+ isDefaultProject.value ||+ !currentUserIamPolicy.allowToChangeDatabaseOfProject(+ project.value.name+ ),+ children: [+ {+ title: t("common.gitops"),+ hash: "gitops",+ },+ {+ title: t("common.webhooks"),+ hash: "webhook",+ },+ ],+ },+ {+ title: t("common.setting"),+ icon: h(CogIcon),+ hash: "setting",+ hide:+ isDefaultProject.value ||+ !currentUserIamPolicy.isMemberOfProject(project.value.name),+ },+ ];++ return fullList+ .map((item) => ({+ ...item,+ children: (item.children ?? []).filter((child) => !child.hide),+ }))+ .filter((item) => !item.hide && (!!item.hash || item.children.length > 0));+});++const getItemClass = (hash: string | undefined) => {+ if (!hash) {+ return [];+ }+ const list = ["outline-item"];+ if (state.selectedHash === hash) {+ list.push("bg-link-hover");+ }+ return list;+};++const onSelect = (hash: string | undefined) => {+ if (!hash) {+ return;+ }+ hash = hash.replace(/^#?/g, "");+ state.selectedHash = hash;+ router.replace({+ name: "workspace.project.detail",+ hash: `#${hash}`,+ });+};++const selectProjectTabOnHash = () => {+ const { name, hash } = router.currentRoute.value;+ if (name == "workspace.project.detail") {+ onSelect(hash || "databases");+ } else if (+ name == "workspace.project.hook.create" ||+ name == "workspace.project.hook.detail"+ ) {+ state.selectedHash = "webhook";+ }+};++watch(+ () => [router.currentRoute.value.hash],+ () => {+ nextTick(() => {+ selectProjectTabOnHash();+ });+ },+ {+ immediate: true,+ }+);+</script>diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vuedeleted file mode 100644index 0c3ee39d09..0000000000--- a/frontend/src/components/ProjectOverviewPanel.vue+++ /dev/null@@ -1,255 +0,0 @@-<template>- <div class="space-y-6">- <div class="space-y-2">- <p class="text-lg font-medium leading-7 text-main">- {{ $t("project.overview.recent-activity") }}- </p>- <div class="relative">- <!-- show the first 5 activities -->- <!-- But won't show "Load more", since we have a "View all" link below -->- <PagedActivityTable- :activity-find="{- resource: project.name,- order: 'desc',- }"- session-key="bb.page-activity-table.project-activity"- :page-size="5"- :hide-load-more="true"- >- <template #table="{ list }">- <ActivityTable :activity-list="list" />- </template>- </PagedActivityTable>- <div- v-if="state.isFetchingActivityList"- class="absolute inset-0 flex flex-col items-center justify-center bg-white/70"- >- <BBSpin />- </div>- <div class="w-full flex justify-end mt-2 px-4">- <router-link- :to="`#activity`"- class="normal-link"- exact-active-class=""- >- {{ $t("project.overview.view-all") }}- </router-link>- </div>- </div>- </div>-- <div class="space-y-2">- <div class="flex justify-between">- <div class="flex items-center gap-x-1">- <p class="text-lg font-medium leading-7 text-main">- {{ $t("common.issue") }}- </p>- <button- type="button"- class="p-1 rounded bg-gray-200 hover:bg-gray-300 border border-gray-300"- @click="- () => {- router.replace({- name: 'workspace.issue',- query: {- project: project.uid,- autofocus: 1,- },- });- }- "- >- <heroicons-outline:search class="h-3.5 w-3.5 text-control" />- </button>- </div>- </div>-- <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('common.filter-by-name')"- :autofocus="true"- @update:value="changeSearchText($event)"- />- </div>- </div>-- <div v-show="state.tab === 'WAITING_APPROVAL'" class="mt-2">- <WaitingForMyApprovalIssueTableV1- v-if="hasCustomApprovalFeature"- session-key="project-waiting-approval"- :project="commonIssueFilter.project"- >- <template #table="{ issueList, loading }">- <IssueTableV1- :mode="'PROJECT'"- :show-placeholder="!loading"- :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"- method="LIST"- :issue-filter="{- ...commonIssueFilter,- statusList: [IssueStatus.OPEN],- }"- :page-size="10"- >- <template #table="{ issueList, loading }">- <IssueTableV1- class="-mt-px"- :mode="'PROJECT'"- :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- session-key="project-closed"- method="LIST"- :issue-filter="{- ...commonIssueFilter,- statusList: [IssueStatus.DONE, IssueStatus.CANCELED],- }"- :page-size="5"- :hide-load-more="true"- >- <template #table="{ issueList, loading }">- <IssueTableV1- class="-mt-px"- :mode="'PROJECT'"- :title="$t('project.overview.recently-closed')"- :issue-list="issueList.filter(keywordFilter)"- :show-placeholder="!loading"- />- </template>- </PagedIssueTableV1>-- <div class="w-full flex justify-end mt-2 px-4">- <router-link- :to="`/issue?status=closed&project=${project.uid}`"- class="normal-link"- >- {{ $t("project.overview.view-all-closed") }}- </router-link>- </div>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { reactive, PropType, computed, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { featureToRef, useCurrentUserV1 } from "@/store";-import { userNamePrefix } from "@/store/modules/v1/common";-import { IssueStatus } from "@/types/proto/v1/issue_service";-import { Project } from "@/types/proto/v1/project_service";-import { hasWorkspacePermissionV1 } from "@/utils";-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;-}--const props = defineProps({- project: {- required: true,- type: Object as PropType<Project>,- },-});--const state = reactive<LocalState>({- tab: "WAITING_APPROVAL",- searchText: "",- isFetchingActivityList: false,-});-const { t } = useI18n();-const router = useRouter();-const currentUserV1 = useCurrentUserV1();--const hasCustomApprovalFeature = featureToRef("bb.feature.custom-approval");-const hasPermission = computed(() => {- return hasWorkspacePermissionV1(- "bb.permission.workspace.manage-issue",- currentUserV1.value.userRole- );-});--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 => {- let principal = "";- if (!hasPermission.value) {- principal = `${userNamePrefix}${currentUserV1.value.email}`;- }- return {- project: props.project.name,- query: "",- principal,- };-});--const keywordFilter = (issue: ComposedIssue) => {- const keyword = state.searchText.trim().toLowerCase();- if (keyword) {- if (!issue.title.toLowerCase().includes(keyword)) {- return false;- }- }- return true;-};--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/layouts/ProjectLayout.vue b/frontend/src/layouts/ProjectLayout.vueindex 85aa9e19c6..67390b622e 100644--- a/frontend/src/layouts/ProjectLayout.vue+++ b/frontend/src/layouts/ProjectLayout.vue@@ -21,13 +21,6 @@:style="'INFO'":title="$t('project.overview.info-slot-content')"/>- <BBTabFilter- class="px-3 pb-2 border-b border-block-border"- :responsive="false"- :tab-item-list="tabItemList"- :selected-index="state.selectedIndex"- @select-index="selectTab"- /></HideInStandaloneMode><div class="py-4 px-6">@@ -40,18 +33,10 @@</template><script lang="ts" setup>-import { startCase } from "lodash-es";-import { computed, nextTick, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { BBTabFilterItem } from "@/bbkit/types";+import { computed } from "vue";import ArchiveBanner from "@/components/ArchiveBanner.vue";import HideInStandaloneMode from "@/components/misc/HideInStandaloneMode.vue";-import {- useCurrentUserIamPolicy,- useCurrentUserV1,- useProjectV1Store,-} from "@/store";+import { useCurrentUserV1, useProjectV1Store } from "@/store";import { DEFAULT_PROJECT_V1_NAME } from "@/types";import { State } from "@/types/proto/v1/common";import { TenantMode } from "@/types/proto/v1/project_service";@@ -61,15 +46,6 @@ import {hasPermissionInProjectV1,} from "@/utils";-type ProjectTabItem = {- name: string;- hash: string;-};--interface LocalState {- selectedIndex: number;-}-const props = defineProps({projectSlug: {required: true,@@ -81,16 +57,12 @@ const props = defineProps({},});-const router = useRouter();-const { t } = useI18n();-const currentUserV1 = useCurrentUserV1();const projectV1Store = useProjectV1Store();const project = computed(() => {return projectV1Store.getProjectByUID(String(idFromSlug(props.projectSlug)));});-const currentUserIamPolicy = useCurrentUserIamPolicy();const isDefaultProject = computed((): boolean => {return project.value.name === DEFAULT_PROJECT_V1_NAME;@@ -100,75 +72,6 @@ const isTenantProject = computed((): boolean => {return project.value.tenantMode === TenantMode.TENANT_MODE_ENABLED;});-const projectTabItemList = computed((): ProjectTabItem[] => {- if (!currentUserIamPolicy.isMemberOfProject(project.value.name)) {- return [{ name: t("common.databases"), hash: "databases" }];- }- if (- !currentUserIamPolicy.allowToChangeDatabaseOfProject(project.value.name)- ) {- const list = [{ name: t("common.databases"), hash: "databases" }];- if (!isDefaultProject.value) {- list.push(- ...[- { name: t("common.members"), hash: "members" },- { name: t("common.settings"), hash: "setting" },- ]- );- }- return list;- }-- const list: (ProjectTabItem | null)[] = [- { name: t("common.overview"), hash: "overview" },- { name: t("common.branches"), hash: "branches" },- { name: t("common.databases"), hash: "databases" },-- isTenantProject.value- ? { name: t("common.database-groups"), hash: "database-groups" }- : null,-- isTenantProject.value- ? null // Hide "Change History" tab for tenant projects- : { name: t("common.change-history"), hash: "change-history" },-- { name: startCase(t("slow-query.slow-queries")), hash: "slow-query" },-- { name: t("common.activities"), hash: "activity" },- isDefaultProject.value- ? null- : { name: t("common.gitops"), hash: "gitops" },- isDefaultProject.value- ? null- : { name: t("common.webhooks"), hash: "webhook" },- isDefaultProject.value- ? null- : { name: t("common.members"), hash: "members" },- isDefaultProject.value- ? null- : { name: t("common.settings"), hash: "setting" },- ];- const filteredList = list.filter((item) => item !== null) as ProjectTabItem[];-- return filteredList;-});--const findTabIndexByHash = (hash: string) => {- hash = hash.replace(/^#?/g, "");- const index = projectTabItemList.value.findIndex(- (item) => item.hash === hash- );- if (index >= 0) {- return index;- }- // otherwise fallback to the first tab- return 0;-};--const state = reactive<LocalState>({- selectedIndex: findTabIndexByHash(router.currentRoute.value.hash),-});-const allowEdit = computed(() => {if (project.value.state === State.DELETED) {return false;@@ -194,46 +97,4 @@ const allowEdit = computed(() => {}return false;});--const tabItemList = computed((): BBTabFilterItem[] => {- return projectTabItemList.value.map((item) => {- return {- title: item.name,- alert: false,- };- });-});--const selectProjectTabOnHash = () => {- const { name, hash } = router.currentRoute.value;- if (name == "workspace.project.detail") {- const index = findTabIndexByHash(hash);- selectTab(index);- } else if (- name == "workspace.project.hook.create" ||- name == "workspace.project.hook.detail"- ) {- state.selectedIndex = findTabIndexByHash("webhook");- }-};--const selectTab = (index: number) => {- state.selectedIndex = index;- router.replace({- name: "workspace.project.detail",- hash: "#" + projectTabItemList.value[index].hash,- });-};--watch(- () => [router.currentRoute.value.hash],- () => {- nextTick(() => {- selectProjectTabOnHash();- });- },- {- immediate: true,- }-);</script>diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex c0c014d5a1..f009029723 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -703,7 +703,8 @@ const routes: Array<RouteRecordRaw> = [path: "project/:projectSlug",components: {content: () => import("../layouts/ProjectLayout.vue"),- leftSidebar: DashboardSidebar,+ leftSidebar: () =>+ import("../components/Project/ProjectSidebar.vue"),},meta: {quickActionListByRole: (route) => {diff --git a/frontend/src/views/ProjectDetail.vue b/frontend/src/views/ProjectDetail.vueindex 2b57dc887c..372d835429 100644--- a/frontend/src/views/ProjectDetail.vue+++ b/frontend/src/views/ProjectDetail.vue@@ -1,6 +1,6 @@<template>- <template v-if="hash === 'overview'">- <ProjectOverviewPanel id="overview" :project="project" />+ <template v-if="hash === 'issues'">+ <ProjectIssuesPanel id="issues" :project="project" /></template><template v-if="hash === 'branches'"><ProjectBranchesPanel id="branches" :project-id="project.uid" />@@ -20,7 +20,7 @@<template v-if="hash === 'slow-query'"><ProjectSlowQueryPanel :project="project" /></template>- <template v-if="hash === 'activity'">+ <template v-if="hash === 'activities'"><ProjectActivityPanel id="activity" :project="project" /></template><template v-if="!isDefaultProject && hash === 'gitops'">@@ -64,11 +64,11 @@ import {useProjectV1Store,} from "@/store";import { DEFAULT_PROJECT_V1_NAME } from "@/types";+import ProjectIssuesPanel from "../components/Project/ProjectIssuesPanel.vue";import ProjectActivityPanel from "../components/ProjectActivityPanel.vue";import ProjectChangeHistoryPanel from "../components/ProjectChangeHistoryPanel.vue";import ProjectDatabasesPanel from "../components/ProjectDatabasesPanel.vue";import ProjectMemberPanel from "../components/ProjectMember/ProjectMemberPanel.vue";-import ProjectOverviewPanel from "../components/ProjectOverviewPanel.vue";import ProjectSettingPanel from "../components/ProjectSettingPanel.vue";import ProjectSlowQueryPanel from "../components/ProjectSlowQueryPanel.vue";import ProjectVersionControlPanel from "../components/ProjectVersionControlPanel.vue";