Skip to content

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

chore: add export center route to project (#11494)

boojackeb3614ba95c9
diff --git a/frontend/src/components/Project/ProjectSidebarV1.vue b/frontend/src/components/Project/ProjectSidebarV1.vue
index a72125e937..d012f5b406 100644
--- a/frontend/src/components/Project/ProjectSidebarV1.vue
+++ b/frontend/src/components/Project/ProjectSidebarV1.vue
@@ -19,6 +19,7 @@ import {
Settings,
RefreshCcw,
PencilRuler,
+ DownloadIcon,
} from "lucide-vue-next";
import { computed, h } from "vue";
import { useI18n } from "vue-i18n";
@@ -41,6 +42,7 @@ import projectV1Routes, {
PROJECT_V1_ROUTE_CHANGELISTS,
PROJECT_V1_ROUTE_DATABASE_GROUPS,
PROJECT_V1_ROUTE_DEPLOYMENT_CONFIG,
+ PROJECT_V1_ROUTE_EXPORT_CENTER,
} from "@/router/dashboard/projectV1";
import { useCurrentUserV1 } from "@/store";
import { getProjectName } from "@/store/modules/v1/common";
@@ -199,6 +201,13 @@ const projectSidebarItemList = computed((): ProjectSidebarItem[] => {
type: "div",
hide: isDefaultProject.value,
},
+ {
+ title: t("export-center.self"),
+ icon: h(DownloadIcon),
+ path: PROJECT_V1_ROUTE_EXPORT_CENTER,
+ type: "div",
+ hide: isDefaultProject.value,
+ },
{
title: t("common.branches"),
path: PROJECT_V1_ROUTE_BRANCHES,
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index 6cebc4a874..d281e351bc 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -33,6 +33,7 @@ export const PROJECT_V1_ROUTE_WEBHOOK_CREATE = `${PROJECT_V1_ROUTE_DASHBOARD}.we
export const PROJECT_V1_ROUTE_WEBHOOK_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.webhook.detail`;
export const PROJECT_V1_ROUTE_MEMBERS = `${PROJECT_V1_ROUTE_DASHBOARD}.members`;
export const PROJECT_V1_ROUTE_SETTINGS = `${PROJECT_V1_ROUTE_DASHBOARD}.settings`;
+export const PROJECT_V1_ROUTE_EXPORT_CENTER = `${PROJECT_V1_ROUTE_DASHBOARD}.export-center`;
const projectV1Routes: RouteRecordRaw[] = [
{
@@ -457,6 +458,19 @@ const projectV1Routes: RouteRecordRaw[] = [
},
],
},
+ {
+ path: "export-center",
+ name: PROJECT_V1_ROUTE_EXPORT_CENTER,
+ meta: {
+ overrideTitle: true,
+ requiredProjectPermissionList: () => [
+ "bb.projects.get",
+ "bb.issues.list",
+ ],
+ },
+ component: () => import("@/views/ExportCenter/index.vue"),
+ props: true,
+ },
],
},
];
diff --git a/frontend/src/views/ExportCenter/index.vue b/frontend/src/views/ExportCenter/index.vue
index facd5deeb6..526637c487 100644
--- a/frontend/src/views/ExportCenter/index.vue
+++ b/frontend/src/views/ExportCenter/index.vue
@@ -42,7 +42,10 @@
:show="state.showRequestExportPanel"
@close="state.showRequestExportPanel = false"
>
- <DataExportPrepForm @dismiss="state.showRequestExportPanel = false" />
+ <DataExportPrepForm
+ :project-id="specificProject?.uid"
+ @dismiss="state.showRequestExportPanel = false"
+ />
</Drawer>
</template>
@@ -52,16 +55,22 @@ import { computed, reactive } from "vue";
import DataExportPrepForm from "@/components/DataExportPrepForm";
import PagedIssueTableV1 from "@/components/IssueV1/components/PagedIssueTableV1.vue";
import { Drawer } from "@/components/v2";
-import { useCurrentUserV1 } from "@/store";
+import { useCurrentUserV1, useProjectV1Store } from "@/store";
+import { projectNamePrefix } from "@/store/modules/v1/common";
import {
buildIssueFilterBySearchParams,
buildUIIssueFilterBySearchParams,
+ extractProjectResourceName,
type SearchParams,
type SearchScopeId,
} from "@/utils";
import DataExportIssueDataTable from "./DataExportIssueDataTable";
import type { ExportRecord } from "./types";
+const props = defineProps<{
+ projectId?: string;
+}>();
+
interface LocalState {
exportRecords: ExportRecord[];
showRequestExportPanel: boolean;
@@ -71,6 +80,7 @@ interface LocalState {
}
const currentUser = useCurrentUserV1();
+const projectV1Store = useProjectV1Store();
const state = reactive<LocalState>({
exportRecords: [],
showRequestExportPanel: false,
@@ -87,21 +97,34 @@ const state = reactive<LocalState>({
loadingMore: false,
});
+const specificProject = computed(() => {
+ return props.projectId
+ ? projectV1Store.getProjectByName(`${projectNamePrefix}${props.projectId}`)
+ : undefined;
+});
+
const dataExportIssueSearchParams = computed(() => {
+ // Default scopes with type and creator.
+ const defaultScopes = [
+ {
+ id: "type",
+ value: "DATA_EXPORT",
+ },
+ {
+ id: "creator",
+ value: currentUser.value.email,
+ },
+ ];
+ // If specific project is provided, add project scope.
+ if (specificProject.value) {
+ defaultScopes.push({
+ id: "project",
+ value: extractProjectResourceName(specificProject.value.name),
+ });
+ }
return {
query: state.params.query,
- scopes: [
- ...state.params.scopes,
- // Default scopes with type and creator.
- {
- id: "type",
- value: "DATA_EXPORT",
- },
- {
- id: "creator",
- value: currentUser.value.email,
- },
- ],
+ scopes: [...state.params.scopes, ...defaultScopes],
} as SearchParams;
});
@@ -113,10 +136,11 @@ const mergedUIIssueFilter = computed(() => {
return buildUIIssueFilterBySearchParams(dataExportIssueSearchParams.value);
});
-const supportOptionIdList = computed((): SearchScopeId[] => [
- "project",
- "instance",
- "database",
- "status",
-]);
+const supportOptionIdList = computed((): SearchScopeId[] => {
+ const scopes: SearchScopeId[] = ["instance", "database", "status"];
+ if (!specificProject.value) {
+ scopes.unshift("project");
+ }
+ return scopes;
+});
</script>