Skip to content

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

feat(frontend): show issue review flow generation error and retry (#5313)

Liu Ji814ff1ccd437
diff --git a/frontend/src/components/Issue/IssueHighlightPanel.vue b/frontend/src/components/Issue/IssueHighlightPanel.vue
index 3f3e3729a4..7044f42168 100644
--- a/frontend/src/components/Issue/IssueHighlightPanel.vue
+++ b/frontend/src/components/Issue/IssueHighlightPanel.vue
@@ -23,7 +23,7 @@
<div class="mt-4 flex space-x-3 md:mt-0 md:ml-4">
<IssueReviewButtonGroup v-if="showReviewButton" />
- <IssueStatusTransitionButtonGroup v-else />
+ <IssueStatusTransitionButtonGroup v-else-if="showRolloutButton" />
</div>
</div>
<div v-if="!create">
@@ -114,7 +114,7 @@ const create = logic.create;
const issue = logic.issue as Ref<Issue>;
const { allowEditNameAndDescription, updateName } = useExtraIssueLogic();
const issueReview = useIssueReviewContext();
-const { done: reviewDone } = issueReview;
+const { done: reviewDone, error: reviewError } = issueReview;
const state = reactive<LocalState>({
editing: false,
@@ -123,9 +123,14 @@ const state = reactive<LocalState>({
const showReviewButton = computed(() => {
if (create.value) return false;
+ if (reviewError.value) return false;
return !reviewDone.value;
});
+const showRolloutButton = computed(() => {
+ return reviewDone.value;
+});
+
watch(
() => issue.value,
(curIssue) => {
diff --git a/frontend/src/components/Issue/review/IssueReviewForm.vue b/frontend/src/components/Issue/review/IssueReviewForm.vue
index 5fb6985233..e9def283f7 100644
--- a/frontend/src/components/Issue/review/IssueReviewForm.vue
+++ b/frontend/src/components/Issue/review/IssueReviewForm.vue
@@ -1,5 +1,8 @@
<template>
- <div space-y-3>
+ <div class="mt-2">
+ <div class="text-sm">
+ {{ issue.name }}
+ </div>
<div class="pt-4 pb-1 flex justify-end gap-x-3">
<button class="btn-normal" @click="$emit('cancel')">
{{ $t("common.cancel") }}
@@ -12,9 +15,8 @@
</template>
<script lang="ts" setup>
-import { h, Ref } from "vue";
+import { Ref } from "vue";
-import { useOverrideSubtitle } from "@/bbkit/BBModal.vue";
import { useIssueLogic } from "../logic";
import { Issue } from "@/types";
@@ -26,16 +28,6 @@ const emit = defineEmits<{
const issueContext = useIssueLogic();
const issue = issueContext.issue as Ref<Issue>;
-useOverrideSubtitle(() => {
- return h(
- "div",
- {
- class: "mt-1 textinfolabel whitespace-pre-wrap",
- },
- issue.value.name
- );
-});
-
const handleConfirm = (e: MouseEvent) => {
const button = e.target as HTMLElement;
const { left, top, width, height } = button.getBoundingClientRect();
diff --git a/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue b/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue
index 91f6fb9e3f..e7d01e4552 100644
--- a/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue
+++ b/frontend/src/components/Issue/review/IssueReviewSidebarSection.vue
@@ -3,8 +3,10 @@
<h2 class="textlabel flex items-start col-span-1 col-start-1 pt-1">
<div class="flex items-center gap-x-1">
<span>{{ $t("issue.approval-flow.self") }}</span>
- <NTooltip v-if="false">
- <div>{{ $t("issue.approval-flow.tooltip") }}</div>
+ <NTooltip>
+ <div class="max-w-[24rem]">
+ {{ $t("issue.approval-flow.tooltip") }}
+ </div>
<template #trigger>
<heroicons-outline:question-mark-circle />
</template>
@@ -21,6 +23,23 @@
{{ $t("custom-approval.issue-review.generating-approval-flow") }}
</span>
</div>
+ <div v-else-if="error" class="flex items-center gap-x-2 mt-0.5">
+ <NTooltip>
+ <template #trigger>
+ <span class="text-error text-sm">{{ $t("common.error") }}</span>
+ </template>
+
+ <div class="max-w-[20rem]">
+ {{ error }}
+ </div>
+ </NTooltip>
+ <NButton
+ size="tiny"
+ :loading="retrying"
+ @click="retryFindingApprovalFlow"
+ >{{ $t("common.retry") }}</NButton
+ >
+ </div>
<IssueReviewPanel v-else-if="steps.length > 0" />
</div>
</template>
@@ -29,10 +48,12 @@
<div class="flex items-center gap-x-1">
<span>{{ $t("issue.approval-flow.self") }}</span>
<NTooltip>
+ <div class="max-w-[20rem]">
+ {{ $t("issue.approval-flow.tooltip") }}
+ </div>
<template #trigger>
<heroicons-outline:question-mark-circle />
</template>
- <div>{{ $t("issue.approval-flow.tooltip") }}</div>
</NTooltip>
</div>
</h2>
@@ -40,13 +61,19 @@
</template>
<script lang="ts" setup>
-import { computed } from "vue";
+import { computed, Ref, ref } from "vue";
import { useIssueReviewContext } from "@/plugins/issue/logic/review/context";
import IssueReviewPanel from "./IssueReviewPanel.vue";
+import { useReviewStore } from "@/store";
+import { useIssueLogic } from "../logic";
+import { Issue } from "@/types";
+const store = useReviewStore();
+const issueContext = useIssueLogic();
+const issue = issueContext.issue as Ref<Issue>;
const context = useIssueReviewContext();
-const { ready, flow } = context;
+const { ready, error, flow } = context;
const steps = computed(() => flow.value.template.flow?.steps ?? []);
@@ -55,7 +82,21 @@ const showApprovalFlowSection = computed(() => {
// Show a 'generating' indicator
return true;
}
+ if (error.value) {
+ // Show error and retry button
+ return true;
+ }
// Show if not skip manual review
return steps.value.length > 0;
});
+
+const retrying = ref(false);
+const retryFindingApprovalFlow = async () => {
+ retrying.value = true;
+ try {
+ await store.regenerateReview(issue.value);
+ } finally {
+ retrying.value = false;
+ }
+};
</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 17ee65ae36..a47c73e1c5 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -691,9 +691,10 @@
"full-schema": "Full schema",
"left-schema-may-change": "The schema on the left side may change before the issue is applied."
},
- "assignee-tooltip": "The one who's responsible for the rolling out.",
+ "assignee-tooltip": "Allow the assignee to roll out the issue once the approval flow has been passed.",
"approval-flow": {
- "self": "Approval flow"
+ "self": "Approval flow",
+ "tooltip": "The approvers will review and approve the issue in the order specified in the flow. The issue can only be applied after all steps in the flow have been approved. You can configure a custom approval flow for each risk."
},
"waiting-to-roll-out": "Waiting to roll out",
"waiting-for-review": "Waiting for review"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 49ba2e1de4..77511ecf95 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -81,7 +81,7 @@
"developer": "开发者",
"member": "成员"
},
- "assignee": "责任人",
+ "assignee": "发布人",
"revert": "恢复",
"apply": "应用",
"reorder": "排序",
@@ -689,9 +689,10 @@
"full-schema": "完整 schema",
"left-schema-may-change": "左边的 schema 在工单执行前可能会发生变化。"
},
- "assignee-tooltip": "该工单的发布负责人",
+ "assignee-tooltip": "发布人可以在审批流完成后进行发布。",
"approval-flow": {
- "self": "审批流"
+ "self": "审批流",
+ "tooltip": "审批人需要按审批流指定的顺序审核和审批工单。只有审批流中所有步骤都完成审批后工单才可以执行。您可以为每个风险级别自定义审批流。"
},
"waiting-to-roll-out": "等待发布",
"waiting-for-review": "等待审核"
diff --git a/frontend/src/plugins/issue/logic/review/context.ts b/frontend/src/plugins/issue/logic/review/context.ts
index 3bd2d15c7e..2961e488fb 100644
--- a/frontend/src/plugins/issue/logic/review/context.ts
+++ b/frontend/src/plugins/issue/logic/review/context.ts
@@ -13,6 +13,8 @@ export type IssueReviewContext = {
flow: Ref<ReviewFlow>;
// Whether the review flow is finished successfully.
done: Ref<boolean>;
+ // Whether the review finding has error.
+ error: Ref<string | undefined>;
};
export const KEY = Symbol(
diff --git a/frontend/src/plugins/issue/logic/review/index.ts b/frontend/src/plugins/issue/logic/review/index.ts
index ae3e315c56..5a74388bfd 100644
--- a/frontend/src/plugins/issue/logic/review/index.ts
+++ b/frontend/src/plugins/issue/logic/review/index.ts
@@ -1,4 +1,5 @@
import { computed, watch, type Ref } from "vue";
+import type Emittery from "emittery";
import type { Issue, ReviewFlow } from "@/types";
import { Review } from "@/types/proto/v1/review_service";
@@ -7,7 +8,14 @@ import { provideIssueReviewContext } from "./context";
import { ApprovalTemplate } from "@/types/proto/store/approval";
import { useProgressivePoll } from "@/composables/useProgressivePoll";
-export const provideIssueReview = (issue: Ref<Issue | undefined>) => {
+export type ReviewEvents = {
+ "issue-status-changed": boolean;
+};
+
+export const provideIssueReview = (
+ issue: Ref<Issue | undefined>,
+ events: Emittery<ReviewEvents>
+) => {
const store = useReviewStore();
const review = computed(() => {
return issue.value
@@ -29,11 +37,16 @@ export const provideIssueReview = (issue: Ref<Issue | undefined>) => {
});
const done = computed(() => {
if (!ready.value) return false;
+ if (review.value.approvalFindingError) return false;
+
const { template, approvers } = flow.value;
const steps = template.flow?.steps ?? [];
if (steps.length === 0) return true;
return approvers.length === steps.length;
});
+ const error = computed(() => {
+ return review.value.approvalFindingError;
+ });
const update = () => {
if (issue.value) {
@@ -60,12 +73,16 @@ export const provideIssueReview = (issue: Ref<Issue | undefined>) => {
immediate: true,
}
);
+ events.on("issue-status-changed", () => {
+ update();
+ });
provideIssueReviewContext({
review,
ready,
flow,
done,
+ error,
});
};
diff --git a/frontend/src/store/modules/review.ts b/frontend/src/store/modules/review.ts
index 472b855e27..a24662892c 100644
--- a/frontend/src/store/modules/review.ts
+++ b/frontend/src/store/modules/review.ts
@@ -58,10 +58,22 @@ export const useReviewStore = defineStore("review", () => {
await setReviewByIssue(issue, review);
};
+ const regenerateReview = async (issue: Issue) => {
+ const review = await reviewServiceClient.updateReview({
+ review: {
+ name: reviewName(issue),
+ approvalFindingDone: false,
+ },
+ updateMask: ["review.approval_finding_done"],
+ });
+ await setReviewByIssue(issue, review);
+ };
+
return {
getReviewByIssue,
fetchReviewByIssue,
approveReview,
+ regenerateReview,
};
});
diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vue
index 577fc61578..a5cedfd372 100644
--- a/frontend/src/views/IssueDetail.vue
+++ b/frontend/src/views/IssueDetail.vue
@@ -46,8 +46,10 @@ import {
useInitializeIssue,
provideIssueReview,
usePollIssue,
+ ReviewEvents,
} from "@/plugins/issue/logic";
import { useTitle } from "@vueuse/core";
+import Emittery from "emittery";
interface LocalState {
showFeatureModal: boolean;
@@ -80,10 +82,12 @@ const showLoading = computed(() => {
const pollIssue = usePollIssue(issueSlug, issue);
+const reviewEvents = new Emittery<ReviewEvents>();
provideIssueReview(
computed(() => {
return create.value ? undefined : (issue.value as Issue);
- })
+ }),
+ reviewEvents
);
onMounted(() => {
@@ -115,6 +119,7 @@ watch(issueSlug, async () => {
const onStatusChanged = (eager: boolean) => {
pollIssue(eager ? MINIMUM_POLL_INTERVAL : NORMAL_POLL_INTERVAL);
+ reviewEvents.emit("issue-status-changed", eager);
};
const findProject = async (): Promise<Project> => {