Skip to content

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

chore: change issue left sidebar (#9390)

ecmadaoa897a4f9ff05
diff --git a/frontend/src/components/IssueV1/logic/initialize/index.ts b/frontend/src/components/IssueV1/logic/initialize/index.ts
index 6f82caa65e..e05a1cdbf3 100644
--- a/frontend/src/components/IssueV1/logic/initialize/index.ts
+++ b/frontend/src/components/IssueV1/logic/initialize/index.ts
@@ -12,7 +12,10 @@ import { createIssueSkeleton } from "./create";
export * from "./create";
-export function useInitializeIssue(issueSlug: Ref<string>) {
+export function useInitializeIssue(
+ issueSlug: Ref<string>,
+ redirectNotFound: boolean = true
+) {
const isCreating = computed(() => issueSlug.value.toLowerCase() == "new");
const uid = computed(() => {
const slug = issueSlug.value;
@@ -43,7 +46,7 @@ export function useInitializeIssue(issueSlug: Ref<string>) {
watch(
uid,
(uid) => {
- if (uid === String(UNKNOWN_ID)) {
+ if (uid === String(UNKNOWN_ID) && redirectNotFound) {
router.push({ name: "error.404" });
return;
}
diff --git a/frontend/src/components/Project/ProjectSidebar.vue b/frontend/src/components/Project/ProjectSidebar.vue
index a25c0d4d19..eb7b3fad6a 100644
--- a/frontend/src/components/Project/ProjectSidebar.vue
+++ b/frontend/src/components/Project/ProjectSidebar.vue
@@ -22,12 +22,13 @@ import {
} 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 { useRouter } from "vue-router";
import { SidebarItem } from "@/components/CommonSidebar.vue";
+import { useInitializeIssue } from "@/components/IssueV1";
import { useCurrentUserIamPolicy, useProjectV1Store } from "@/store";
-import { DEFAULT_PROJECT_V1_NAME } from "@/types";
+import { DEFAULT_PROJECT_V1_NAME, unknownProject } from "@/types";
import { TenantMode } from "@/types/proto/v1/project_service";
-import { idFromSlug } from "@/utils";
+import { idFromSlug, projectSlugV1 } from "@/utils";
const projectHashList = [
"databases",
@@ -60,11 +61,16 @@ interface ProjectSidebarItem {
}[];
}
-const route = useRoute();
-const projectSlug = computed(() => route.params.projectSlug as string);
+const props = defineProps<{
+ projectSlug?: string;
+ issueSlug?: string;
+}>();
+
+const issueSlug = computed(() => props.issueSlug ?? "");
+const { issue } = useInitializeIssue(issueSlug, false);
const cachedLastPage = useLocalStorage<ProjectHash>(
- `bb.project.${projectSlug.value}.page`,
+ `bb.project.${props.projectSlug}.page`,
"databases"
);
@@ -90,7 +96,14 @@ watch(
);
const project = computed(() => {
- return projectV1Store.getProjectByUID(String(idFromSlug(projectSlug.value)));
+ if (issue.value) {
+ return issue.value.projectEntity;
+ } else if (props.projectSlug) {
+ return projectV1Store.getProjectByUID(
+ String(idFromSlug(props.projectSlug))
+ );
+ }
+ return unknownProject();
});
const currentUserIamPolicy = useCurrentUserIamPolicy();
@@ -250,6 +263,9 @@ const onSelect = (hash: ProjectHash | undefined) => {
router.replace({
name: "workspace.project.detail",
hash: `#${hash}`,
+ params: {
+ projectSlug: props.projectSlug || projectSlugV1(project.value),
+ },
});
};
@@ -275,6 +291,8 @@ const selectProjectTabOnHash = () => {
name === "workspace.database-group.table-group.detail"
) {
state.selectedHash = "database-groups";
+ } else if (name === "workspace.issue.detail") {
+ state.selectedHash = "issues";
}
};
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 9ade4c2e13..6f3a51e681 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -268,7 +268,7 @@ const routes: Array<RouteRecordRaw> = [
content: () => import("../views/branch/BranchDetail.vue"),
leftSidebar: ProjectSidebar,
},
- props: { content: true },
+ props: { content: true, leftSidebar: true },
},
{
path: "sync-schema",
@@ -679,7 +679,7 @@ const routes: Array<RouteRecordRaw> = [
content: () => import("../layouts/ProjectLayout.vue"),
leftSidebar: ProjectSidebar,
},
- props: { content: true },
+ props: { content: true, leftSidebar: true },
children: [
{
path: "",
@@ -891,9 +891,9 @@ const routes: Array<RouteRecordRaw> = [
},
components: {
content: () => import("../views/IssueDetailV1.vue"),
- leftSidebar: DashboardSidebar,
+ leftSidebar: ProjectSidebar,
},
- props: { content: true },
+ props: { content: true, leftSidebar: true },
},
// Resource name related routes.
{