Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): close plans (#16908)
boojack3f9ba45bd148
diff --git a/backend/store/plan.go b/backend/store/plan.goindex 3b0985b152..f578013617 100644--- a/backend/store/plan.go+++ b/backend/store/plan.go@@ -42,8 +42,7 @@ type FindPlanMessage struct {Limit *intOffset *int- Filter *ListResourceFilter- ShowDeleted bool+ Filter *ListResourceFilter}// UpdatePlanMessage is the message to update a plan.@@ -146,9 +145,6 @@ func (s *Store) ListPlans(ctx context.Context, find *FindPlanMessage) ([]*PlanMeif v := find.PipelineID; v != nil {where, args = append(where, fmt.Sprintf("plan.pipeline_id = $%d", len(args)+1)), append(args, *v)}- if !find.ShowDeleted {- where = append(where, "plan.deleted = FALSE")- }query := fmt.Sprintf(`SELECTdiff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.tsindex 7a7f6b2f43..af0e1a1b9d 100644--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts+++ b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts@@ -196,6 +196,24 @@ export const useCommonSearchScopeOptions = (],allowMultiple: false,}),+ state: () => ({+ id: "state",+ title: t("common.state"),+ description: t("plan.state.description"),+ options: [+ {+ value: "ACTIVE",+ keywords: ["active", "ACTIVE"],+ render: () => t("common.active"),+ },+ {+ value: "DELETED",+ keywords: ["deleted", "DELETED"],+ render: () => t("common.deleted"),+ },+ ],+ allowMultiple: false,+ }),} as Partial<Record<SearchScopeId, () => ScopeOption>>;const scopes: ScopeOption[] = [];diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vueindex 0ac8bccdc0..6409a5cf3d 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue@@ -29,15 +29,21 @@<script setup lang="ts">import { head } from "lodash-es";+import { useDialog } from "naive-ui";import { computed, ref } from "vue";+import { useI18n } from "vue-i18n";import { usePlanContext } from "@/components/Plan/logic";import { provideIssueReviewContext } from "@/components/Plan/logic/issue-review";+import { useResourcePoller } from "@/components/Plan/logic/poller";import {useCurrentUserV1,candidatesOfApprovalStepV1,extractUserId,useCurrentProjectV1,+ pushNotification,} from "@/store";+import { usePlanStore } from "@/store/modules/v1/plan";+import { State } from "@/types/proto-es/v1/common_pb";import {IssueStatus,Issue_Approver_Status,@@ -54,12 +60,17 @@ import {type ActionConfig,type IssueReviewAction,type IssueStatusAction,+ type PlanAction,type UnifiedAction,} from "./unified";-const { isCreating, issue, rollout } = usePlanContext();+const { t } = useI18n();+const dialog = useDialog();+const resourcePoller = useResourcePoller();+const { isCreating, plan, issue, rollout } = usePlanContext();const currentUser = useCurrentUserV1();const { project } = useCurrentProjectV1();+const planStore = usePlanStore();// Provide issue review context when an issue existsconst reviewContext = provideIssueReviewContext(issue);@@ -75,18 +86,44 @@ const availableActions = computed(() => {if (isCreating.value) return actions;- // If no issue exists, show create issue action+ // If no issue exists, show create issue action or close plan action.if (!issue?.value) {// If rollout exists, no actions are available.if (rollout?.value) {return actions;}++ // Check if user can close the plan+ const canClosePlan =+ plan.value.state === State.ACTIVE &&+ plan.value.issue === "" &&+ plan.value.rollout === "" &&+ (currentUser.value.email === extractUserId(plan.value.creator || "") ||+ hasProjectPermissionV2(project.value, "bb.plans.update"));++ if (canClosePlan) {+ actions.push("PLAN_CLOSE");+ }++ // Check if user can reopen the plan+ const canReopenPlan =+ plan.value.state === State.DELETED &&+ plan.value.issue === "" &&+ plan.value.rollout === "" &&+ (currentUser.value.email === extractUserId(plan.value.creator || "") ||+ hasProjectPermissionV2(project.value, "bb.plans.update"));++ if (canReopenPlan) {+ actions.push("PLAN_REOPEN");+ return actions; // For deleted plans, only show reopen action+ }+const canCreateIssue = hasProjectPermissionV2(project.value,"bb.plans.create");- if (canCreateIssue) {- actions.push("CREATE_ISSUE");+ if (canCreateIssue && plan.value.state === State.ACTIVE) {+ actions.push("ISSUE_CREATE");}return actions;}@@ -104,7 +141,7 @@ const availableActions = computed(() => {hasProjectPermissionV2(project.value, "bb.issues.update");if (canReopen) {- actions.push("REOPEN");+ actions.push("ISSUE_STATUS_REOPEN");}return actions;}@@ -125,7 +162,7 @@ const availableActions = computed(() => {// RE_REQUEST is only available to the issue creator when rejectedif (hasRejection && currentUserEmail === issueCreator) {- actions.push("RE_REQUEST");+ actions.push("ISSUE_REVIEW_RE_REQUEST");} else {// Check if user can approve/rejectconst steps = head(approvalTemplates)?.flow?.steps ?? [];@@ -144,9 +181,9 @@ const availableActions = computed(() => {);if (isUserIncludedInList(currentUserEmail, candidates)) {if (hasRejection) {- actions.push("APPROVE");+ actions.push("ISSUE_REVIEW_APPROVE");} else {- actions.push("APPROVE", "REJECT");+ actions.push("ISSUE_REVIEW_APPROVE", "ISSUE_REVIEW_REJECT");}}}@@ -162,7 +199,7 @@ const availableActions = computed(() => {hasProjectPermissionV2(project.value, "bb.issues.update");if (canClose) {- actions.push("CLOSE");+ actions.push("ISSUE_STATUS_CLOSE");}return actions;@@ -171,22 +208,27 @@ const availableActions = computed(() => {const primaryAction = computed((): ActionConfig | undefined => {const actions = availableActions.value;- // CREATE_ISSUE is the highest priority when no issue exists- if (actions.includes("CREATE_ISSUE")) {- return { action: "CREATE_ISSUE" };+ // ISSUE_CREATE is the highest priority when no issue exists+ if (actions.includes("ISSUE_CREATE")) {+ return { action: "ISSUE_CREATE" };+ }++ // PLAN_REOPEN is primary when plan is deleted+ if (actions.includes("PLAN_REOPEN")) {+ return { action: "PLAN_REOPEN" };}- // REOPEN is primary when issue is closed- if (actions.includes("REOPEN")) {- return { action: "REOPEN" };+ // ISSUE_STATUS_REOPEN is primary when issue is closed+ if (actions.includes("ISSUE_STATUS_REOPEN")) {+ return { action: "ISSUE_STATUS_REOPEN" };}- // APPROVE and RE_REQUEST are primary actions- if (actions.includes("APPROVE")) {- return { action: "APPROVE" };+ // ISSUE_REVIEW_APPROVE and ISSUE_REVIEW_RE_REQUEST are primary actions+ if (actions.includes("ISSUE_REVIEW_APPROVE")) {+ return { action: "ISSUE_REVIEW_APPROVE" };}- if (actions.includes("RE_REQUEST")) {- return { action: "RE_REQUEST" };+ if (actions.includes("ISSUE_REVIEW_RE_REQUEST")) {+ return { action: "ISSUE_REVIEW_RE_REQUEST" };}return undefined;@@ -196,31 +238,80 @@ 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" });+ // ISSUE_REVIEW_REJECT, ISSUE_STATUS_CLOSE, and PLAN_CLOSE go in the dropdown+ if (actions.includes("ISSUE_REVIEW_REJECT")) {+ secondary.push({ action: "ISSUE_REVIEW_REJECT" });}- if (actions.includes("CLOSE")) {- secondary.push({ action: "CLOSE" });+ if (actions.includes("ISSUE_STATUS_CLOSE")) {+ secondary.push({ action: "ISSUE_STATUS_CLOSE" });+ }+ if (actions.includes("PLAN_CLOSE")) {+ secondary.push({ action: "PLAN_CLOSE" });}return secondary;});-const handlePerformAction = (action: UnifiedAction) => {+const handlePerformAction = async (action: UnifiedAction) => {switch (action) {- case "APPROVE":- case "REJECT":- case "RE_REQUEST":+ case "ISSUE_REVIEW_APPROVE":+ case "ISSUE_REVIEW_REJECT":+ case "ISSUE_REVIEW_RE_REQUEST":pendingReviewAction.value = action as IssueReviewAction;break;- case "CLOSE":- case "REOPEN":+ case "ISSUE_STATUS_CLOSE":+ case "ISSUE_STATUS_REOPEN":pendingStatusAction.value = action as IssueStatusAction;break;- case "CREATE_ISSUE":+ case "ISSUE_CREATE":pendingIssueCreationAction.value = "CREATE";break;+ case "PLAN_CLOSE":+ await handlePlanStateChange("PLAN_CLOSE");+ break;+ case "PLAN_REOPEN":+ await handlePlanStateChange("PLAN_REOPEN");+ break;}};++const handlePlanStateChange = async (action: PlanAction) => {+ if (!plan?.value) return;++ const isClosing = action === "PLAN_CLOSE";+ const title = isClosing ? t("common.close") : t("common.reopen");+ const content = isClosing+ ? t("plan.state.close-confirm")+ : t("plan.state.reopen-confirm");+ const positiveText = title;+ const newState = isClosing ? State.DELETED : State.ACTIVE;+ const errorMessage = isClosing+ ? "Failed to close plan:"+ : "Failed to reopen plan:";++ const d = dialog.warning({+ title,+ content,+ positiveText,+ negativeText: t("common.cancel"),+ onPositiveClick: async () => {+ d.loading = true;+ try {+ await planStore.updatePlan({ ...plan.value, state: newState }, [+ "state",+ ]);+ // The plan context should automatically refresh and redirect or update the UI.+ await resourcePoller.refreshAllManual();+ } catch (error) {+ console.error(errorMessage, error);+ pushNotification({+ module: "bytebase",+ style: "CRITICAL",+ title: "Failed to update plan",+ description: String(error),+ });+ }+ },+ });+};</script>diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vueindex 86203ffd67..2624d53f3a 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue@@ -20,7 +20,7 @@<div class="flex flex-col gap-y-1"><p class="font-medium text-control">{{ $t("common.comment") }}- <RequiredStar v-show="props.action === 'REJECT'" />+ <RequiredStar v-show="props.action === 'ISSUE_REVIEW_REJECT'" /></p><NInputv-model:value="comment"@@ -116,11 +116,11 @@ const performActionAnyway = ref(false);const title = computed(() => {switch (props.action) {- case "APPROVE":+ case "ISSUE_REVIEW_APPROVE":return t("custom-approval.issue-review.approve-issue");- case "REJECT":+ case "ISSUE_REVIEW_REJECT":return t("custom-approval.issue-review.send-back-issue");- case "RE_REQUEST":+ case "ISSUE_REVIEW_RE_REQUEST":return t("custom-approval.issue-review.re-request-review-issue");}return ""; // Make linter happy@@ -128,11 +128,11 @@ const title = computed(() => {const actionDisplayName = (action: IssueReviewAction): string => {switch (action) {- case "APPROVE":+ case "ISSUE_REVIEW_APPROVE":return t("common.approve");- case "REJECT":+ case "ISSUE_REVIEW_REJECT":return t("custom-approval.issue-review.send-back");- case "RE_REQUEST":+ case "ISSUE_REVIEW_RE_REQUEST":return t("custom-approval.issue-review.re-request-review");}};@@ -143,7 +143,7 @@ const showPerformActionAnyway = computed(() => {const planCheckErrors = computed(() => {const errors: string[] = [];- if (props.action === "APPROVE") {+ if (props.action === "ISSUE_REVIEW_APPROVE") {// Check plan check runs for errorsconst failedRuns = planCheckRuns.value.filter((run) => run.status === PlanCheckRun_Status.FAILED@@ -173,7 +173,7 @@ const planCheckErrors = computed(() => {const confirmErrors = computed(() => {const errors: string[] = [];- if (props.action === "REJECT" && comment.value === "") {+ if (props.action === "ISSUE_REVIEW_REJECT" && comment.value === "") {errors.push(t("custom-approval.issue-review.disallow-approve-reason.x-field-is-required",@@ -193,9 +193,9 @@ const confirmButtonProps = computed(() => {if (!props.action) return {};switch (props.action) {- case "APPROVE":+ case "ISSUE_REVIEW_APPROVE":return { type: "primary" as const };- case "REJECT":+ case "ISSUE_REVIEW_REJECT":return { type: "primary" as const };default:return {};@@ -207,19 +207,19 @@ const handleConfirm = async () => {if (!action) return;state.loading = true;try {- if (action === "APPROVE") {+ if (action === "ISSUE_REVIEW_APPROVE") {const request = create(ApproveIssueRequestSchema, {name: issue.value.name,comment: comment.value,});await issueServiceClientConnect.approveIssue(request);- } else if (action === "REJECT") {+ } else if (action === "ISSUE_REVIEW_REJECT") {const request = create(RejectIssueRequestSchema, {name: issue.value.name,comment: comment.value,});await issueServiceClientConnect.rejectIssue(request);- } else if (action === "RE_REQUEST") {+ } else if (action === "ISSUE_REVIEW_RE_REQUEST") {const request = create(RequestIssueRequestSchema, {name: issue.value.name,comment: comment.value,diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vueindex b169af98fc..4057ac0601 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueStatusActionPanel.vue@@ -90,9 +90,9 @@ const comment = ref("");const title = computed(() => {switch (props.action) {- case "CLOSE":+ case "ISSUE_STATUS_CLOSE":return t("issue.batch-transition.close");- case "REOPEN":+ case "ISSUE_STATUS_REOPEN":return t("issue.batch-transition.reopen");}return "";@@ -105,10 +105,10 @@ const handleConfirm = async () => {try {let issueStatus: IssueStatus;switch (action) {- case "CLOSE":+ case "ISSUE_STATUS_CLOSE":issueStatus = IssueStatus.CANCELED;break;- case "REOPEN":+ case "ISSUE_STATUS_REOPEN":issueStatus = IssueStatus.OPEN;break;default:diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vueindex 804af62864..d829120e4e 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionButton.vue@@ -28,32 +28,38 @@ const { t } = useI18n();const actionDisplayName = (action: UnifiedAction): string => {switch (action) {- case "APPROVE":+ case "ISSUE_REVIEW_APPROVE":return t("common.approve");- case "REJECT":+ case "ISSUE_REVIEW_REJECT":return t("custom-approval.issue-review.send-back");- case "RE_REQUEST":+ case "ISSUE_REVIEW_RE_REQUEST":return t("custom-approval.issue-review.re-request-review");- case "CLOSE":+ case "ISSUE_STATUS_CLOSE":return t("issue.batch-transition.close");- case "REOPEN":+ case "ISSUE_STATUS_REOPEN":return t("issue.batch-transition.reopen");- case "CREATE_ISSUE":+ case "ISSUE_CREATE":return t("plan.ready-for-review");+ case "PLAN_CLOSE":+ return t("common.close");+ case "PLAN_REOPEN":+ return t("common.reopen");}};const actionButtonProps = (action: UnifiedAction) => {switch (action) {- case "APPROVE":- case "CREATE_ISSUE":+ case "ISSUE_REVIEW_APPROVE":+ case "ISSUE_CREATE":return {type: "primary" as const,};- case "RE_REQUEST":- case "REOPEN":- case "REJECT":- case "CLOSE":+ case "ISSUE_REVIEW_RE_REQUEST":+ case "ISSUE_STATUS_REOPEN":+ case "ISSUE_REVIEW_REJECT":+ case "ISSUE_STATUS_CLOSE":+ case "PLAN_CLOSE":+ case "PLAN_REOPEN":return {type: "default" as const,};diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vueindex e7d6b5281a..9857e8faf1 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/UnifiedActionGroup.vue@@ -47,18 +47,22 @@ const { t } = useI18n();const actionDisplayName = (action: UnifiedAction): string => {switch (action) {- case "APPROVE":+ case "ISSUE_REVIEW_APPROVE":return t("common.approve");- case "REJECT":+ case "ISSUE_REVIEW_REJECT":return t("custom-approval.issue-review.send-back");- case "RE_REQUEST":+ case "ISSUE_REVIEW_RE_REQUEST":return t("custom-approval.issue-review.re-request-review");- case "CLOSE":+ case "ISSUE_STATUS_CLOSE":return t("issue.batch-transition.close");- case "REOPEN":+ case "ISSUE_STATUS_REOPEN":return t("issue.batch-transition.reopen");- case "CREATE_ISSUE":+ case "ISSUE_CREATE":return t("plan.ready-for-review");+ case "PLAN_CLOSE":+ return t("common.close");+ case "PLAN_REOPEN":+ return t("common.reopen");}};diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.tsindex d1a8cf9a08..1b7b67635e 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/unified/types.ts@@ -1,13 +1,19 @@-export type IssueReviewAction = "APPROVE" | "REJECT" | "RE_REQUEST";+export type IssueReviewAction =+ | "ISSUE_REVIEW_APPROVE"+ | "ISSUE_REVIEW_REJECT"+ | "ISSUE_REVIEW_RE_REQUEST";-export type IssueStatusAction = "CLOSE" | "REOPEN";+export type IssueStatusAction = "ISSUE_STATUS_CLOSE" | "ISSUE_STATUS_REOPEN";-export type IssueCreationAction = "CREATE_ISSUE";--export type UnifiedAction =+export type IssueAction =| IssueReviewAction| IssueStatusAction- | IssueCreationAction;+ | "ISSUE_CREATE";++export type PlanAction = "PLAN_CLOSE" | "PLAN_REOPEN";++// All unified actions+export type UnifiedAction = IssueAction | PlanAction;export interface ActionConfig {action: UnifiedAction;diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vueindex dbbb44bd8e..2cb9801382 100644--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue@@ -23,6 +23,7 @@ import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useUserStore } from "@/store";import { getTimeForPbTimestampProtoEs, unknownUser } from "@/types";+import { State } from "@/types/proto-es/v1/common_pb";import type { Plan } from "@/types/proto-es/v1/plan_service_pb";import {extractPlanUID,@@ -59,8 +60,11 @@ const columnList = computed((): DataTableColumn<Plan>[] => {render: (plan) => {const showDraftTag =enabledNewLayout.value && plan.issue === "" && plan.rollout === "";+ const isDeleted = plan.state === State.DELETED;return (- <div class="flex items-center overflow-hidden space-x-2">+ <div+ class={`flex items-center overflow-hidden space-x-2 ${isDeleted ? "opacity-60" : ""}`}+ ><div class="whitespace-nowrap text-control opacity-60">{extractPlanUID(plan.name)}</div>@@ -78,7 +82,12 @@ const columnList = computed((): DataTableColumn<Plan>[] => {) : (<span class="opacity-60 italic">{t("common.untitled")}</span>)}- {showDraftTag && (+ {isDeleted && (+ <NTag type="warning" round size="small">+ {t("common.closed")}+ </NTag>+ )}+ {showDraftTag && !isDeleted && (<NTag round size="small">{t("common.draft")}</NTag>@@ -114,8 +123,9 @@ const columnList = computed((): DataTableColumn<Plan>[] => {});const rowProps = (plan: Plan) => {+ const isDeleted = plan.state === State.DELETED;return {- style: "cursor: pointer;",+ style: isDeleted ? "cursor: pointer; opacity: 0.7;" : "cursor: pointer;",onClick: (e: MouseEvent) => {const route = router.resolve({name: PROJECT_V1_ROUTE_PLAN_DETAIL,diff --git a/frontend/src/components/Plan/logic/base.ts b/frontend/src/components/Plan/logic/base.tsindex 0de4357e82..b24f32b558 100644--- a/frontend/src/components/Plan/logic/base.ts+++ b/frontend/src/components/Plan/logic/base.ts@@ -1,9 +1,11 @@import Emittery from "emittery";import { computed } from "vue";+import { State } from "@/types/proto-es/v1/common_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import type { PlanContext, PlanEvents } from "./context";export const useBasePlanContext = ({+ plan,issue,}: Pick<PlanContext,@@ -12,6 +14,9 @@ export const useBasePlanContext = ({const events: PlanEvents = new Emittery();const readonly = computed(() => {+ if (plan.value.state === State.DELETED) {+ return true;+ }if (issue?.value) {return issue.value.status !== IssueStatus.OPEN;}diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 51f4b971b8..eaf5cc2f54 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -170,6 +170,8 @@"download": "Download","will-lose-unsaved-data": "Will lose any unsaved data.","deleted": "Deleted",+ "active": "Active",+ "reopen": "Reopen","will-override-current-data": "Will override current data.","rollout": "Rollout","upload": "Upload",@@ -1131,6 +1133,11 @@},"refresh-indicator": {"last-refresh": "Last refresh: {time}"+ },+ "state": {+ "description": "Filter plans by their state",+ "close-confirm": "Are you sure to close this plan?",+ "reopen-confirm": "Are you sure to reopen this plan?"}},"rollout": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 629f970a51..8769ccc626 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -170,6 +170,8 @@"download": "Descargar","will-lose-unsaved-data": "Se perderán los datos no guardados.","deleted": "Eliminado",+ "active": "Activo",+ "reopen": "Reabrir","will-override-current-data": "Se sobrescribirán los datos actuales.","rollout": "Implementar","upload": "Subir",@@ -1131,6 +1133,11 @@},"refresh-indicator": {"last-refresh": "Última actualización: {time}"+ },+ "state": {+ "description": "Filtrar planes por estado",+ "close-confirm": "¿Estás seguro de que deseas cerrar este plan?",+ "reopen-confirm": "¿Estás seguro de que deseas reabrir este plan?"}},"rollout": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 06e2a2f628..47922210c5 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -170,6 +170,8 @@"download": "ダウンロード","will-lose-unsaved-data": "これにより、現在保存されていないデータはすべて失われます。","deleted": "削除されました",+ "active": "アクティブ",+ "reopen": "再開","will-override-current-data": "現在のデータは上書きされます。","rollout": "リリース","upload": "アップロード",@@ -1131,6 +1133,11 @@},"refresh-indicator": {"last-refresh": "最終更新: {time}"+ },+ "state": {+ "description": "州別にプランをフィルタリング",+ "close-confirm": "このプランを閉じてもよろしいですか?",+ "reopen-confirm": "このプランを再開してもよろしいですか?"}},"rollout": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 50e06534c5..4691a18401 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -170,6 +170,8 @@"download": "Tải xuống","will-lose-unsaved-data": "Sẽ mất dữ liệu chưa lưu.","deleted": "Đã xóa",+ "active": "Tích cực",+ "reopen": "Mở lại","will-override-current-data": "Sẽ ghi đè dữ liệu hiện tại.","rollout": "Triển khai","upload": "Tải lên",@@ -1131,6 +1133,11 @@},"refresh-indicator": {"last-refresh": "Làm mới lần cuối: {time}"+ },+ "state": {+ "description": "Lọc các kế hoạch theo trạng thái của chúng",+ "close-confirm": "Bạn có chắc chắn muốn đóng kế hoạch này không?",+ "reopen-confirm": "Bạn có chắc chắn muốn mở lại kế hoạch này không?"}},"rollout": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex b63fcf41d6..9801398494 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -170,6 +170,8 @@"download": "下载","will-lose-unsaved-data": "这会丢失当前所有未保存的数据。","deleted": "已删除",+ "active": "开启",+ "reopen": "重开","will-override-current-data": "将会覆盖当前数据。","rollout": "发布","upload": "上传",@@ -1131,6 +1133,11 @@},"refresh-indicator": {"last-refresh": "上次刷新:{time}"+ },+ "state": {+ "description": "按状态过滤",+ "close-confirm": "确定关闭该变更计划?",+ "reopen-confirm": "确定重新开启该变更计划?"}},"rollout": {diff --git a/frontend/src/store/modules/v1/plan.ts b/frontend/src/store/modules/v1/plan.tsindex bb9190fbde..50a55c1936 100644--- a/frontend/src/store/modules/v1/plan.ts+++ b/frontend/src/store/modules/v1/plan.ts@@ -6,6 +6,7 @@ import { planServiceClientConnect } from "@/grpcweb";import {SearchPlansRequestSchema,GetPlanRequestSchema,+ UpdatePlanRequestSchema,} from "@/types/proto-es/v1/plan_service_pb";import type { Plan } from "@/types/proto-es/v1/plan_service_pb";import {@@ -24,6 +25,7 @@ export interface PlanFind {hasIssue?: boolean;hasPipeline?: boolean;specType?: string;+ state?: "ACTIVE" | "DELETED";}export const buildPlanFilter = (find: PlanFind): string => {@@ -53,6 +55,9 @@ export const buildPlanFilter = (find: PlanFind): string => {if (find.specType) {filter.push(`spec_type == "${find.specType}"`);}+ if (find.state) {+ filter.push(`state == "${find.state}"`);+ }return filter.join(" && ");};@@ -64,6 +69,10 @@ export const buildPlanFindBySearchParams = (const projectScope = scopes.find((s) => s.id === "project");const createdTsRange = getTsRangeFromSearchParams(params, "created");+ const state = getValueFromSearchParams(params, "state", "" /* prefix='' */, [+ "ACTIVE",+ "DELETED",+ ]) as "ACTIVE" | "DELETED" | "";const filter: PlanFind = {...defaultFind,@@ -72,6 +81,7 @@ export const buildPlanFindBySearchParams = (createdTsAfter: createdTsRange?.[0],createdTsBefore: createdTsRange?.[1],creator: getValueFromSearchParams(params, "creator", "users/"),+ state: state || defaultFind?.state,};return filter;};@@ -109,8 +119,21 @@ export const usePlanStore = defineStore("plan", () => {return response;};+ const updatePlan = async (+ plan: Plan,+ updateMask: string[]+ ): Promise<Plan> => {+ const request = create(UpdatePlanRequestSchema, {+ plan,+ updateMask: { paths: updateMask },+ });+ const response = await planServiceClientConnect.updatePlan(request);+ return response;+ };+return {searchPlans,fetchPlanByName,+ updatePlan,};});diff --git a/frontend/src/utils/v1/advanced-search/common.ts b/frontend/src/utils/v1/advanced-search/common.tsindex 5fbf6d1655..949583f721 100644--- a/frontend/src/utils/v1/advanced-search/common.ts+++ b/frontend/src/utils/v1/advanced-search/common.ts@@ -24,6 +24,7 @@ export const AllSearchScopeIdList = ["creator","created","status",+ "state",// database related search scopes."engine","database-label",diff --git a/frontend/src/views/project/CICDLayout.vue b/frontend/src/views/project/CICDLayout.vueindex 50c64620e7..b8797ae0f8 100644--- a/frontend/src/views/project/CICDLayout.vue+++ b/frontend/src/views/project/CICDLayout.vue@@ -84,6 +84,7 @@ import {PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,} from "@/router/dashboard/projectV1";+import { State } from "@/types/proto-es/v1/common_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import {extractIssueUID,@@ -314,7 +315,10 @@ const documentTitle = computed(() => {// Banner conditionsconst showClosedBanner = computed(() => {- return issue.value && issue.value.status === IssueStatus.CANCELED;+ return (+ plan.value.state === State.DELETED ||+ (issue.value && issue.value.status === IssueStatus.CANCELED)+ );});const showSuccessBanner = computed(() => {diff --git a/frontend/src/views/project/ProjectPlanDashboard.vue b/frontend/src/views/project/ProjectPlanDashboard.vueindex 21b4ce6988..3712e883de 100644--- a/frontend/src/views/project/ProjectPlanDashboard.vue+++ b/frontend/src/views/project/ProjectPlanDashboard.vue@@ -92,7 +92,13 @@ const readonlyScopes = computed((): SearchScope[] => {const defaultSearchParams = () => {const params: SearchParams = {query: "",- scopes: [...readonlyScopes.value],+ scopes: [+ ...readonlyScopes.value,+ {+ id: "state",+ value: "ACTIVE",+ },+ ],};return params;};@@ -112,7 +118,7 @@ const planPagedTable = ref<ComponentExposed<typeof PagedTable<Plan>>>();const supportedScopes = computed(() => {// TODO(steven): support more scopes in backend and frontend: instance, database, planCheckRunStatus- const supportedScopes: SearchScopeId[] = [];+ const supportedScopes: SearchScopeId[] = ["state"];return supportedScopes;});