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: issue status/review actions in plan detail page (#16653)
boojack1df27257fbe3
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vueindex 6befaa108a..02e12c713c 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue@@ -3,6 +3,7 @@<ul><IssueCreatedComment :issue-comments="issueComments" :issue="issue" /><IssueCommentView+ class="group"v-for="(item, index) in issueComments":key="item.comment.name":issue="issue"@@ -12,8 +13,9 @@:similar="item.similar"><template v-if="allowEditIssueComment(item.comment)" #subject-suffix>- <div class="space-x-2 flex items-center text-control-light">- <!-- mr-2 is to vertical align with the text description edit button-->+ <div+ class="invisible group-hover:visible space-x-2 flex items-center text-control-light"+ ><divv-if="!state.editCommentMode"class="mr-2 flex items-center space-x-2"@@ -24,7 +26,7 @@size="tiny"@click.prevent="onUpdateComment(item.comment)">- <heroicons-outline:pencil class="w-4 h-4" />+ <PencilIcon class="w-4 h-4 text-control-light" /></NButton></div></div>@@ -108,6 +110,7 @@</template><script setup lang="ts">+import { PencilIcon } from "lucide-vue-next";import { NButton } from "naive-ui";import { computed, onMounted, reactive, ref, watch, watchEffect } from "vue";import { useRoute } from "vue-router";diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vueindex 5066d31517..c6c5d78a29 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue@@ -22,14 +22,14 @@<divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-solid:plus-sm class="w-5 h-5 text-control" />+ <PlusIcon class="w-5 h-5 text-control" /></div></div><div v-else-if="icon === 'update'" class="relative pl-0.5"><divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-solid:pencil class="w-4 h-4 text-control" />+ <PencilIcon class="w-4 h-4 text-control" /></div></div><div@@ -39,49 +39,49 @@<divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:play class="w-6 h-6 text-control" />+ <PlayCircleIcon class="w-5 h-5 text-control" /></div></div><div v-else-if="icon === 'approve-review'" class="relative pl-0.5"><div- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"+ class="w-7 h-7 bg-success rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:thumb-up class="w-5 h-5 text-control" />+ <ThumbsUpIcon class="w-4 h-4 text-white" /></div></div><div v-else-if="icon === 'reject-review'" class="relative pl-0.5"><divclass="w-7 h-7 bg-warning rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons:pause-solid class="w-5 h-5 text-white" />+ <PencilIcon class="w-4 h-4 text-white" /></div></div><div v-else-if="icon === 're-request-review'" class="relative pl-0.5"><div- class="w-7 h-7 bg-success rounded-full ring-4 ring-white flex items-center justify-center icon-re-request-review"+ class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center icon-re-request-review">- <heroicons:play class="w-4 h-4 text-white ml-px" />+ <PlayIcon class="w-4 h-4 text-control ml-px" /></div></div><div v-else-if="icon === 'cancel'" class="relative pl-0.5"><divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:minus class="w-5 h-5 text-control" />+ <MinusIcon class="w-5 h-5 text-control" /></div></div><div v-else-if="icon === 'fail'" class="relative pl-0.5"><divclass="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:exclamation-circle class="w-6 h-6 text-error" />+ <CircleAlertIcon class="w-5 h-5 text-error" /></div></div><div v-else-if="icon === 'complete'" class="relative pl-0.5"><divclass="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:check-circle class="w-6 h-6 text-success" />+ <CheckCircle2Icon class="w-6 h-6 text-success" /></div></div><div v-else-if="icon === 'skip'" class="relative pl-1">@@ -95,7 +95,7 @@<divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-outline:code class="w-5 h-5 text-control" />+ <CodeIcon class="w-5 h-5 text-control" /></div></div></div>@@ -103,6 +103,17 @@<script lang="ts" setup>import { computedAsync } from "@vueuse/core";+import {+ ThumbsUpIcon,+ PlayIcon,+ CheckCircle2Icon,+ PlusIcon,+ PencilIcon,+ PlayCircleIcon,+ MinusIcon,+ CodeIcon,+ CircleAlertIcon,+} from "lucide-vue-next";import { computed } from "vue";import { SkipIcon } from "@/components/Icon";import PrincipalAvatar from "@/components/PrincipalAvatar.vue";diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vueindex aa8abd0f6d..6ec6214a1d 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedComment.vue@@ -12,7 +12,7 @@<divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center">- <heroicons-solid:plus-sm class="w-5 h-5 text-control" />+ <PlusIcon class="w-5 h-5 text-control" /></div></div></div>@@ -35,6 +35,7 @@</template><script lang="ts" setup>+import { PlusIcon } from "lucide-vue-next";import HumanizeTs from "@/components/misc/HumanizeTs.vue";import { getTimeForPbTimestamp, type ComposedIssue } from "@/types";import ActionCreator from "./ActionCreator.vue";diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vueindex 2ad75f69c3..d038920d75 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue@@ -57,7 +57,7 @@ const link = computed(() => {return {name: PROJECT_V1_ROUTE_ISSUE_DETAIL,params: {- projectId: extractProjectResourceName(issue.project),+ projectId: extractProjectResourceName(issue.name),issueSlug: issueV1Slug(issue.name, issue.title),},query,diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.tsindex 275fac3aac..05dc3983f2 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/common.ts@@ -1,4 +1,5 @@import { IssueCommentType, type ComposedIssueComment } from "@/store";+import { isNullOrUndefined } from "@/utils";export type DistinctIssueComment = {comment: ComposedIssueComment;@@ -19,7 +20,6 @@ export const isSimilarIssueComment = (if (!fromTaskUpdate || !toTaskUpdate) {return false;}-if (fromTaskUpdate.toSheet &&fromTaskUpdate.toSheet === toTaskUpdate.toSheet@@ -33,18 +33,38 @@ export const isSimilarIssueComment = (return true;}}+ if (a.type === IssueCommentType.ISSUE_UPDATE) {+ if (+ !isNullOrUndefined(a.issueUpdate?.toTitle) &&+ !isNullOrUndefined(b.issueUpdate?.toTitle)+ ) {+ return true;+ }+ if (+ !isNullOrUndefined(a.issueUpdate?.toDescription) &&+ !isNullOrUndefined(b.issueUpdate?.toDescription)+ ) {+ return true;+ }+ if (+ !isNullOrUndefined(a.issueUpdate?.toLabels) &&+ !isNullOrUndefined(b.issueUpdate?.toLabels)+ ) {+ return true;+ }+ }return false;};export const isUserEditableComment = (comment: ComposedIssueComment) => {+ // Always allow editing user comments.if (comment.type === IssueCommentType.USER_COMMENT) {return true;}- if (comment.type === IssueCommentType.APPROVAL) {- if (comment.comment !== "") {- return true;- }+ // For approval comments, we allow editing if the comment is not empty.+ if (comment.type === IssueCommentType.APPROVAL && comment.comment !== "") {+ return true;}return false;};diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vueindex c24ebc0870..0788ea812c 100644--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue@@ -50,24 +50,19 @@ import BatchIssueActionsV1 from "@/components/IssueV1/components/BatchIssueActioimport CurrentApproverV1 from "@/components/IssueV1/components/CurrentApproverV1.vue";import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";import { emitWindowEvent } from "@/plugins";-import {- PROJECT_V1_ROUTE_ISSUE_DETAIL,- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,-} from "@/router/dashboard/projectV1";+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";import { useUserStore } from "@/store";import {getTimeForPbTimestamp,unknownUser,type ComposedIssue,} from "@/types";-import { Issue_Type } from "@/types/proto/v1/issue_service";import {getHighlightHTMLByRegExp,extractProjectResourceName,humanizeTs,issueV1Slug,extractIssueUID,- isDev,} from "@/utils";import { projectOfIssue } from "../logic";import IssueLabelSelector, {@@ -254,23 +249,13 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {});const issueUrl = (issue: ComposedIssue) => {- const route =- // TODO(steven): Remove this when we fully migrate to v1 issue detail page.- isDev() && issue.type === Issue_Type.DATABASE_CHANGE && !issue.rollout- ? router.resolve({- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,- params: {- projectId: extractProjectResourceName(issue.project),- issueId: extractIssueUID(issue.name),- },- })- : router.resolve({- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,- params: {- projectId: extractProjectResourceName(issue.project),- issueSlug: issueV1Slug(issue.name, issue.title),- },- });+ const route = router.resolve({+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,+ params: {+ projectId: extractProjectResourceName(issue.name),+ issueSlug: issueV1Slug(issue.name, issue.title),+ },+ });return route.fullPath;};diff --git a/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue b/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vueindex 9a7e189710..808e13ea74 100644--- a/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue+++ b/frontend/src/components/IssueV1/components/Panel/CommonDrawer.vue@@ -1,5 +1,5 @@<template>- <Drawer :show="show" :mask-closable="false" @close="$emit('close')">+ <Drawer :show="show" :mask-closable="true" @close="$emit('close')"><DrawerContent:title="title"class="relative overflow-hidden w-[30rem] max-w-[100vw]"diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vueindex da21e8f58d..ef073c51b8 100644--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue@@ -58,6 +58,20 @@<PreBackupSection ref="preBackupSectionRef" /><GhostSection v-if="shouldShowGhostSection" /></div>++ <router-link+ v-if="shouldShowExperimentalIssuePageLink"+ :to="{+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,+ params: {+ projectId: extractProjectResourceName(project.name),+ issueId: extractIssueUID(issue.name),+ },+ }"+ class="text-sm font-normal text-blue-700 hover:underline"+ >+ {{ "Experimental issue page" }}+ </router-link></div></template>@@ -71,10 +85,12 @@ import { GhostSection } from "@/components/Plan/components/Configuration";import { provideGhostSettingContext } from "@/components/Plan/components/Configuration/GhostSection/context";import { ApprovalFlowSection } from "@/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection";import { issueServiceClient } from "@/grpcweb";+import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";import { pushNotification, useCurrentProjectV1 } from "@/store";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { Issue } from "@/types/proto/v1/issue_service";+import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";import type { Plan } from "@/types/proto/v1/plan_service";+import { extractIssueUID, extractProjectResourceName, isDev } from "@/utils";import { specForTask, useIssueContext } from "../../logic";import IssueLabels from "./IssueLabels.vue";import PreBackupSection from "./PreBackupSection";@@ -113,6 +129,14 @@ const shouldShowPreBackupSection = computed(() => {return preBackupSectionRef.value?.shouldShow ?? false;});+const shouldShowExperimentalIssuePageLink = computed(() => {+ return (+ !isCreating.value &&+ isDev() &&+ issue.value.type === Issue_Type.DATABASE_CHANGE+ );+});+const onIssueLabelsUpdate = async (labels: string[]) => {if (isCreating.value) {issue.value.labels = labels;diff --git a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor/MarkdownEditor.vueindex 5ee57716b6..42ad8d83af 100644--- a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue+++ b/frontend/src/components/MarkdownEditor/MarkdownEditor.vue@@ -3,8 +3,8 @@<div v-if="mode === 'editor'" class="flex gap-x-2 mb-2 text-sm"><div:class="[- 'p-2 rounded cursor-pointer',- state.showPreview ? '' : 'bg-gray-100 text-gray-800',+ 'px-2 py-1 rounded cursor-pointer text-gray-700',+ state.showPreview ? 'opacity-80' : 'bg-gray-100',]"@click="state.showPreview = false">@@ -12,8 +12,8 @@</div><div:class="[- 'p-2 rounded cursor-pointer',- state.showPreview ? 'bg-gray-100 text-gray-800' : '',+ 'px-2 py-1 rounded cursor-pointer text-gray-700',+ state.showPreview ? 'bg-gray-100' : 'opacity-80',]"@click="state.showPreview = true">@@ -27,23 +27,7 @@<NTooltip :show-arrow="true"><template #trigger><NButton quaternary size="small" @click="toolbar.action">- <template v-if="toolbar.text">- <span class="font-bold">{{ toolbar.text }}</span>- </template>- <template v-else-if="toolbar.icon">- <heroicons-outline:code- v-if="toolbar.icon === 'code'"- class="w-4 h-4"- />- <heroicons-outline:link- v-else-if="toolbar.icon === 'link'"- class="w-4 h-4"- />- <heroicons-outline:hashtag- v-else-if="toolbar.icon === 'hashtag'"- class="w-4 h-4"- />- </template>+ <component :is="toolbar.icon" class="w-4 h-4" /></NButton></template><span class="w-56 text-sm">@@ -64,7 +48,7 @@ref="contentTextArea"v-model="state.content"rows="3"- class="textarea block w-full resize-none whitespace-pre-wrap bg-gray-100"+ class="textarea block w-full resize-none whitespace-pre-wrap bg-gray-100 rounded":placeholder="$t('issue.leave-a-comment')"@mousedown="clearIssuePanel"@input="(e: any) => sizeToFit(e.target)"@@ -104,8 +88,16 @@</template><script lang="ts" setup>+import {+ CodeIcon,+ LinkIcon,+ HashIcon,+ BoldIcon,+ HeadingIcon,+} from "lucide-vue-next";import { NButton, NTooltip } from "naive-ui";import { nextTick, ref, reactive, watch, toRef } from "vue";+import type { Component } from "vue";import { useI18n } from "vue-i18n";import type { ComposedIssue, ComposedProject } from "@/types";import { Task_Status } from "@/types/proto/v1/rollout_service";@@ -124,8 +116,7 @@ interface LocalState {}interface Toolbar {- icon?: string;- text?: string;+ icon: Component;tooltip: string;action: () => void;}@@ -318,35 +309,35 @@ const getCursorPosition = (lines: string[]): number => {const toolbarItems: Toolbar[] = [{- text: "H",+ icon: HeadingIcon,tooltip: t("issue.comment-editor.toolbar.header"),action: () => {insertWithCursorPosition("### ", 4);},},{- text: "B",+ icon: BoldIcon,tooltip: t("issue.comment-editor.toolbar.bold"),action: () => {insertWithCursorPosition("****", 2);},},{- icon: "code",+ icon: CodeIcon,tooltip: t("issue.comment-editor.toolbar.code"),action: () => {insertWithCursorPosition("```sql\n\n```", 7);},},{- icon: "link",+ icon: LinkIcon,tooltip: t("issue.comment-editor.toolbar.link"),action: () => {insertWithCursorPosition("[](url)", 1);},},{- icon: "hashtag",+ icon: HashIcon,tooltip: t("issue.comment-editor.toolbar.hashtag"),action: () => {insertWithCursorPosition("#", 1);diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex 45bbc312fa..d149fd5a07 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -1,11 +1,192 @@<template><CreateButton v-if="isCreating" />- <CreateIssueButton v-else-if="!plan.issue" />+ <template v-else>+ <CreateIssueButton v-if="!plan.issue" />+ <template v-else-if="plan.issue">+ <UnifiedActionGroup+ :primary-action="primaryAction"+ :secondary-actions="secondaryActions"+ @perform-action="handlePerformAction"+ />++ <!-- Panels -->+ <IssueReviewActionPanel+ :action="pendingReviewAction"+ @close="pendingReviewAction = undefined"+ />+ <IssueStatusActionPanel+ :action="pendingStatusAction"+ @close="pendingStatusAction = undefined"+ />+ </template>+ </template></template><script setup lang="ts">+import { head } from "lodash-es";+import { computed, ref } from "vue";import { usePlanContext } from "@/components/Plan/logic";+import { provideIssueReviewContext } from "@/components/Plan/logic/issue-review";+import {+ useCurrentUserV1,+ candidatesOfApprovalStepV1,+ extractUserId,+ useCurrentProjectV1,+} from "@/store";+import {+ IssueStatus,+ Issue_Approver_Status,+} from "@/types/proto/v1/issue_service";+import { isUserIncludedInList, hasProjectPermissionV2 } from "@/utils";import { CreateButton, CreateIssueButton } from "./create";+import { IssueReviewActionPanel, IssueStatusActionPanel } from "./panels";+import {+ UnifiedActionGroup,+ type ActionConfig,+ type IssueReviewAction,+ type IssueStatusAction,+ type UnifiedAction,+} from "./unified";++const { isCreating, plan, issue } = usePlanContext();+const currentUser = useCurrentUserV1();+const { project } = useCurrentProjectV1();++// Provide issue review context when an issue exists+const reviewContext = provideIssueReviewContext(issue);++// Panel visibility state+const pendingReviewAction = ref<IssueReviewAction | undefined>(undefined);+const pendingStatusAction = ref<IssueStatusAction | undefined>(undefined);++// Compute available actions based on issue state and user permissions+const availableActions = computed(() => {+ const actions: UnifiedAction[] = [];++ if (!issue?.value || isCreating.value) return actions;++ const issueValue = issue.value;+ const isCanceled = issueValue.status === IssueStatus.CANCELED;+ const isDone = issueValue.status === IssueStatus.DONE;++ // If issue is canceled, check for re-open action+ if (isCanceled) {+ const currentUserEmail = currentUser.value.email;+ const issueCreator = extractUserId(issueValue.creator);+ const canReopen =+ currentUserEmail === issueCreator ||+ hasProjectPermissionV2(project.value, "bb.issues.update");++ if (canReopen) {+ actions.push("REOPEN");+ }+ return actions;+ }++ // If issue is done, no actions available+ if (isDone) return actions;++ // Check for review actions+ if (issueValue.approvalFindingDone && !reviewContext.done.value) {+ const currentUserEmail = currentUser.value.email;+ const issueCreator = extractUserId(issueValue.creator);+ const { approvers, approvalTemplates } = issueValue;++ // Check if issue has been rejected+ const hasRejection = approvers.some(+ (app) => app.status === Issue_Approver_Status.REJECTED+ );++ // RE_REQUEST is only available to the issue creator when rejected+ if (hasRejection && currentUserEmail === issueCreator) {+ actions.push("RE_REQUEST");+ } else {+ // Check if user can approve/reject+ const steps = head(approvalTemplates)?.flow?.steps ?? [];+ if (steps.length > 0) {+ const rejectedIndex = approvers.findIndex(+ (ap) => ap.status === Issue_Approver_Status.REJECTED+ );+ const currentStepIndex =+ rejectedIndex >= 0 ? rejectedIndex : approvers.length;+ const currentStep = steps[currentStepIndex];++ if (currentStep) {+ const candidates = candidatesOfApprovalStepV1(+ issueValue,+ currentStep+ );+ if (isUserIncludedInList(currentUserEmail, candidates)) {+ if (hasRejection) {+ actions.push("APPROVE");+ } else {+ actions.push("APPROVE", "REJECT");+ }+ }+ }+ }+ }+ }++ // Check for close action+ const currentUserEmail = currentUser.value.email;+ const issueCreator = extractUserId(issueValue.creator);+ const canClose =+ currentUserEmail === issueCreator ||+ hasProjectPermissionV2(project.value, "bb.issues.update");++ if (canClose) {+ actions.push("CLOSE");+ }++ return actions;+});++const primaryAction = computed((): ActionConfig | undefined => {+ const actions = availableActions.value;++ // REOPEN is primary when issue is closed+ if (actions.includes("REOPEN")) {+ return { action: "REOPEN" };+ }++ // APPROVE and RE_REQUEST are primary actions+ if (actions.includes("APPROVE")) {+ return { action: "APPROVE" };+ }+ if (actions.includes("RE_REQUEST")) {+ return { action: "RE_REQUEST" };+ }++ return undefined;+});++const secondaryActions = computed((): ActionConfig[] => {+ const actions = availableActions.value;+ const secondary: ActionConfig[] = [];++ // REJECT and CLOSE go in the dropdown+ if (actions.includes("REJECT")) {+ secondary.push({ action: "REJECT" });+ }+ if (actions.includes("CLOSE")) {+ secondary.push({ action: "CLOSE" });+ }++ return secondary;+});-const { isCreating, plan } = usePlanContext();+const handlePerformAction = (action: UnifiedAction) => {+ switch (action) {+ case "APPROVE":+ case "REJECT":+ case "RE_REQUEST":+ pendingReviewAction.value = action as IssueReviewAction;+ break;+ case "CLOSE":+ case "REOPEN":+ pendingStatusAction.value = action as IssueStatusAction;+ break;+ }+};</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vueindex d9d51e3bf0..0378e95f2b 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue@@ -173,7 +173,6 @@ const buildIssue = () => {const issue = emptyIssue();const me = useCurrentUserV1();issue.creator = `users/${me.value.email}`;- issue.project = project.value.name;issue.title = plan.value.title;issue.description = plan.value.description;issue.status = IssueStatus.OPEN;diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vuenew file mode 100644index 0000000000..e87a706114--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue@@ -0,0 +1,232 @@+<template>+ <CommonDrawer+ :show="action !== undefined"+ :title="title"+ :loading="state.loading"+ @show="resetState"+ @close="$emit('close')"+ >+ <template #default>+ <div v-if="action" class="flex flex-col gap-y-4 px-1">+ <div class="flex flex-col gap-y-1">+ <div class="font-medium text-control">+ {{ $t("common.issue") }}+ </div>+ <div class="textinfolabel">+ {{ issue.title }}+ </div>+ </div>++ <div class="flex flex-col gap-y-1">+ <p class="font-medium text-control">+ {{ $t("common.comment") }}+ <RequiredStar v-show="props.action === 'REJECT'" />+ </p>+ <NInput+ v-model:value="comment"+ type="textarea"+ :placeholder="$t('issue.leave-a-comment')"+ :autosize="{+ minRows: 3,+ maxRows: 10,+ }"+ />+ </div>+ </div>+ </template>+ <template #footer>+ <div+ v-if="action"+ class="w-full flex flex-row justify-between items-center gap-2"+ >+ <div>+ <NCheckbox+ v-if="showPerformActionAnyway"+ v-model:checked="performActionAnyway"+ >+ {{+ $t("issue.action-anyway", {+ action: actionDisplayName(action),+ })+ }}+ </NCheckbox>+ </div>+ <div class="flex justify-end gap-x-3">+ <NButton @click="$emit('close')">+ {{ $t("common.cancel") }}+ </NButton>++ <NTooltip :disabled="confirmErrors.length === 0" placement="top">+ <template #trigger>+ <NButton+ type="primary"+ :disabled="confirmErrors.length > 0"+ v-bind="confirmButtonProps"+ @click="handleConfirm"+ >+ {{ $t("common.confirm") }}+ </NButton>+ </template>+ <template #default>+ <ErrorList :errors="confirmErrors" />+ </template>+ </NTooltip>+ </div>+ </div>+ </template>+ </CommonDrawer>+</template>++<script setup lang="ts">+import { NButton, NCheckbox, NInput, NTooltip } from "naive-ui";+import { computed, reactive, ref } from "vue";+import { useI18n } from "vue-i18n";+import CommonDrawer from "@/components/IssueV1/components/Panel/CommonDrawer.vue";+import { ErrorList } from "@/components/IssueV1/components/common";+import { usePlanContextWithIssue } from "@/components/Plan/logic";+import RequiredStar from "@/components/RequiredStar.vue";+import { issueServiceClient } from "@/grpcweb";+import type { IssueReviewAction } from "../unified";++type LocalState = {+ loading: boolean;+};++const props = defineProps<{+ action?: IssueReviewAction;+}>();+const emit = defineEmits<{+ (event: "close"): void;+}>();++const { t } = useI18n();+const state = reactive<LocalState>({+ loading: false,+});+const { issue, planCheckRunList, events } = usePlanContextWithIssue();+const comment = ref("");+const performActionAnyway = ref(false);++const title = computed(() => {+ switch (props.action) {+ case "APPROVE":+ return t("custom-approval.issue-review.approve-issue");+ case "REJECT":+ return t("custom-approval.issue-review.send-back-issue");+ case "RE_REQUEST":+ return t("custom-approval.issue-review.re-request-review-issue");+ }+ return ""; // Make linter happy+});++const actionDisplayName = (action: IssueReviewAction): string => {+ switch (action) {+ case "APPROVE":+ return t("common.approve");+ case "REJECT":+ return t("custom-approval.issue-review.send-back");+ case "RE_REQUEST":+ return t("custom-approval.issue-review.re-request-review");+ }+};++const showPerformActionAnyway = computed(() => {+ return planCheckErrors.value.length > 0;+});++const planCheckErrors = computed(() => {+ const errors: string[] = [];+ if (props.action === "APPROVE") {+ // Check plan check runs for errors+ const failedRuns = planCheckRunList.value.filter(+ (run) => run.status === "FAILED"+ );+ const runningRuns = planCheckRunList.value.filter(+ (run) => run.status === "RUNNING"+ );++ if (failedRuns.length > 0) {+ errors.push(+ t(+ "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"+ )+ );+ }+ if (runningRuns.length > 0) {+ errors.push(+ t(+ "custom-approval.issue-review.disallow-approve-reason.some-task-checks-are-still-running"+ )+ );+ }+ }++ return errors;+});++const confirmErrors = computed(() => {+ const errors: string[] = [];+ if (props.action === "REJECT" && comment.value === "") {+ errors.push(+ t(+ "custom-approval.issue-review.disallow-approve-reason.x-field-is-required",+ {+ field: t("common.comment"),+ }+ )+ );+ }+ if (planCheckErrors.value.length > 0 && !performActionAnyway.value) {+ errors.push(...planCheckErrors.value);+ }+ return errors;+});++const confirmButtonProps = computed(() => {+ if (!props.action) return {};++ switch (props.action) {+ case "APPROVE":+ return { type: "primary" as const };+ case "REJECT":+ return { type: "primary" as const };+ default:+ return {};+ }+});++const handleConfirm = async () => {+ const { action } = props;+ if (!action) return;+ state.loading = true;+ try {+ if (action === "APPROVE") {+ await issueServiceClient.approveIssue({+ name: issue.value.name,+ comment: comment.value,+ });+ } else if (action === "REJECT") {+ await issueServiceClient.rejectIssue({+ name: issue.value.name,+ comment: comment.value,+ });+ } else if (action === "RE_REQUEST") {+ await issueServiceClient.requestIssue({+ name: issue.value.name,+ comment: comment.value,+ });+ }++ // Emit event to trigger polling+ events.emit("perform-issue-review-action", { action });+ } finally {+ state.loading = false;+ emit("close");+ }+};++const resetState = () => {+ comment.value = "";+ performActionAnyway.value = false;+};+</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vuenew file mode 100644index 0000000000..eaba2c5b65--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue@@ -0,0 +1,129 @@+<template>+ <CommonDrawer+ :show="action !== undefined"+ :title="title"+ :loading="state.loading"+ @show="resetState"+ @close="$emit('close')"+ >+ <template #default>+ <div v-if="action" class="flex flex-col gap-y-4 px-1">+ <div class="flex flex-col gap-y-1">+ <div class="font-medium text-control">+ {{ $t("common.issue") }}+ </div>+ <div class="textinfolabel">+ {{ issue.title }}+ </div>+ </div>++ <div class="flex flex-col gap-y-1">+ <p class="font-medium text-control">+ {{ $t("common.comment") }}+ </p>+ <NInput+ v-model:value="comment"+ type="textarea"+ :placeholder="$t('issue.leave-a-comment')"+ :autosize="{+ minRows: 3,+ maxRows: 10,+ }"+ />+ </div>+ </div>+ </template>+ <template #footer>+ <div+ v-if="action"+ class="w-full flex flex-row justify-between items-center gap-2"+ >+ <div></div>+ <div class="flex justify-end gap-x-3">+ <NButton @click="$emit('close')">+ {{ $t("common.cancel") }}+ </NButton>++ <NButton type="primary" @click="handleConfirm">+ {{ $t("common.confirm") }}+ </NButton>+ </div>+ </div>+ </template>+ </CommonDrawer>+</template>++<script setup lang="ts">+import { NButton, NInput } from "naive-ui";+import { computed, reactive, ref } from "vue";+import { useI18n } from "vue-i18n";+import CommonDrawer from "@/components/IssueV1/components/Panel/CommonDrawer.vue";+import { usePlanContextWithIssue } from "@/components/Plan/logic";+import { issueServiceClient } from "@/grpcweb";+import { useCurrentProjectV1 } from "@/store";+import { IssueStatus } from "@/types/proto/v1/issue_service";+import type { IssueStatusAction } from "../unified";++type LocalState = {+ loading: boolean;+};++const props = defineProps<{+ action?: IssueStatusAction;+}>();+const emit = defineEmits<{+ (event: "close"): void;+}>();++const { t } = useI18n();+const state = reactive<LocalState>({+ loading: false,+});+const { project } = useCurrentProjectV1();+const { issue, events } = usePlanContextWithIssue();+const comment = ref("");++const title = computed(() => {+ switch (props.action) {+ case "CLOSE":+ return t("issue.batch-transition.close");+ case "REOPEN":+ return t("issue.batch-transition.reopen");+ }+ return "";+});++const handleConfirm = async () => {+ const { action } = props;+ if (!action) return;+ state.loading = true;+ try {+ let issueStatus: IssueStatus;+ switch (action) {+ case "CLOSE":+ issueStatus = IssueStatus.CANCELED;+ break;+ case "REOPEN":+ issueStatus = IssueStatus.OPEN;+ break;+ default:+ throw new Error(`Unsupported action: ${action}`);+ }+ await issueServiceClient.batchUpdateIssuesStatus({+ parent: project.value.name,+ issues: [issue.value.name],+ status: issueStatus,+ reason: comment.value ?? "",+ });+ // Emit event to trigger polling+ events.emit("perform-issue-status-action", { action });+ } finally {+ state.loading = false;+ emit("close");+ }+};++const resetState = () => {+ comment.value = "";+};+</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/index.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/index.tsnew file mode 100644index 0000000000..0b2babd0c6--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/index.ts@@ -0,0 +1,2 @@+export { default as IssueReviewActionPanel } from "./IssueReviewActionPanel.vue";+export { default as IssueStatusActionPanel } from "./IssueStatusActionPanel.vue";\ No newline at end of filediff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vuenew file mode 100644index 0000000000..e535a74bf4--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vue@@ -0,0 +1,59 @@+<template>+ <NButton+ size="medium"+ tag="div"+ v-bind="actionButtonProps(action)"+ :disabled="disabled"+ @click="$emit('perform-action', action)"+ >+ {{ actionDisplayName(action) }}+ </NButton>+</template>++<script setup lang="ts">+import { NButton } from "naive-ui";+import { useI18n } from "vue-i18n";+import type { UnifiedAction } from "./types";++defineProps<{+ action: UnifiedAction;+ disabled?: boolean;+}>();++defineEmits<{+ (event: "perform-action", action: UnifiedAction): void;+}>();++const { t } = useI18n();++const actionDisplayName = (action: UnifiedAction): string => {+ switch (action) {+ case "APPROVE":+ return t("common.approve");+ case "REJECT":+ return t("custom-approval.issue-review.send-back");+ case "RE_REQUEST":+ return t("custom-approval.issue-review.re-request-review");+ case "CLOSE":+ return t("issue.batch-transition.close");+ case "REOPEN":+ return t("issue.batch-transition.reopen");+ }+};++const actionButtonProps = (action: UnifiedAction) => {+ switch (action) {+ case "APPROVE":+ return {+ type: "primary" as const,+ };+ case "RE_REQUEST":+ case "REOPEN":+ case "REJECT":+ case "CLOSE":+ return {+ type: "default" as const,+ };+ }+};+</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vuenew file mode 100644index 0000000000..7b1121adb5--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vue@@ -0,0 +1,115 @@+<template>+ <div class="flex items-center gap-x-2">+ <!-- Primary action button -->+ <UnifiedActionButton+ v-if="primaryAction"+ :action="primaryAction.action"+ :disabled="primaryAction.disabled"+ @perform-action="handleAction"+ />++ <!-- Dropdown for secondary actions -->+ <NDropdown+ v-if="secondaryActions.length > 0"+ trigger="click"+ placement="bottom-end"+ :options="dropdownOptions"+ :render-option="renderDropdownOption"+ @select="handleDropdownSelect"+ >+ <NButton :quaternary="true" size="medium" style="--n-padding: 0 4px">+ <EllipsisVerticalIcon class="w-5 h-5" />+ </NButton>+ </NDropdown>+ </div>+</template>++<script setup lang="ts">+import { EllipsisVerticalIcon } from "lucide-vue-next";+import { NButton, NDropdown, type DropdownOption } from "naive-ui";+import { computed, h } from "vue";+import type { VNode } from "vue";+import { useI18n } from "vue-i18n";+import { DropdownItemWithErrorList } from "@/components/IssueV1/components/common";+import UnifiedActionButton from "./UnifiedActionButton.vue";+import type { ActionConfig, UnifiedAction } from "./types";++const props = defineProps<{+ primaryAction?: ActionConfig;+ secondaryActions: ActionConfig[];+}>();++const emit = defineEmits<{+ (event: "perform-action", action: UnifiedAction): void;+}>();++const { t } = useI18n();++const actionDisplayName = (action: UnifiedAction): string => {+ switch (action) {+ case "APPROVE":+ return t("common.approve");+ case "REJECT":+ return t("custom-approval.issue-review.send-back");+ case "RE_REQUEST":+ return t("custom-approval.issue-review.re-request-review");+ case "CLOSE":+ return t("issue.batch-transition.close");+ case "REOPEN":+ return t("issue.batch-transition.reopen");+ }+};++// Removed unused interface - using inline types instead++const dropdownOptions = computed(() => {+ return props.secondaryActions.map((config) => ({+ key: config.action,+ label: actionDisplayName(config.action),+ action: config.action,+ disabled: config.disabled,+ description: config.description,+ }));+});++const renderDropdownOption = ({+ node,+ option,+}: {+ node: VNode;+ option: DropdownOption;+}) => {+ const actionOption = props.secondaryActions.find(+ (config) => config.action === (option as any).key+ );+ const disabled = actionOption?.disabled;+ const description = actionOption?.description;+ const errors = disabled+ ? [+ description ||+ t("issue.error.you-are-not-allowed-to-perform-this-action"),+ ]+ : [];+ return h(+ DropdownItemWithErrorList,+ {+ errors,+ placement: "left",+ },+ {+ default: () => node,+ }+ );+};++const handleAction = (action: UnifiedAction) => {+ emit("perform-action", action);+};++const handleDropdownSelect = (key: string) => {+ const option = dropdownOptions.value.find((opt) => opt.key === key);+ if (option && !option.disabled) {+ handleAction(option.action);+ }+};+</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.tsnew file mode 100644index 0000000000..1096337f66--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/index.ts@@ -0,0 +1,3 @@+export { default as UnifiedActionButton } from "./UnifiedActionButton.vue";+export { default as UnifiedActionGroup } from "./UnifiedActionGroup.vue";+export * from "./types";diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.tsnew file mode 100644index 0000000000..a68c93616b--- /dev/null+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts@@ -0,0 +1,11 @@+export type IssueReviewAction = "APPROVE" | "REJECT" | "RE_REQUEST";++export type IssueStatusAction = "CLOSE" | "REOPEN";++export type UnifiedAction = IssueReviewAction | IssueStatusAction;++export interface ActionConfig {+ action: UnifiedAction;+ disabled?: boolean;+ description?: string;+}diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex ab3211aff4..8b7d27ef1c 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -2,11 +2,19 @@ import type Emittery from "emittery";import { v4 as uuidv4 } from "uuid";import type { InjectionKey, Ref } from "vue";import { inject, provide } from "vue";-import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";import type { Issue } from "@/types/proto/v1/issue_service";+import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";+import type {+ IssueReviewAction,+ IssueStatusAction,+} from "../components/HeaderSection/Actions/unified";export type PlanEvents = Emittery<{- "status-changed": { eager: boolean };+ "status-changed": { eager?: boolean };+ "perform-issue-review-action": {+ action: IssueReviewAction;+ };+ "perform-issue-status-action": { action: IssueStatusAction };}>;export type PlanContext = {diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.tsindex 18b0ef4de4..af4648184f 100644--- a/frontend/src/components/Plan/logic/initialize/index.ts+++ b/frontend/src/components/Plan/logic/initialize/index.ts@@ -66,8 +66,8 @@ export function useInitializePlan(issueResult = await issueServiceClient.getIssue({name: `${projectNamePrefix}${projectId}/issues/${issueUid}`,});-if (!issueResult.plan) {+ // Should not happen, but handle gracefullythrow new Error(`Issue ${issueUid} does not have an associated plan`);}diff --git a/frontend/src/components/Plan/logic/issue-review.ts b/frontend/src/components/Plan/logic/issue-review.tsnew file mode 100644index 0000000000..b63c7ad3a8--- /dev/null+++ b/frontend/src/components/Plan/logic/issue-review.ts@@ -0,0 +1,72 @@+import { head } from "lodash-es";+import type { InjectionKey, MaybeRef } from "vue";+import { computed, inject, provide, unref } from "vue";+import {+ Issue_Approver_Status,+ type Issue,+} from "@/types/proto/v1/issue_service";++export const KEY = Symbol(+ "bb.plan.issue.review.context"+) as InjectionKey<IssueReviewContext>;++export const useIssueReviewContext = () => {+ return inject(KEY)!;+};++export const provideIssueReviewContext = (+ issue: MaybeRef<Issue | undefined>+) => {+ const status = computed(() => {+ const tempIssue = unref(issue);+ if (!tempIssue) {+ return Issue_Approver_Status.PENDING;+ }+ if (!tempIssue?.approvalFindingDone) {+ return Issue_Approver_Status.PENDING;+ }+ if (tempIssue?.approvalFindingError) {+ return Issue_Approver_Status.PENDING;+ }++ const { approvalTemplates, approvers } = tempIssue;+ const steps = head(approvalTemplates)?.flow?.steps ?? [];+ // No review flow steps. That means need not manual review.+ if (steps.length === 0) {+ return Issue_Approver_Status.APPROVED;+ }+ // If any of the approvers rejected, the overall status should be 'REJECTED'+ if (+ approvers.some((app) => app.status === Issue_Approver_Status.REJECTED)+ ) {+ return Issue_Approver_Status.REJECTED;+ }++ if (+ approvers.length === steps.length &&+ approvers.every((app) => app.status === Issue_Approver_Status.APPROVED)+ ) {+ return Issue_Approver_Status.APPROVED;+ }+ return Issue_Approver_Status.PENDING;+ });++ const done = computed(() => {+ return status.value === Issue_Approver_Status.APPROVED;+ });++ const error = computed(() => {+ return unref(issue)?.approvalFindingError;+ });++ const context = {+ done,+ error,+ };++ provide(KEY, context);++ return context;+};++type IssueReviewContext = ReturnType<typeof provideIssueReviewContext>;diff --git a/frontend/src/components/Plan/logic/poll.ts b/frontend/src/components/Plan/logic/poll.tsindex c62f87ba27..ae08b71357 100644--- a/frontend/src/components/Plan/logic/poll.ts+++ b/frontend/src/components/Plan/logic/poll.ts@@ -1,18 +1,22 @@-import { computed, watch } from "vue";import { create } from "@bufbuild/protobuf";+import { computed, watch } from "vue";import { useProgressivePoll } from "@/composables/useProgressivePoll";-import { planServiceClientConnect } from "@/grpcweb";-import { ListPlanCheckRunsRequestSchema } from "@/types/proto-es/v1/plan_service_pb";-import { convertNewPlanCheckRunToOld } from "@/utils/v1/plan-conversions";+import { issueServiceClient, planServiceClientConnect } from "@/grpcweb";import { useCurrentProjectV1 } from "@/store";+import { useIssueCommentStore } from "@/store";import { usePlanStore } from "@/store/modules/v1/plan";+import { ListPlanCheckRunsRequestSchema } from "@/types/proto-es/v1/plan_service_pb";+import { ListIssueCommentsRequest } from "@/types/proto/v1/issue_service";import { hasProjectPermissionV2 } from "@/utils";+import { convertNewPlanCheckRunToOld } from "@/utils/v1/plan-conversions";import { usePlanContext } from "./context";export const usePollPlan = () => {const { project } = useCurrentProjectV1();- const { isCreating, plan, planCheckRunList, events } = usePlanContext();+ const { isCreating, plan, planCheckRunList, issue, events } =+ usePlanContext();const planStore = usePlanStore();+ const issueCommentStore = useIssueCommentStore();const shouldPollPlan = computed(() => {return !isCreating.value;@@ -32,11 +36,37 @@ export const usePollPlan = () => {parent: updatedPlan.name,latestOnly: true,});- const response = await planServiceClientConnect.listPlanCheckRuns(request);- planCheckRunList.value = response.planCheckRuns.map(convertNewPlanCheckRunToOld);+ const response =+ await planServiceClientConnect.listPlanCheckRuns(request);+ planCheckRunList.value = response.planCheckRuns.map(+ convertNewPlanCheckRunToOld+ );+ }+ };++ const refreshIssue = async () => {+ if (!issue?.value || isCreating.value) return;++ const updatedIssue = await issueServiceClient.getIssue({+ name: issue.value.name,+ });++ if (issue.value !== updatedIssue) {+ issue.value = updatedIssue;}};+ const refreshIssueComments = async () => {+ if (!issue?.value) return;++ await issueCommentStore.listIssueComments(+ ListIssueCommentsRequest.fromPartial({+ parent: issue.value.name,+ pageSize: 100,+ })+ );+ };+const poller = useProgressivePoll(refreshPlan, {interval: {min: 500,@@ -46,13 +76,26 @@ export const usePollPlan = () => {},});- events.on("status-changed", ({ eager }) => {+ // Register event handlers+ events.on("status-changed", async ({ eager }) => {if (eager) {- refreshPlan();+ await Promise.all([refreshPlan(), refreshIssue()]);poller.restart();}});+ events.on("perform-issue-review-action", async () => {+ // After review action, refresh both issue and comments+ await Promise.all([refreshIssue(), refreshIssueComments()]);+ events.emit("status-changed", { eager: true });+ });++ events.on("perform-issue-status-action", async () => {+ // After status action, refresh issue+ await refreshIssue();+ events.emit("status-changed", { eager: true });+ });+watch(shouldPollPlan,() => {diff --git a/frontend/src/store/modules/v1/issue.ts b/frontend/src/store/modules/v1/issue.tsindex 16b93cc20b..c060548d6f 100644--- a/frontend/src/store/modules/v1/issue.ts+++ b/frontend/src/store/modules/v1/issue.ts@@ -4,19 +4,18 @@ import { defineStore } from "pinia";import type { WatchCallback } from "vue";import { ref, watch } from "vue";import { issueServiceClient } from "@/grpcweb";-import {- SYSTEM_BOT_EMAIL,- type ComposedIssue,- type IssueFilter,-} from "@/types";-import type { ApprovalStep } from "@/types/proto/v1/issue_service";+import { SYSTEM_BOT_EMAIL, type IssueFilter } from "@/types";+import type { ApprovalStep, Issue } from "@/types/proto/v1/issue_service";import {issueStatusToJSON,ApprovalNode_Type,} from "@/types/proto/v1/issue_service";-import { memberMapToRolesInProjectIAM } from "@/utils";+import {+ extractProjectResourceName,+ memberMapToRolesInProjectIAM,+} from "@/utils";import { useUserStore } from "../user";-import { userNamePrefix } from "./common";+import { projectNamePrefix, userNamePrefix } from "./common";import {shallowComposeIssue,type ComposeIssueConfig,@@ -126,11 +125,12 @@ export const useIssueV1Store = defineStore("issue_v1", () => {// candidatesOfApprovalStepV1 return user name list in users/{email} format.// The list could includs users/ALL_USERS_USER_EMAILexport const candidatesOfApprovalStepV1 = (- issue: ComposedIssue,+ issue: Issue,step: ApprovalStep) => {- const project = useProjectV1Store().getProjectByName(issue.project);-+ const project = useProjectV1Store().getProjectByName(+ `${projectNamePrefix}${extractProjectResourceName(issue.name)}`+ );const candidates = step.nodes.flatMap((node) => {const { type, role } = node;if (type !== ApprovalNode_Type.ANY_IN_GROUP) return [];@@ -152,7 +152,6 @@ export const candidatesOfApprovalStepV1 = (return false;}// If the project does not allow self-approval, exclude the creator.- const project = useProjectV1Store().getProjectByName(issue.project);if (!project.allowSelfApproval && user === issue.creator) {return false;}diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.tsindex 1d1cd5cdd0..286abd36aa 100644--- a/frontend/src/utils/v1/issue/rollout.ts+++ b/frontend/src/utils/v1/issue/rollout.ts@@ -182,7 +182,7 @@ export const buildIssueV1LinkWithTask = ((s) => s.tasks.findIndex((t) => t.name === task.name) >= 0);- const projectId = extractProjectResourceName(issue.project);+ const projectId = extractProjectResourceName(issue.name);const issueSlug = simple? extractIssueUID(issue.name): issueV1Slug(issue.name, issue.title);diff --git a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vueindex 2cbeb976d9..ccafb50180 100644--- a/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue+++ b/frontend/src/views/ExportCenter/DataExportIssueDataTable/DataExportIssueDataTable.vue@@ -160,7 +160,7 @@ const rowProps = (issue: ComposedIssue) => {const route = router.resolve({name: PROJECT_V1_ROUTE_ISSUE_DETAIL,params: {- projectId: extractProjectResourceName(issue.project),+ projectId: extractProjectResourceName(issue.name),issueSlug: issueV1Slug(issue.name, issue.title),},});diff --git a/frontend/src/views/project/ProjectPlanDetail.vue b/frontend/src/views/project/ProjectPlanDetail.vueindex d3a89d4bb4..2585b2a6cb 100644--- a/frontend/src/views/project/ProjectPlanDetail.vue+++ b/frontend/src/views/project/ProjectPlanDetail.vue@@ -20,6 +20,7 @@ import {useInitializePlan,} from "@/components/Plan";import PlanDetailPage from "@/components/Plan/PlanDetailPage.vue";+import { provideIssueReviewContext } from "@/components/Plan/logic/issue-review";import { useBodyLayoutContext } from "@/layouts/common";import { isValidPlanName } from "@/utils";@@ -56,6 +57,8 @@ providePlanContext(true /* root */);+provideIssueReviewContext(issue);+const { overrideMainContainerClass } = useBodyLayoutContext();overrideMainContainerClass("!py-0 !px-0");