Skip to content

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

feat: redirect to rollout page after final node approved (#17246)

boojackbb11edc5c78c
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
index 99e201bad2..1b9912b292 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue
@@ -79,6 +79,7 @@
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
+import { head } from "lodash-es";
import { NButton, NCheckbox, NInput, NTooltip } from "naive-ui";
import { computed, nextTick, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
@@ -88,14 +89,22 @@ import { ErrorList } from "@/components/IssueV1/components/common";
import { usePlanContextWithIssue } from "@/components/Plan/logic";
import RequiredStar from "@/components/RequiredStar.vue";
import { issueServiceClientConnect } from "@/grpcweb";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import {
+ PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
+} from "@/router/dashboard/projectV1";
+import { pushNotification } from "@/store";
import {
ApproveIssueRequestSchema,
RejectIssueRequestSchema,
RequestIssueRequestSchema,
} from "@/types/proto-es/v1/issue_service_pb";
import { PlanCheckRun_Status } from "@/types/proto-es/v1/plan_service_pb";
-import { extractIssueUID, extractProjectResourceName } from "@/utils";
+import {
+ extractIssueUID,
+ extractProjectResourceName,
+ extractRolloutUID,
+} from "@/utils";
import type { IssueReviewAction } from "../unified";
type LocalState = {
@@ -114,7 +123,7 @@ const router = useRouter();
const state = reactive<LocalState>({
loading: false,
});
-const { issue, planCheckRuns, events } = usePlanContextWithIssue();
+const { issue, rollout, planCheckRuns, events } = usePlanContextWithIssue();
const comment = ref("");
const performActionAnyway = ref(false);
@@ -235,7 +244,40 @@ const handleConfirm = async () => {
events.emit("perform-issue-review-action", { action });
} finally {
state.loading = false;
- // Redirect to issue comment section.
+ emit("close");
+
+ // For ISSUE_REVIEW_APPROVE, check if this is the last approval needed
+ if (action === "ISSUE_REVIEW_APPROVE") {
+ const { approvalTemplates, approvers } = issue.value;
+ const steps = head(approvalTemplates)?.flow?.steps ?? [];
+
+ // Check if this approval will complete the review process
+ const isLastApproval =
+ steps.length > 0 && approvers.length + 1 >= steps.length;
+
+ if (rollout.value && isLastApproval) {
+ // Rollout exists, redirect to rollout page
+ // Show success notification for final approval
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("issue.approval.approved-and-waiting-for-rollout"),
+ });
+
+ nextTick(() => {
+ router.push({
+ name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(issue.value.name),
+ rolloutId: extractRolloutUID(rollout.value!.name),
+ },
+ });
+ });
+ return;
+ }
+ }
+
+ // For other actions, redirect to issue page immediately
nextTick(() => {
router.push({
name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
@@ -246,7 +288,6 @@ const handleConfirm = async () => {
hash: `#issue-comment-editor`,
});
});
- emit("close");
}
};
diff --git a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
index 7b8d33318f..ef1817bc87 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/ActivitySection/ActivitySection.vue
@@ -5,76 +5,10 @@
{{ $t("common.activity") }}
</h3>
</div>
- <!-- Alert about issue approved and waiting for rollout -->
- <NAlert v-if="showApprovedAlert" type="success" :size="'small'" closable>
- <template #icon>
- <ThumbsUpIcon :size="16" />
- </template>
- <router-link
- v-if="showApprovedAlert && rolloutLink"
- :to="rolloutLink"
- class="inline-flex items-center gap-1 hover:opacity-80"
- >
- <span>{{ $t("issue.approval.approved-and-waiting-for-rollout") }}</span>
- <ExternalLinkIcon class="opacity-80" :size="16" />
- </router-link>
- </NAlert>
<IssueCommentList />
</div>
</template>
<script setup lang="ts">
-import { ThumbsUpIcon, ExternalLinkIcon } from "lucide-vue-next";
-import { NAlert } from "naive-ui";
-import { computed } from "vue";
import IssueCommentList from "@/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue";
-import { PROJECT_V1_ROUTE_ROLLOUT_DETAIL } from "@/router/dashboard/projectV1";
-import { useCurrentProjectV1 } from "@/store";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { extractProjectResourceName } from "@/utils";
-import { usePlanContext, useIssueReviewContext } from "../../../logic";
-
-const { rollout, issue } = usePlanContext();
-const { project } = useCurrentProjectV1();
-const reviewContext = useIssueReviewContext();
-
-// Show alert when issue is approved and rollout hasn't started yet
-const showApprovedAlert = computed(() => {
- if (!issue?.value || !rollout?.value) return false;
-
- // Check if issue is open
- if (issue.value.status !== IssueStatus.OPEN) return false;
-
- // Check if issue is approved
- const isApproved = reviewContext.done.value;
- if (!isApproved) return false;
-
- // Check if rollout has started
- const hasStartedTasks = rollout.value.stages.some((stage) =>
- stage.tasks.some(
- (task) =>
- task.status !== Task_Status.NOT_STARTED &&
- task.status !== Task_Status.STATUS_UNSPECIFIED
- )
- );
-
- return !hasStartedTasks;
-});
-
-// Computed property for rollout link
-const rolloutLink = computed(() => {
- if (!rollout?.value) return null;
-
- const rolloutId = rollout.value.name.split("/").pop();
- if (!rolloutId) return null;
-
- return {
- name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- rolloutId,
- },
- };
-});
</script>
diff --git a/frontend/src/components/Rollout/RolloutDataTable.vue b/frontend/src/components/Rollout/RolloutDataTable.vue
index ce3c1cdef4..004da6fe5c 100644
--- a/frontend/src/components/Rollout/RolloutDataTable.vue
+++ b/frontend/src/components/Rollout/RolloutDataTable.vue
@@ -117,6 +117,7 @@ const columnList = computed(
<EnvironmentV1Name
environment={environment}
link={false}
+ nullEnvironmentPlaceholder="Null"
/>
</div>
),