Skip to content

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

feat: add grant request support to CICD layout (#17839)

boojackd74e180c36db
diff --git a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
index 7bafdca797..2cf9662642 100644
--- a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
+++ b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
@@ -25,15 +25,15 @@
</div>
<template #footer>
<div class="flex items-center justify-end gap-x-2">
- <NButton @click="$emit('close')">{{ $t("common.cancel") }}</NButton>
+ <NButton quaternary @click="$emit('close')">{{
+ $t("common.cancel")
+ }}</NButton>
<NButton
type="primary"
:disabled="!allowCreate"
@click="doCreateIssue"
>
- <div class="flex items-center gap-1">
- {{ $t("common.submit") }}
- </div>
+ {{ $t("common.submit") }}
</NButton>
</div>
</template>
@@ -53,7 +53,7 @@ import { useRouter } from "vue-router";
import AddProjectMemberForm from "@/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { issueServiceClientConnect } from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
import { useCurrentUserV1, useProjectV1Store } from "@/store";
import type { DatabaseResource } from "@/types";
import { getUserEmailInBinding } from "@/types";
@@ -68,8 +68,8 @@ import {
import {
generateIssueTitle,
displayRoleTitle,
- issueV1Slug,
extractProjectResourceName,
+ extractIssueUID,
} from "@/utils";
interface LocalState {
@@ -161,10 +161,10 @@ const doCreateIssue = async () => {
const response = await issueServiceClientConnect.createIssue(request);
const route = router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
params: {
projectId: extractProjectResourceName(response.name),
- issueSlug: issueV1Slug(response.name, response.title),
+ issueId: extractIssueUID(response.name),
},
});
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
index ba3de16f0c..4e5b396396 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
@@ -82,6 +82,8 @@ import {
hasProjectPermissionV2,
extractProjectResourceName,
extractIssueUID,
+ isValidPlanName,
+ isValidIssueName,
} from "@/utils";
import TaskRolloutActionPanel from "../../RolloutView/TaskRolloutActionPanel.vue";
import { CreateButton } from "./create";
@@ -149,15 +151,38 @@ const rolloutStage = computed(() => {
);
});
-// Compute available actions based on issue state and user permissions
+/**
+ * Compute available actions based on issue state and user permissions.
+ *
+ * Action priority order:
+ * 1. Plan-level actions (for draft plans): PLAN_REOPEN, PLAN_CLOSE, ISSUE_CREATE
+ * 2. Issue review actions: ISSUE_REVIEW_APPROVE, ISSUE_REVIEW_REJECT, ISSUE_REVIEW_RE_REQUEST
+ * 3. Issue status actions: ISSUE_STATUS_RESOLVE, ISSUE_STATUS_CLOSE, ISSUE_STATUS_REOPEN
+ * 4. Rollout actions: ROLLOUT_START, ROLLOUT_CANCEL
+ *
+ * Special cases:
+ * - Grant requests: Issue-only (no plan), only show issue-related actions
+ * - Draft plans: Plans without issues, show plan management + issue creation
+ * - Deleted plans: Only show PLAN_REOPEN
+ * - Cancelled/Done issues: Only show ISSUE_STATUS_REOPEN
+ */
const availableActions = computed(() => {
const actions: UnifiedAction[] = [];
if (isCreating.value) return actions;
const currentUserEmail = currentUser.value.email;
+ const isIssueOnly =
+ !isValidPlanName(plan.value.name) && isValidIssueName(issue.value?.name);
+
+ // For issue-only cases (grant requests, etc.), skip plan-specific actions
+ // and go directly to issue-related actions
+ if (isIssueOnly) {
+ // Issue-only cases should not show plan actions
+ // Continue to issue-related actions below
+ }
// If no issue exists, show create issue action or close plan action.
- if (plan.value.issue === "") {
+ else if (plan.value.issue === "") {
// If rollout exists, no actions are available.
if (plan.value.rollout !== "") {
return actions;
@@ -329,9 +354,15 @@ const availableActions = computed(() => {
const primaryAction = computed((): ActionConfig | undefined => {
const actions = availableActions.value;
+ const isIssueOnly =
+ !isValidPlanName(plan.value.name) && isValidIssueName(issue.value?.name);
+ // Skip plan-specific actions for issue-only cases
+ if (isIssueOnly) {
+ // Skip ISSUE_CREATE, PLAN_REOPEN checks and go directly to issue actions
+ }
// ISSUE_CREATE is the highest priority when no issue exists
- if (actions.includes("ISSUE_CREATE")) {
+ else if (actions.includes("ISSUE_CREATE")) {
// Check if all specs have valid statements (not empty)
const hasValidSpecs = !plan.value.specs.some((spec) => isSpecEmpty(spec));
@@ -364,8 +395,8 @@ const primaryAction = computed((): ActionConfig | undefined => {
};
}
- // PLAN_REOPEN is primary when plan is deleted
- if (actions.includes("PLAN_REOPEN")) {
+ // PLAN_REOPEN is primary when plan is deleted (skip for issue-only)
+ if (!isIssueOnly && actions.includes("PLAN_REOPEN")) {
return { action: "PLAN_REOPEN" };
}
@@ -397,6 +428,8 @@ const primaryAction = computed((): ActionConfig | undefined => {
const secondaryActions = computed((): ActionConfig[] => {
const actions = availableActions.value;
+ const isIssueOnly =
+ !isValidPlanName(plan.value.name) && isValidIssueName(issue.value?.name);
const secondary: ActionConfig[] = [];
if (actions.includes("ISSUE_REVIEW_REJECT")) {
@@ -408,7 +441,8 @@ const secondaryActions = computed((): ActionConfig[] => {
if (actions.includes("ISSUE_STATUS_CLOSE")) {
secondary.push({ action: "ISSUE_STATUS_CLOSE" });
}
- if (actions.includes("PLAN_CLOSE")) {
+ // Skip PLAN_CLOSE for issue-only cases
+ if (!isIssueOnly && actions.includes("PLAN_CLOSE")) {
secondary.push({ action: "PLAN_CLOSE" });
}
diff --git a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
index ef33e8e5e3..a7d7239923 100644
--- a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
@@ -32,6 +32,7 @@ import { NButton, NTag } from "naive-ui";
import { computed } from "vue";
import { useRoute } from "vue-router";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import { isValidPlanName } from "@/utils";
import { usePlanContext } from "../../logic";
import { useSidebarContext } from "../../logic/sidebar";
import Actions from "./Actions";
@@ -58,10 +59,16 @@ const handleMobileSidebarOpen = () => {
};
const showDraftTag = computed(() => {
- return !isCreating.value && !plan.value.issue && !plan.value.rollout;
+ return (
+ !isCreating.value &&
+ isValidPlanName(plan.value.name) &&
+ !plan.value.issue &&
+ !plan.value.rollout
+ );
});
const showDescriptionSection = computed(() => {
- return !plan.value.issue;
+ // Only show when there's no issue yet (draft plan)
+ return isValidPlanName(plan.value.name) && !plan.value.issue;
});
</script>
diff --git a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
index 7ca841416a..a7863c7c2a 100644
--- a/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/TitleInput.vue
@@ -22,13 +22,18 @@ import { NInput } from "naive-ui";
import type { CSSProperties } from "vue";
import { computed, reactive, watch } from "vue";
import { useI18n } from "vue-i18n";
-import { planServiceClientConnect } from "@/grpcweb";
+import { issueServiceClientConnect, planServiceClientConnect } from "@/grpcweb";
import {
pushNotification,
useCurrentUserV1,
extractUserId,
useCurrentProjectV1,
} from "@/store";
+import {
+ IssueSchema,
+ Issue_Type,
+ UpdateIssueRequestSchema,
+} from "@/types/proto-es/v1/issue_service_pb";
import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
import { PlanSchema } from "@/types/proto-es/v1/plan_service_pb";
import { hasProjectPermissionV2 } from "@/utils";
@@ -39,19 +44,25 @@ type ViewMode = "EDIT" | "VIEW";
const { t } = useI18n();
const currentUser = useCurrentUserV1();
const { project } = useCurrentProjectV1();
-const { isCreating, plan, readonly } = usePlanContext();
+const { isCreating, plan, issue, readonly } = usePlanContext();
+
+const isGrantRequest = computed(
+ () => issue.value?.type === Issue_Type.GRANT_REQUEST
+);
const state = reactive({
isEditing: false,
isUpdating: false,
- title: plan.value.title,
+ title: "",
});
// Watch for changes in issue/plan to update the title
watch(
- () => [plan.value],
+ () => [plan.value, issue.value, isGrantRequest.value],
() => {
- state.title = plan.value.title;
+ state.title = isGrantRequest.value
+ ? issue.value?.title || ""
+ : plan.value.title;
},
{ immediate: true }
);
@@ -85,6 +96,21 @@ const allowEdit = computed(() => {
if (isCreating.value) {
return true;
}
+
+ // For grant requests, check issue permissions
+ if (isGrantRequest.value && issue.value) {
+ // Allowed if current user is the creator.
+ if (extractUserId(issue.value.creator) === currentUser.value.email) {
+ return true;
+ }
+ // Allowed if current user has related permission.
+ if (hasProjectPermissionV2(project.value, "bb.issues.update")) {
+ return true;
+ }
+ return false;
+ }
+
+ // For regular plans, check plan permissions
// Allowed if current user is the creator.
if (extractUserId(plan.value.creator) === currentUser.value.email) {
return true;
@@ -107,6 +133,45 @@ const onBlur = async () => {
return;
}
+ // For grant requests, update issue title
+ if (isGrantRequest.value && issue.value) {
+ if (state.title === issue.value.title) {
+ cleanup();
+ return;
+ }
+ try {
+ state.isUpdating = true;
+ const issuePatch = create(IssueSchema, {
+ ...issue.value,
+ title: state.title,
+ });
+ const request = create(UpdateIssueRequestSchema, {
+ issue: issuePatch,
+ updateMask: { paths: ["title"] },
+ });
+ const response = await issueServiceClientConnect.updateIssue(request);
+ Object.assign(issue.value, response);
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+ } catch (error) {
+ console.error("Failed to update issue title:", error);
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("common.error"),
+ description: String(error),
+ });
+ // Revert the title - use optional chaining in case issue becomes undefined
+ state.title = issue.value?.title || "";
+ } finally {
+ cleanup();
+ }
+ return;
+ }
+
// Update plan title
if (state.title === plan.value.title) {
cleanup();
@@ -129,6 +194,16 @@ const onBlur = async () => {
style: "SUCCESS",
title: t("common.updated"),
});
+ } catch (error) {
+ console.error("Failed to update plan title:", error);
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("common.error"),
+ description: String(error),
+ });
+ // Revert the title
+ state.title = plan.value.title;
} finally {
cleanup();
}
@@ -143,8 +218,12 @@ const onUpdateValue = (value: string) => {
if (!isCreating.value) {
return;
}
- // When creating, we only update plan title
- plan.value.title = value;
+ // When creating, update issue title for grant requests, plan title otherwise
+ if (isGrantRequest.value && issue.value) {
+ issue.value.title = value;
+ } else {
+ plan.value.title = value;
+ }
};
</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView.vue b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView.vue
new file mode 100644
index 0000000000..4a2d035526
--- /dev/null
+++ b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView.vue
@@ -0,0 +1,10 @@
+<template>
+ <div class="w-full space-y-4">
+ <!-- Grant Request Details Section -->
+ <RequestDetailsSection />
+ </div>
+</template>
+
+<script lang="ts" setup>
+import { RequestDetailsSection } from "./GrantRequestView";
+</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/RequestDetailsSection.vue b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/RequestDetailsSection.vue
new file mode 100644
index 0000000000..e23e04a519
--- /dev/null
+++ b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/RequestDetailsSection.vue
@@ -0,0 +1,81 @@
+<template>
+ <div class="space-y-4">
+ <h3 class="text-base font-medium">
+ {{ $t("issue.grant-request.details") }}
+ </h3>
+
+ <div class="p-4 border rounded space-y-4">
+ <!-- Requested Role -->
+ <div v-if="requestRole" class="space-y-2">
+ <span class="text-sm text-control-light">
+ {{ $t("role.self") }}
+ </span>
+ <div class="text-base">
+ {{ displayRoleTitle(requestRole) }}
+ </div>
+ </div>
+
+ <!-- Database Resources -->
+ <div v-if="condition?.databaseResources" class="space-y-2">
+ <span class="text-sm text-control-light">
+ {{ $t("common.database") }}
+ </span>
+ <div>
+ <span v-if="condition.databaseResources.length === 0">
+ {{ $t("issue.grant-request.all-databases") }}
+ </span>
+ <DatabaseResourceTable
+ v-else
+ class="w-full"
+ :database-resource-list="condition.databaseResources"
+ />
+ </div>
+ </div>
+
+ <!-- Expiration Time -->
+ <div class="space-y-2">
+ <span class="text-sm text-control-light">
+ {{ $t("issue.grant-request.expired-at") }}
+ </span>
+ <div class="text-base">
+ {{
+ condition?.expiredTime
+ ? dayjs(new Date(condition.expiredTime)).format("LLL")
+ : $t("project.members.never-expires")
+ }}
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { computedAsync } from "@vueuse/core";
+import dayjs from "dayjs";
+import { computed } from "vue";
+import { DatabaseResourceTable } from "@/components/IssueV1/components";
+import { displayRoleTitle } from "@/utils";
+import { convertFromCELString } from "@/utils/issue/cel";
+import { usePlanContextWithIssue } from "../../../logic";
+
+const { issue } = usePlanContextWithIssue();
+
+const requestRole = computed(() => {
+ return issue.value.grantRequest?.role;
+});
+
+const condition = computedAsync(
+ async () => {
+ try {
+ const conditionExpression = await convertFromCELString(
+ issue.value.grantRequest?.condition?.expression ?? ""
+ );
+ return conditionExpression;
+ } catch (error) {
+ console.error("Failed to parse CEL expression:", error);
+ return undefined;
+ }
+ },
+ undefined // default value while loading or on error
+);
+</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/index.ts b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/index.ts
new file mode 100644
index 0000000000..d8be9bb964
--- /dev/null
+++ b/frontend/src/components/Plan/components/IssueReviewView/GrantRequestView/index.ts
@@ -0,0 +1,3 @@
+import RequestDetailsSection from "./RequestDetailsSection.vue";
+
+export { RequestDetailsSection };
diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.ts
index 593fdb3dd4..6f29f4a7b7 100644
--- a/frontend/src/components/Plan/logic/initialize/index.ts
+++ b/frontend/src/components/Plan/logic/initialize/index.ts
@@ -6,16 +6,17 @@ import {
issueServiceClientConnect,
rolloutServiceClientConnect,
} from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { projectNamePrefix, usePlanStore } from "@/store";
import { EMPTY_ID, UNKNOWN_ID } from "@/types";
-import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
+import {
+ GetIssueRequestSchema,
+ Issue_Type,
+} from "@/types/proto-es/v1/issue_service_pb";
import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
import { emptyPlan } from "@/types/v1/issue/plan";
-import { issueV1Slug } from "@/utils";
import { createPlanSkeleton } from "./create";
export * from "./create";
@@ -125,14 +126,14 @@ export function useInitializePlan(
issueResult = newIssue;
if (!issueResult.plan) {
- // Redirect to legacy issue page for issues without plans.
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId,
- issueSlug: issueV1Slug(issueResult.name, issueResult.title),
- },
- });
+ // Issue without plan - allow it to stay in CICD layout for issue-only view
+ // This is expected for grant requests, but may indicate a problem for other issue types
+ if (issueResult.type !== Issue_Type.GRANT_REQUEST) {
+ console.warn(
+ `Issue ${issueUid} of type ${issueResult.type} has no associated plan`,
+ issueResult
+ );
+ }
return {
plan: emptyPlan(),
issue: issueResult,
diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.ts
index a7c58e38c2..92c7f27813 100644
--- a/frontend/src/components/Plan/logic/poller/poller.ts
+++ b/frontend/src/components/Plan/logic/poller/poller.ts
@@ -25,7 +25,7 @@ import { useCurrentProjectV1 } from "@/store";
import { isValidRolloutName } from "@/types";
import { IssueSchema } from "@/types/proto-es/v1/issue_service_pb";
import { RolloutSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import { isValidIssueName } from "@/utils";
+import { isValidIssueName, isValidPlanName } from "@/utils";
import { usePlanContext } from "../context";
import {
refreshPlan,
@@ -65,16 +65,18 @@ export const provideResourcePoller = () => {
hasInitialRefresh: false,
hasInitialResourceSetup: false,
isPollerRunning: false,
+ isInitializing: false, // Track if initialization is in progress
});
// Define refresh strategies for each resource
const resourceStrategies: Record<ResourceType, ResourceRefreshStrategy> = {
plan: {
- canRefresh: () => !!plan.value,
+ canRefresh: () => !!plan.value && isValidPlanName(plan.value.name),
refresh: () => refreshPlan(plan),
},
planCheckRuns: {
- canRefresh: () => !!plan.value && !!planCheckRuns,
+ canRefresh: () =>
+ !!plan.value && isValidPlanName(plan.value.name) && !!planCheckRuns,
refresh: () =>
refreshPlanCheckRuns(plan.value, project.value, planCheckRuns),
},
@@ -102,11 +104,19 @@ export const provideResourcePoller = () => {
},
taskRuns: {
canRefresh: () => !!rollout?.value && !!taskRuns,
- refresh: () => refreshTaskRuns(rollout.value!, project.value, taskRuns),
+ refresh: () => {
+ if (!rollout.value) return Promise.resolve();
+ return refreshTaskRuns(rollout.value, project.value, taskRuns);
+ },
},
};
const planType = computed(() => {
+ // Empty plan or no specs - default to CHANGE_DATABASE
+ if (plan.value.specs.length === 0) {
+ return "CHANGE_DATABASE";
+ }
+
if (
plan.value.specs.every(
(spec) => spec.config.case === "createDatabaseConfig"
@@ -156,40 +166,46 @@ export const provideResourcePoller = () => {
const initializeExistingResources = async () => {
if (
pollerState.value.hasInitialResourceSetup ||
+ pollerState.value.isInitializing ||
isCreating.value ||
!plan.value
) {
return;
}
- pollerState.value.hasInitialResourceSetup = true;
- const initPromises: Promise<void>[] = [];
-
- // Initialize issue if needed
- if (
- resourceStrategies.issue.canInitialize?.() &&
- resourceStrategies.issue.initialize
- ) {
- initPromises.push(resourceStrategies.issue.initialize());
- }
+ pollerState.value.isInitializing = true;
+ try {
+ pollerState.value.hasInitialResourceSetup = true;
+ const initPromises: Promise<void>[] = [];
+
+ // Initialize issue if needed
+ if (
+ resourceStrategies.issue.canInitialize?.() &&
+ resourceStrategies.issue.initialize
+ ) {
+ initPromises.push(resourceStrategies.issue.initialize());
+ }
- // Initialize rollout and taskRuns with proper sequencing
- if (
- resourceStrategies.rollout.canInitialize?.() &&
- resourceStrategies.rollout.initialize
- ) {
- initPromises.push(
- resourceStrategies.rollout.initialize().then(async () => {
- if (resourceStrategies.taskRuns.canRefresh()) {
- await resourceStrategies.taskRuns.refresh();
- }
- })
- );
- }
+ // Initialize rollout and taskRuns with proper sequencing
+ if (
+ resourceStrategies.rollout.canInitialize?.() &&
+ resourceStrategies.rollout.initialize
+ ) {
+ initPromises.push(
+ resourceStrategies.rollout.initialize().then(async () => {
+ if (resourceStrategies.taskRuns.canRefresh()) {
+ await resourceStrategies.taskRuns.refresh();
+ }
+ })
+ );
+ }
- if (initPromises.length > 0) {
- await Promise.all(initPromises);
- events.emit("status-changed", { eager: true });
+ if (initPromises.length > 0) {
+ await Promise.all(initPromises);
+ events.emit("status-changed", { eager: true });
+ }
+ } finally {
+ pollerState.value.isInitializing = false;
}
};
@@ -308,19 +324,31 @@ export const provideResourcePoller = () => {
// Event listeners
events.on("status-changed", async ({ eager }) => {
- if (eager) {
- await refreshResources(resourcesToPolled.value, { isManual: false });
+ try {
+ if (eager) {
+ await refreshResources(resourcesToPolled.value, { isManual: false });
+ }
+ } catch (error) {
+ console.error("Error refreshing resources on status-changed:", error);
}
});
events.on("perform-issue-review-action", async () => {
- await refreshResources(["issue"], { isManual: true });
- events.emit("status-changed", { eager: true });
+ try {
+ await refreshResources(["issue"], { isManual: true });
+ events.emit("status-changed", { eager: true });
+ } catch (error) {
+ console.error("Error refreshing issue after review action:", error);
+ }
});
events.on("perform-issue-status-action", async () => {
- await refreshResources(["issue"], { isManual: true });
- events.emit("status-changed", { eager: true });
+ try {
+ await refreshResources(["issue"], { isManual: true });
+ events.emit("status-changed", { eager: true });
+ } catch (error) {
+ console.error("Error refreshing issue after status action:", error);
+ }
});
// Main poller lifecycle management
diff --git a/frontend/src/components/Plan/logic/useCICDTabNavigation.tsx b/frontend/src/components/Plan/logic/useCICDTabNavigation.tsx
new file mode 100644
index 0000000000..93c21d822a
--- /dev/null
+++ b/frontend/src/components/Plan/logic/useCICDTabNavigation.tsx
@@ -0,0 +1,196 @@
+import { CirclePlayIcon, FileDiffIcon, Layers2Icon } from "lucide-vue-next";
+import { NTag } from "naive-ui";
+import type { Ref } from "vue";
+import { computed } from "vue";
+import type { ComposerTranslation } from "vue-i18n";
+import type { RouteLocationNormalizedLoaded, Router } from "vue-router";
+import {
+ PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_PLAN_DETAIL,
+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
+} from "@/router/dashboard/projectV1";
+import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
+import { EMPTY_PLAN_NAME } from "@/types/v1/issue/plan";
+import { extractIssueUID, extractPlanUID, extractRolloutUID } from "@/utils";
+
+export enum TabKey {
+ Plan = "plan",
+ Issue = "issue",
+ Rollout = "rollout",
+}
+
+export interface UseCICDTabNavigationOptions {
+ route: RouteLocationNormalizedLoaded;
+ router: Router;
+ plan: Ref<Plan>;
+ issue: Ref<Issue | undefined>;
+ isCreating: Ref<boolean>;
+ enabledNewLayout: Ref<boolean>;
+ t: ComposerTranslation;
+}
+
+export const useCICDTabNavigation = (options: UseCICDTabNavigationOptions) => {
+ const { route, router, plan, issue, isCreating, enabledNewLayout, t } =
+ options;
+
+ const tabKey = computed(() => {
+ const routeName = route.name?.toString();
+ if (!routeName) {
+ // Default to Issue if no valid plan, otherwise Plan
+ return plan.value.name === EMPTY_PLAN_NAME ? TabKey.Issue : TabKey.Plan;
+ }
+
+ if (
+ [
+ PROJECT_V1_ROUTE_PLAN_DETAIL,
+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ ].includes(routeName)
+ ) {
+ return TabKey.Plan;
+ } else if (routeName === PROJECT_V1_ROUTE_ISSUE_DETAIL_V1) {
+ return TabKey.Issue;
+ } else if (
+ [
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
+ ].includes(routeName)
+ ) {
+ return TabKey.Rollout;
+ }
+ // Fallback: Default to Issue if no valid plan, otherwise Plan
+ return plan.value.name === EMPTY_PLAN_NAME ? TabKey.Issue : TabKey.Plan;
+ });
+
+ const availableTabs = computed<TabKey[]>(() => {
+ const tabs: TabKey[] = [];
+
+ // Show Issue tab if issue exists and new layout is enabled
+ if (plan.value.issue && enabledNewLayout.value) {
+ tabs.push(TabKey.Issue);
+ }
+
+ // Only show Plan tab if we have a valid plan with specs
+ // Don't show Plan tab for grant requests (they don't have plan specs)
+ const isGrantRequest = issue.value?.type === Issue_Type.GRANT_REQUEST;
+ const hasValidPlan =
+ plan.value.name !== EMPTY_PLAN_NAME && plan.value.specs.length > 0;
+ if (hasValidPlan && !isGrantRequest) {
+ tabs.push(TabKey.Plan);
+ }
+
+ // Show Rollout tab if rollout exists
+ if (plan.value.rollout) {
+ tabs.push(TabKey.Rollout);
+ }
+
+ return tabs;
+ });
+
+ const issueTabContent = computed(() => (
+ <div class="flex items-center gap-2">
+ <Layers2Icon size={18} />
+ <span>{t("common.overview")}</span>
+ </div>
+ ));
+
+ const planTabContent = computed(() => (
+ <div class="flex items-center gap-2">
+ <FileDiffIcon size={18} />
+ <span>{t("plan.navigator.changes")}</span>
+ {(isCreating.value || plan.value.specs.length > 1) && (
+ <NTag size="tiny" round>
+ {plan.value.specs.length}
+ </NTag>
+ )}
+ </div>
+ ));
+
+ const rolloutTabContent = computed(() => (
+ <div class="flex items-center gap-2">
+ <CirclePlayIcon size={18} />
+ <span>{t("plan.navigator.rollout")}</span>
+ </div>
+ ));
+
+ const tabRender = (tab: TabKey) => {
+ switch (tab) {
+ case TabKey.Issue:
+ return issueTabContent.value;
+ case TabKey.Plan:
+ return planTabContent.value;
+ case TabKey.Rollout:
+ return rolloutTabContent.value;
+ default:
+ return tab;
+ }
+ };
+
+ const handleTabChange = (tab: TabKey) => {
+ if (!route?.params) {
+ console.error("Cannot navigate: route params are undefined");
+ return;
+ }
+
+ const params = { ...route.params };
+ if (isCreating.value) {
+ params.planId = "create";
+ } else {
+ params.planId = extractPlanUID(plan.value.name);
+ if (plan.value.issue) {
+ params.issueId = extractIssueUID(plan.value.issue);
+ }
+ if (plan.value.rollout) {
+ params.rolloutId = extractRolloutUID(plan.value.rollout);
+ }
+ }
+
+ const query = route.query || {};
+
+ if (tab === TabKey.Issue) {
+ router
+ .push({
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ params: params,
+ query: query,
+ })
+ .catch((error) => {
+ console.error("Failed to navigate to Issue tab:", error);
+ });
+ } else if (tab === TabKey.Plan) {
+ router
+ .push({
+ name: PROJECT_V1_ROUTE_PLAN_DETAIL,
+ params: params,
+ query: query,
+ })
+ .catch((error) => {
+ console.error("Failed to navigate to Plan tab:", error);
+ });
+ } else if (tab === TabKey.Rollout) {
+ router
+ .push({
+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
+ params: params,
+ query: query,
+ })
+ .catch((error) => {
+ console.error("Failed to navigate to Rollout tab:", error);
+ });
+ }
+ };
+
+ return {
+ tabKey,
+ availableTabs,
+ tabRender,
+ handleTabChange,
+ };
+};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 3c08784aa6..af26163fad 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -990,6 +990,7 @@
"waiting-for-review": "Waiting for review",
"issue-name": "Issue name",
"grant-request": {
+ "details": "Request Details",
"expired-at": "Expired at",
"all-databases": "All",
"all-databases-tip": "All current and future databases in this project.",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index f170751344..c9af629fe8 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -990,6 +990,7 @@
"waiting-for-review": "Esperando revisión",
"issue-name": "Nombre de la incidencia",
"grant-request": {
+ "details": "Detalles de la solicitud",
"expired-at": "tiempo de caducidad",
"all-databases": "todas las bases de datos",
"all-databases-tip": "Todas las bases de datos actuales y futuras de este proyecto.",
@@ -2932,4 +2933,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 0bc9f03ac6..4a0bd4eaf1 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -990,6 +990,7 @@
"waiting-for-review": "モデレート済み",
"issue-name": "イシュー名",
"grant-request": {
+ "details": "リクエストの詳細",
"expired-at": "有効期限",
"all-databases": "すべてのデータベース",
"all-databases-tip": "このプロジェクトに属する現在および将来のすべてのデータベース。",
@@ -2932,4 +2933,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index e70fcf141d..ccd83af8c5 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -990,6 +990,7 @@
"waiting-for-review": "Đang chờ xem xét",
"issue-name": "Tên vấn đề",
"grant-request": {
+ "details": "Yêu cầu chi tiết",
"expired-at": "Hết hạn vào",
"all-databases": "Tất cả",
"all-databases-tip": "Tất cả cơ sở dữ liệu hiện tại và tương lai trong dự án này.",
@@ -2932,4 +2933,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 18af259286..54f1a0c028 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -990,6 +990,7 @@
"waiting-for-review": "等待审核",
"issue-name": "工单名称",
"grant-request": {
+ "details": "请求详细",
"expired-at": "过期时间",
"all-databases": "所有数据库",
"all-databases-tip": "所有当前和未来属于这个项目的数据库。",
@@ -2932,4 +2933,4 @@
"last-visit": "上次访问",
"changelog-for-version": "{version} 的更新日志"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/src/utils/v1/issue/plan.ts b/frontend/src/utils/v1/issue/plan.ts
index 9cc464a74f..c407d7cbdb 100644
--- a/frontend/src/utils/v1/issue/plan.ts
+++ b/frontend/src/utils/v1/issue/plan.ts
@@ -22,7 +22,7 @@ export const isValidPlanName = (name: string | undefined) => {
return false;
}
const planUID = extractPlanUID(name);
- return (
+ return Boolean(
planUID && planUID !== String(EMPTY_ID) && planUID !== String(UNKNOWN_ID)
);
};
diff --git a/frontend/src/views/project/CICDLayout.vue b/frontend/src/views/project/CICDLayout.vue
index 044b7ff591..1eed63f081 100644
--- a/frontend/src/views/project/CICDLayout.vue
+++ b/frontend/src/views/project/CICDLayout.vue
@@ -20,7 +20,6 @@
:key="tab"
:name="tab"
:tab="tabRender(tab)"
- @click="handleTabChange(tab)"
/>
<!-- Suffix slot -->
@@ -33,7 +32,7 @@
<div class="flex-1 flex">
<router-view v-slot="{ Component }">
- <keep-alive>
+ <keep-alive :max="3">
<component :is="Component" />
</keep-alive>
</router-view>
@@ -49,9 +48,8 @@
<script lang="tsx" setup>
import { useTitle } from "@vueuse/core";
-import { CirclePlayIcon, FileDiffIcon, Layers2Icon } from "lucide-vue-next";
-import { NSpin, NTab, NTabs, NTag } from "naive-ui";
-import { computed, ref, toRef, watch } from "vue";
+import { NSpin, NTab, NTabs } from "naive-ui";
+import { computed, ref, toRef } from "vue";
import { useI18n } from "vue-i18n";
import {
useRoute,
@@ -68,32 +66,10 @@ import PollerProvider from "@/components/Plan/PollerProvider.vue";
import { BannerSection, HeaderSection } from "@/components/Plan/components";
import RefreshIndicator from "@/components/Plan/components/RefreshIndicator.vue";
import { provideSidebarContext } from "@/components/Plan/logic/sidebar";
+import { useCICDTabNavigation } from "@/components/Plan/logic/useCICDTabNavigation.tsx";
import { useNavigationGuard } from "@/components/Plan/logic/useNavigationGuard";
import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { useBodyLayoutContext } from "@/layouts/common";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- PROJECT_V1_ROUTE_PLAN_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
-} from "@/router/dashboard/projectV1";
-import {
- extractIssueUID,
- extractPlanUID,
- extractProjectResourceName,
- extractRolloutUID,
- issueV1Slug,
-} from "@/utils";
-
-enum TabKey {
- Plan = "plan",
- Issue = "issue",
- Rollout = "rollout",
-}
const props = defineProps<{
projectId: string;
@@ -123,16 +99,18 @@ const planBaseContext = useBasePlanContext({
issue,
});
const { enabledNewLayout } = useIssueLayoutVersion();
-const isLoading = ref(true);
-const isInitialLoad = ref(true);
const containerRef = ref<HTMLElement>();
const ready = computed(() => {
- // Only show loading spinner during initial load, not during tab navigation
- return !isInitialLoad.value && !!plan.value && !isInitializing.value;
+ // Ready when we have either an issue or a valid plan, and initialization is complete
+ return (!!issue.value || !!plan.value) && !isInitializing.value;
});
const shouldShowNavigation = computed(() => {
+ // Or if we have a valid plan with supported specs
+ if (!plan.value) {
+ return false;
+ }
return (
!isCreating.value &&
plan.value.specs.some(
@@ -158,154 +136,17 @@ providePlanContext({
provideSidebarContext(containerRef);
-watch(
- () => isInitializing.value,
- () => {
- if (isInitializing.value) {
- return;
- }
-
- // Mark initial load as complete once data is loaded
- if (isInitialLoad.value) {
- isInitialLoad.value = false;
- }
-
- // Redirect all non-changeDatabaseConfig plans to the legacy issue page.
- // Including export data plans.
- if (
- plan.value.issue &&
- plan.value.specs.some(
- (spec) =>
- spec.config.case !== "changeDatabaseConfig" &&
- spec.config.case !== "createDatabaseConfig" &&
- spec.config.case !== "exportDataConfig"
- )
- ) {
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(plan.value.name),
- issueSlug: issueV1Slug(plan.value.issue),
- },
- query: route.query,
- });
- } else {
- isLoading.value = false;
- }
- }
-);
-
-const tabKey = computed(() => {
- const routeName = route.name?.toString() as string;
- if (
- [
- PROJECT_V1_ROUTE_PLAN_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- ].includes(routeName)
- ) {
- return TabKey.Plan;
- } else if (routeName === PROJECT_V1_ROUTE_ISSUE_DETAIL_V1) {
- return TabKey.Issue;
- } else if (
- [
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
- PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
- ].includes(routeName)
- ) {
- return TabKey.Rollout;
- }
- // Fallback to Overview if no specific tab is matched.
- return TabKey.Plan;
-});
-
-const availableTabs = computed<TabKey[]>(() => {
- const tabs: TabKey[] = [TabKey.Plan];
- if (plan.value.issue && enabledNewLayout.value) {
- tabs.unshift(TabKey.Issue);
- }
- if (plan.value.rollout) {
- tabs.push(TabKey.Rollout);
- }
- return tabs;
-});
-
-const tabRender = (tab: TabKey) => {
- switch (tab) {
- case TabKey.Issue:
- return (
- <div class="flex items-center gap-2">
- <Layers2Icon size={18} />
- <span>{t("common.overview")}</span>
- </div>
- );
- case TabKey.Plan:
- return (
- <div class="flex items-center gap-2">
- <FileDiffIcon size={18} />
- <span>{t("plan.navigator.changes")}</span>
- {(isCreating.value || plan.value.specs.length > 1) && (
- <NTag size="tiny" round>
- {plan.value.specs.length}
- </NTag>
- )}
- </div>
- );
- case TabKey.Rollout:
- return (
- <div class="flex items-center gap-2">
- <CirclePlayIcon size={18} />
- <span>{t("plan.navigator.rollout")}</span>
- </div>
- );
- default:
- // Fallback to raw tab name.
- return tab;
- }
-};
-
-const handleTabChange = (tab: TabKey) => {
- if (!route || !route.params) {
- console.warn("Route or route.params is undefined");
- return;
- }
-
- const params = { ...route.params };
- if (isCreating.value) {
- params.planId = "create";
- } else {
- params.planId = extractPlanUID(plan.value.name);
- if (plan.value.issue) {
- params.issueId = extractIssueUID(plan.value.issue);
- }
- if (plan.value.rollout) {
- params.rolloutId = extractRolloutUID(plan.value.rollout);
- }
- }
-
- const query = route.query || {};
-
- if (tab === TabKey.Issue) {
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: params,
- query: query,
- });
- } else if (tab === TabKey.Plan) {
- router.push({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL,
- params: params,
- query: query,
- });
- } else if (tab === TabKey.Rollout) {
- router.push({
- name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
- params: params,
- query: query,
- });
- }
-};
+// Tab navigation
+const { tabKey, availableTabs, tabRender, handleTabChange } =
+ useCICDTabNavigation({
+ route,
+ router,
+ plan,
+ issue,
+ isCreating,
+ enabledNewLayout,
+ t,
+ });
const { overrideMainContainerClass } = useBodyLayoutContext();
@@ -330,21 +171,15 @@ const documentTitle = computed(() => {
useTitle(documentTitle);
// Set up navigation guards to check for unsaved changes
-onBeforeRouteLeave(async (_to, _from, next) => {
+const handleRouteNavigation = async (
+ _to: unknown,
+ _from: unknown,
+ next: (proceed?: boolean) => void
+) => {
const canNavigate = await confirmNavigation();
- if (canNavigate) {
- next();
- } else {
- next(false);
- }
-});
+ next(canNavigate);
+};
-onBeforeRouteUpdate(async (_to, _from, next) => {
- const canNavigate = await confirmNavigation();
- if (canNavigate) {
- next();
- } else {
- next(false);
- }
-});
+onBeforeRouteLeave(handleRouteNavigation);
+onBeforeRouteUpdate(handleRouteNavigation);
</script>
diff --git a/frontend/src/views/project/IssueDetailV1View.vue b/frontend/src/views/project/IssueDetailV1View.vue
index 40bc381f8a..be2d6fc87f 100644
--- a/frontend/src/views/project/IssueDetailV1View.vue
+++ b/frontend/src/views/project/IssueDetailV1View.vue
@@ -4,10 +4,13 @@
</div>
<IssueBaseLayout v-else>
<!-- Database Create View -->
- <DatabaseCreateView v-if="planType === PlanType.CREATE_DATABASE" />
+ <DatabaseCreateView v-if="issueType === IssueType.CREATE_DATABASE" />
<!-- Database Export View -->
- <DatabaseExportView v-else-if="planType === PlanType.EXPORT_DATA" />
+ <DatabaseExportView v-else-if="issueType === IssueType.EXPORT_DATA" />
+
+ <!-- Grant Request View -->
+ <GrantRequestView v-else-if="issueType === IssueType.GRANT_REQUEST" />
<!-- CI/CD View (default) -->
<DatabaseChangeView v-else />
@@ -22,15 +25,18 @@ import { usePlanContextWithIssue } from "@/components/Plan";
import DatabaseChangeView from "@/components/Plan/components/IssueReviewView/DatabaseChangeView.vue";
import DatabaseCreateView from "@/components/Plan/components/IssueReviewView/DatabaseCreateView.vue";
import DatabaseExportView from "@/components/Plan/components/IssueReviewView/DatabaseExportView.vue";
+import GrantRequestView from "@/components/Plan/components/IssueReviewView/GrantRequestView.vue";
import IssueBaseLayout from "@/components/Plan/components/IssueReviewView/IssueBaseLayout.vue";
import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
import { issueV1Slug } from "@/utils";
-enum PlanType {
+enum IssueType {
CREATE_DATABASE = "CREATE_DATABASE",
CHANGE_DATABASE = "CHANGE_DATABASE",
EXPORT_DATA = "EXPORT_DATA",
+ GRANT_REQUEST = "GRANT_REQUEST",
}
const props = defineProps<{
@@ -40,23 +46,28 @@ const props = defineProps<{
const router = useRouter();
const route = useRoute();
-const { plan } = usePlanContextWithIssue();
+const { plan, issue } = usePlanContextWithIssue();
const { enabledNewLayout } = useIssueLayoutVersion();
const isLoading = ref(true);
-const planType = computed(() => {
+const issueType = computed(() => {
+ // Check issue type first for grant requests
+ if (issue.value.type === Issue_Type.GRANT_REQUEST) {
+ return IssueType.GRANT_REQUEST;
+ }
+
if (
plan.value.specs.every(
(spec) => spec.config.case === "createDatabaseConfig"
)
) {
- return PlanType.CREATE_DATABASE;
+ return IssueType.CREATE_DATABASE;
} else if (
plan.value.specs.every((spec) => spec.config.case === "exportDataConfig")
) {
- return PlanType.EXPORT_DATA;
+ return IssueType.EXPORT_DATA;
}
- return PlanType.CHANGE_DATABASE;
+ return IssueType.CHANGE_DATABASE;
});
onMounted(() => {
@@ -66,8 +77,14 @@ onMounted(() => {
const isExportDataPlan = plan.value.specs.every(
(spec) => spec.config.case === "exportDataConfig"
);
- // Redirect to legacy layout if new layout is disabled and the plan is not a database creation or export data plan.
- if (!enabledNewLayout.value && !isCreatingDatabasePlan && !isExportDataPlan) {
+ const isGrantRequest = issue.value.type === Issue_Type.GRANT_REQUEST;
+ // Redirect to legacy layout if new layout is disabled and the plan is not a database creation, export data plan, or grant request.
+ if (
+ !enabledNewLayout.value &&
+ !isCreatingDatabasePlan &&
+ !isExportDataPlan &&
+ !isGrantRequest
+ ) {
const legacyIssueSlug = issueV1Slug(
`projects/${props.projectId}/issues/${props.issueId}`,
"issue"
diff --git a/frontend/src/views/project/ProjectIssueDetail.vue b/frontend/src/views/project/ProjectIssueDetail.vue
index b43135916e..cfc04313f1 100644
--- a/frontend/src/views/project/ProjectIssueDetail.vue
+++ b/frontend/src/views/project/ProjectIssueDetail.vue
@@ -34,6 +34,7 @@ import {
PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
} from "@/router/dashboard/projectV1";
import { projectNamePrefix, useProjectByName, useUIStateStore } from "@/store";
+import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
import {
extractIssueUID,
extractProjectResourceName,
@@ -114,8 +115,19 @@ watch(
(isReady) => {
if (!isReady) return;
- // Redirect all data export issues to new layout
- if (isDatabaseDataExportIssue(issue.value)) {
+ // Determine if this issue should use the new layout
+ const shouldUseNewLayout =
+ // Data export issues always use new layout
+ isDatabaseDataExportIssue(issue.value) ||
+ // Grant request issues always use new layout
+ isGrantRequestIssue(issue.value) ||
+ // Database creation issues always use new layout
+ (issue.value.type === Issue_Type.DATABASE_CHANGE &&
+ issue.value.planEntity?.specs.every(
+ (spec) => spec.config.case === "createDatabaseConfig"
+ ));
+
+ if (shouldUseNewLayout) {
if (isCreating.value) {
// Redirect creation to plan creation page
router.replace({