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: split resource poller for different routes (#16724)
boojack77da25f1cb30
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vueindex 0788ea812c..eefd8ef50a 100644--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue@@ -172,7 +172,7 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {<IssueStatusIconWithTaskSummary issue={issue} /><ahref={issueUrl(issue)}- class="flex items-center space-x-2 select-none"+ class="flex items-center space-x-2 select-none truncate"onClick={(e: MouseEvent) => {e.stopPropagation();}}diff --git a/frontend/src/components/Plan/PlanDetailPage.vue b/frontend/src/components/Plan/PlanDetailPage.vueindex d3a1011594..dcc475228c 100644--- a/frontend/src/components/Plan/PlanDetailPage.vue+++ b/frontend/src/components/Plan/PlanDetailPage.vue@@ -62,7 +62,7 @@ import { RolloutView } from "./components/RolloutView";import SpecsView from "./components/SpecsView.vue";import { useSpecsValidation } from "./components/common";import { gotoSpec } from "./components/common/utils";-import { usePlanContext, usePollPlan } from "./logic";+import { usePlanContext } from "./logic";enum TabKey {Overview = "overview",@@ -214,6 +214,4 @@ const handleTabChange = (tab: TabKey) => {});}};--usePollPlan();</script>diff --git a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue b/frontend/src/components/Plan/components/ChecksView/ChecksView.vueindex 1807fb40fe..7e39629229 100644--- a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue+++ b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue@@ -182,7 +182,7 @@ import { usePlanContext } from "../../logic/context";import DatabaseDisplay from "../common/DatabaseDisplay.vue";const { t } = useI18n();-const { planCheckRunList } = usePlanContext();+const { planCheckRuns } = usePlanContext();const isLoading = ref(false);const selectedStatus = ref<PlanCheckRun_Result_Status | undefined>(undefined);@@ -192,7 +192,7 @@ const hasFilters = computed(() => {});const filteredCheckRuns = computed(() => {- return planCheckRunList.value.filter((checkRun) => {+ return planCheckRuns.value.filter((checkRun) => {// Filter by status - check if any result matches the selected statusif (selectedStatus.value !== undefined) {const hasMatchingResult = checkRun.results.some(@@ -231,7 +231,7 @@ const statusCounts = computed(() => {error: 0,};- for (const checkRun of planCheckRunList.value) {+ for (const checkRun of planCheckRuns.value) {for (const result of checkRun.results) {switch (result.status) {case PlanCheckRun_Result_Status.SUCCESS:diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vueindex 4f6f257ddd..9a609f7fe2 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueCreationActionPanel.vue@@ -83,9 +83,9 @@ import {} from "@/store";import { emptyIssue } from "@/types";import { CreateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";+import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";import { Issue, IssueStatus, Issue_Type } from "@/types/proto/v1/issue_service";-import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";import {extractProjectResourceName,@@ -120,7 +120,7 @@ const state = reactive<LocalState>({const { project } = useCurrentProjectV1();const currentUser = useCurrentUserV1();const policyV1Store = usePolicyV1Store();-const { plan, planCheckRunList, events } = usePlanContext();+const { plan, planCheckRuns, events } = usePlanContext();const restrictIssueCreationForSqlReviewPolicy = ref(false);const title = computed(() => {@@ -134,7 +134,7 @@ const title = computed(() => {const planCheckStatus = computed((): PlanCheckRun_Result_Status => {const planCheckList = uniqBy(plan.value.specs.flatMap((spec) =>- planCheckRunListForSpec(planCheckRunList.value, spec)+ planCheckRunListForSpec(planCheckRuns.value, spec)),(checkRun) => checkRun.name);@@ -179,8 +179,11 @@ watchEffect(async () => {parentPath: "",policyType: PolicyType.RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW,});- if (workspaceLevelPolicy?.policy?.case === "restrictIssueCreationForSqlReviewPolicy" &&- workspaceLevelPolicy.policy.value.disallow) {+ if (+ workspaceLevelPolicy?.policy?.case ===+ "restrictIssueCreationForSqlReviewPolicy" &&+ workspaceLevelPolicy.policy.value.disallow+ ) {restrictIssueCreationForSqlReviewPolicy.value = true;return;}@@ -190,8 +193,11 @@ watchEffect(async () => {parentPath: project.value.name,policyType: PolicyType.RESTRICT_ISSUE_CREATION_FOR_SQL_REVIEW,});- if (projectLevelPolicy?.policy?.case === "restrictIssueCreationForSqlReviewPolicy" &&- projectLevelPolicy.policy.value.disallow) {+ if (+ projectLevelPolicy?.policy?.case ===+ "restrictIssueCreationForSqlReviewPolicy" &&+ projectLevelPolicy.policy.value.disallow+ ) {restrictIssueCreationForSqlReviewPolicy.value = true;return;}diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vueindex bc0f320c74..22a89ae129 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/panels/IssueReviewActionPanel.vue@@ -78,6 +78,7 @@</template><script setup lang="ts">+import { create } from "@bufbuild/protobuf";import { NButton, NCheckbox, NInput, NTooltip } from "naive-ui";import { computed, reactive, ref } from "vue";import { useI18n } from "vue-i18n";@@ -85,12 +86,11 @@ import CommonDrawer from "@/components/IssueV1/components/Panel/CommonDrawer.vueimport { ErrorList } from "@/components/IssueV1/components/common";import { usePlanContextWithIssue } from "@/components/Plan/logic";import RequiredStar from "@/components/RequiredStar.vue";-import { create } from "@bufbuild/protobuf";import { issueServiceClientConnect } from "@/grpcweb";-import {+import {ApproveIssueRequestSchema,RejectIssueRequestSchema,- RequestIssueRequestSchema+ RequestIssueRequestSchema,} from "@/types/proto-es/v1/issue_service_pb";import type { IssueReviewAction } from "../unified";@@ -109,7 +109,7 @@ const { t } = useI18n();const state = reactive<LocalState>({loading: false,});-const { issue, planCheckRunList, events } = usePlanContextWithIssue();+const { issue, planCheckRuns, events } = usePlanContextWithIssue();const comment = ref("");const performActionAnyway = ref(false);@@ -144,10 +144,10 @@ const planCheckErrors = computed(() => {const errors: string[] = [];if (props.action === "APPROVE") {// Check plan check runs for errors- const failedRuns = planCheckRunList.value.filter(+ const failedRuns = planCheckRuns.value.filter((run) => run.status === "FAILED");- const runningRuns = planCheckRunList.value.filter(+ const runningRuns = planCheckRuns.value.filter((run) => run.status === "RUNNING");diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vueindex bbd69a55e6..d847fe633f 100644--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue@@ -182,7 +182,7 @@ import DatabaseDisplay from "../common/DatabaseDisplay.vue";const { t } = useI18n();const currentUser = useCurrentUserV1();const { project } = useCurrentProjectV1();-const { plan, planCheckRunList } = usePlanContext();+const { plan, planCheckRuns } = usePlanContext();const { selectedSpec } = usePlanSpecContext();const isRunningChecks = ref(false);@@ -194,12 +194,11 @@ const show = computed(() => {});const checkRunsForSpec = computed(() => {- return planCheckRunListForSpec(planCheckRunList.value, selectedSpec.value);+ return planCheckRunListForSpec(planCheckRuns.value, selectedSpec.value);});const summary = computed(() => {const result = { success: 0, warning: 0, error: 0 };-for (const checkRun of checkRunsForSpec.value) {const status = getCheckRunStatus(checkRun);if (status === "ERROR") {@@ -210,7 +209,6 @@ const summary = computed(() => {result.success++;}}-return result;});diff --git a/frontend/src/components/Plan/components/RefreshIndicator.vue b/frontend/src/components/Plan/components/RefreshIndicator.vuenew file mode 100644index 0000000000..acbe868faa--- /dev/null+++ b/frontend/src/components/Plan/components/RefreshIndicator.vue@@ -0,0 +1,91 @@+<template>+ <div class="flex items-center gap-2">+ <span v-if="lastRefreshDisplay" class="text-xs text-gray-400">+ {{+ $t("plan.refresh-indicator.last-refresh", { time: lastRefreshDisplay })+ }}+ </span>+ <NButton+ size="tiny"+ quaternary+ :loading="isRefreshing"+ :disabled="isRefreshing"+ @click="handleRefresh"+ >+ <template #icon>+ <RefreshCcwIcon class="w-4 h-4" />+ </template>+ <span>{{ $t("common.refresh") }}</span>+ </NButton>+ </div>+</template>++<script setup lang="ts">+import dayjs from "dayjs";+import { RefreshCcwIcon } from "lucide-vue-next";+import { NButton } from "naive-ui";+import { computed, ref, onUnmounted } from "vue";+import { useI18n } from "vue-i18n";+import { getLastRefreshTime, useResourcePoller } from "../logic/poller";++const { t } = useI18n();+const currentTime = ref(Date.now());++const resourcePoller = useResourcePoller();++const isRefreshing = computed(() => {+ return resourcePoller.isRefreshing.value;+});++// Update current time every second to keep the display fresh+const timer = ref(+ setInterval(() => {+ currentTime.value = Date.now();+ }, 1000)+);++// Clean up timer on unmount+onUnmounted(() => {+ clearInterval(timer.value);+});++const lastRefreshTime = computed(() => {+ // Force reactivity by using currentTime (triggers every second)+ void currentTime.value;++ // Get the most recent refresh time from the active resources+ let mostRecent: number | undefined;+ const activeResources = resourcePoller.activeResources.value;++ for (const resource of activeResources) {+ const time = getLastRefreshTime(resource);+ if (time && (!mostRecent || time > mostRecent)) {+ mostRecent = time;+ }+ }++ return mostRecent;+});++const lastRefreshDisplay = computed(() => {+ if (!lastRefreshTime.value) return null;++ // Force reactivity by using currentTime (triggers every second)+ void currentTime.value;++ const now = Date.now();+ const diff = now - lastRefreshTime.value;++ if (diff < 10000) {+ return t("common.just-now");+ } else if (diff < 60000) {+ const seconds = Math.floor(diff / 1000);+ return t("common.n-seconds-ago", { count: seconds });+ }+ return dayjs(lastRefreshTime.value).format("YYYY-MM-DD HH:mm:ss");+});++const handleRefresh = async () => {+ await resourcePoller.refreshAllManual();+};+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/context.ts b/frontend/src/components/Plan/components/RolloutView/context.tsindex 3571ab646e..49e3158b08 100644--- a/frontend/src/components/Plan/components/RolloutView/context.ts+++ b/frontend/src/components/Plan/components/RolloutView/context.ts@@ -2,7 +2,6 @@ import { create } from "@bufbuild/protobuf";import { createContextValues } from "@connectrpc/connect";import type { ComputedRef, InjectionKey, Ref } from "vue";import { computed, inject, provide, ref } from "vue";-import { useProgressivePoll } from "@/composables/useProgressivePoll";import { rolloutServiceClientConnect } from "@/grpcweb";import { silentContextKey } from "@/grpcweb/context-key";import { useCurrentProjectV1 } from "@/store";@@ -12,7 +11,7 @@ import {convertNewRolloutToOld,convertOldPlanToNew,} from "@/utils/v1/rollout-conversions";-import { usePlanContextWithRollout, usePlanContext } from "../../logic";+import { usePlanContextWithRollout } from "../../logic";export type RolloutViewContext = {rollout: Ref<Rollout>;@@ -29,8 +28,7 @@ export const useRolloutViewContext = () => {};export const provideRolloutViewContext = () => {- const { plan, rollout } = usePlanContextWithRollout();- const { events } = usePlanContext();+ const { events, plan, rollout } = usePlanContextWithRollout();const { project } = useCurrentProjectV1();const rolloutPreview = ref<Rollout>(Rollout.fromPartial({}));@@ -78,20 +76,10 @@ export const provideRolloutViewContext = () => {// Initial fetchfetchRolloutPreview();- // Poll for updates- const poller = useProgressivePoll(fetchRolloutPreview, {- interval: {- min: 2000,- max: 10000,- growth: 2,- jitter: 500,- },- });- poller.start();-- events.on("status-changed", async (data) => {- // Only refresh if the event is eager or if rollout is not yet created- if (data.eager) {+ // Listen for resource refresh completion+ events.on("resource-refresh-completed", async ({ resources }) => {+ // Refresh rollout preview if rollout was refreshed+ if (resources.includes("rollout")) {await fetchRolloutPreview();}});diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vueindex 4ab02d5627..5171e4f5fc 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue@@ -221,8 +221,7 @@ type LocalState = EditState & {const { t } = useI18n();const dialog = useDialog();const { project } = useCurrentProjectV1();-const { isCreating, plan, events, planCheckRunList, rollout } =- usePlanContext();+const { isCreating, plan, events, planCheckRuns, rollout } = usePlanContext();const { selectedSpec } = usePlanSpecContext();const monacoEditorRef = ref<InstanceType<typeof MonacoEditor>>();@@ -253,7 +252,7 @@ const statementTitle = computed(() => {return language.value === "sql" ? t("common.sql") : t("common.statement");});const planCheckRunsForSelectedSpec = computed(() =>- planCheckRunListForSpec(planCheckRunList.value, selectedSpec.value)+ planCheckRunListForSpec(planCheckRuns.value, selectedSpec.value));const { markers } = useSQLAdviceMarkers(isCreating,diff --git a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.tsindex 4d09a0bad5..7157644efa 100644--- a/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts+++ b/frontend/src/components/Plan/components/StatementSection/useSQLAdviceMarkers.ts@@ -11,7 +11,7 @@ import { extractPlanCheckRunUID } from "@/utils";export const useSQLAdviceMarkers = (isCreating: Ref<boolean>,- planCheckRunList?: Ref<PlanCheckRun[]>,+ planCheckRuns?: Ref<PlanCheckRun[]>,advices?: Ref<Advice[] | undefined>) => {const markers = computed(() => {@@ -33,14 +33,14 @@ export const useSQLAdviceMarkers = (};});} else {- if (!planCheckRunList) return [];- if (!planCheckRunList.value) return [];+ if (!planCheckRuns) return [];+ if (!planCheckRuns.value) return [];const types: PlanCheckRun_Type[] = [PlanCheckRun_Type.DATABASE_STATEMENT_ADVISE,];return types.flatMap((type) => {return getLatestAdviceOptions(- planCheckRunList.value.filter((checkRun) => checkRun.type === type)+ planCheckRuns.value.filter((checkRun) => checkRun.type === type));});}@@ -48,8 +48,8 @@ export const useSQLAdviceMarkers = (return { markers };};-const getLatestAdviceOptions = (planCheckRunList: PlanCheckRun[]) => {- const latest = maxBy(planCheckRunList, (checkRun) =>+const getLatestAdviceOptions = (planCheckRuns: PlanCheckRun[]) => {+ const latest = maxBy(planCheckRuns, (checkRun) =>parseInt(extractPlanCheckRunUID(checkRun.name), 10));if (!latest) {diff --git a/frontend/src/components/Plan/components/common/utils.ts b/frontend/src/components/Plan/components/common/utils.tsindex 260d33404e..add15bb651 100644--- a/frontend/src/components/Plan/components/common/utils.ts+++ b/frontend/src/components/Plan/components/common/utils.ts@@ -2,12 +2,20 @@ import { type Router } from "vue-router";import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";export const gotoSpec = (router: Router, specId: string) => {+ // Defensive check for router and currentRoute+ if (!router || !router.currentRoute?.value) {+ console.error("Router or currentRoute is not available in gotoSpec");+ return;+ }++ const currentRoute = router.currentRoute.value;+router.push({name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,params: {- ...router.currentRoute.value.params,+ ...(currentRoute.params || {}),specId,},- query: router.currentRoute.value.query,+ query: currentRoute.query || {},});};diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsindex 4555ba387f..c338ef1820 100644--- a/frontend/src/components/Plan/logic/context.ts+++ b/frontend/src/components/Plan/logic/context.ts@@ -16,13 +16,17 @@ export type PlanEvents = Emittery<{action: IssueReviewAction;};"perform-issue-status-action": { action: IssueStatusAction };+ "resource-refresh-completed": {+ resources: string[];+ isManual: boolean;+ };}>;export type PlanContext = {// Basic fieldsisCreating: Ref<boolean>;plan: Ref<Plan>;- planCheckRunList: Ref<PlanCheckRun[]>;+ planCheckRuns: Ref<PlanCheckRun[]>;issue?: Ref<Issue | undefined>;rollout?: Ref<Rollout | undefined>;@@ -33,7 +37,13 @@ export type PlanContext = {const KEY = Symbol(`bb.plan.context.${uuidv4()}`) as InjectionKey<PlanContext>;export const usePlanContext = () => {- return inject(KEY)!;+ const context = inject(KEY);+ if (!context) {+ throw new Error(+ "usePlanContext must be called within a component that provides PlanContext"+ );+ }+ return context;};export const usePlanContextWithIssue = () => {diff --git a/frontend/src/components/Plan/logic/index.ts b/frontend/src/components/Plan/logic/index.tsindex 23d8a683ce..ab4b5b8ad2 100644--- a/frontend/src/components/Plan/logic/index.ts+++ b/frontend/src/components/Plan/logic/index.ts@@ -4,7 +4,6 @@ export * from "./plan";export * from "./initialize";export * from "./sheet";export * from "./plan-check";-export * from "./poll";export * from "./utils";export * from "./sidebar";export * from "./issue-review";diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.tsindex 4ad33b0b7d..ae05055160 100644--- a/frontend/src/components/Plan/logic/initialize/index.ts+++ b/frontend/src/components/Plan/logic/initialize/index.ts@@ -61,10 +61,10 @@ export function useInitializePlan(const route = useRoute();const router = useRouter();const planStore = usePlanStore();- const isInitializing = ref(false);+ const isInitializing = ref(true);const plan = ref<Plan>(emptyPlan());- const planCheckRunList = ref<PlanCheckRun[]>([]);+ const planCheckRuns = ref<PlanCheckRun[]>([]);const issue = ref<Issue | undefined>(undefined);const rollout = ref<Rollout | undefined>(undefined);@@ -192,7 +192,7 @@ export function useInitializePlan({ immediate: true });- return { isCreating, plan, planCheckRunList, issue, rollout, isInitializing };+ return { isCreating, plan, planCheckRuns, issue, rollout, isInitializing };}export const convertRouterQuery = (query: LocationQuery) => {diff --git a/frontend/src/components/Plan/logic/poll.ts b/frontend/src/components/Plan/logic/poll.tsdeleted file mode 100644index e8f082422f..0000000000--- a/frontend/src/components/Plan/logic/poll.ts+++ /dev/null@@ -1,154 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { computed, watch } from "vue";-import { useProgressivePoll } from "@/composables/useProgressivePoll";-import {- issueServiceClientConnect,- planServiceClientConnect,- rolloutServiceClientConnect,-} from "@/grpcweb";-import { useCurrentProjectV1 } from "@/store";-import { useIssueCommentStore } from "@/store";-import { usePlanStore } from "@/store/modules/v1/plan";-import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";-import { ListPlanCheckRunsRequestSchema } from "@/types/proto-es/v1/plan_service_pb";-import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import { ListIssueCommentsRequest } from "@/types/proto/v1/issue_service";-import { hasProjectPermissionV2 } from "@/utils";-import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";-import { convertNewPlanCheckRunToOld } from "@/utils/v1/plan-conversions";-import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";-import { usePlanContext } from "./context";--export const usePollPlan = () => {- const { project } = useCurrentProjectV1();- const { isCreating, plan, planCheckRunList, issue, rollout, events } =- usePlanContext();- const planStore = usePlanStore();- const issueCommentStore = useIssueCommentStore();-- const shouldPollPlan = computed(() => {- return !isCreating.value;- });-- const refreshPlan = async () => {- if (!shouldPollPlan.value) return;-- const updatedPlan = await planStore.fetchPlanByName(plan.value.name);- plan.value = updatedPlan;-- if (- !isCreating.value &&- hasProjectPermissionV2(project.value, "bb.planCheckRuns.list")- ) {- const request = create(ListPlanCheckRunsRequestSchema, {- parent: updatedPlan.name,- latestOnly: true,- });- const response =- await planServiceClientConnect.listPlanCheckRuns(request);- planCheckRunList.value = response.planCheckRuns.map(- convertNewPlanCheckRunToOld- );- }-- // Refresh rollout if it exists- if (- updatedPlan.rollout &&- rollout &&- hasProjectPermissionV2(project.value, "bb.rollouts.get")- ) {- try {- const rolloutRequest = create(GetRolloutRequestSchema, {- name: updatedPlan.rollout,- });- const newRollout =- await rolloutServiceClientConnect.getRollout(rolloutRequest);- rollout.value = convertNewRolloutToOld(newRollout);- } catch {- // Rollout might not exist or we don't have permission- }- }- };-- const refreshIssue = async () => {- if (!issue?.value || isCreating.value) return;-- const request = create(GetIssueRequestSchema, {- name: issue.value.name,- });- const newIssue = await issueServiceClientConnect.getIssue(request);- const updatedIssue = convertNewIssueToOld(newIssue);-- 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,- })- );- };-- // TODO: split this into a atomic resource poller.- const poller = useProgressivePoll(- () => {- return Promise.all([- refreshPlan(),- refreshIssue(),- refreshIssueComments(),- ]);- },- {- interval: {- min: 500,- max: 10000,- growth: 2,- jitter: 500,- },- }- );-- // Register event handlers- events.on("status-changed", async ({ eager }) => {- if (eager) {- await Promise.all([- refreshPlan(),- refreshIssue(),- refreshIssueComments(),- ]);- 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,- () => {- if (shouldPollPlan.value) {- poller.start();- } else {- poller.stop();- }- },- {- immediate: true,- }- );-};diff --git a/frontend/src/components/Plan/logic/poller/index.ts b/frontend/src/components/Plan/logic/poller/index.tsnew file mode 100644index 0000000000..3699c194c2--- /dev/null+++ b/frontend/src/components/Plan/logic/poller/index.ts@@ -0,0 +1,2 @@+export { getLastRefreshTime } from "./utils";+export { type ResourceType, useResourcePoller } from "./poller";diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.tsnew file mode 100644index 0000000000..243b57c329--- /dev/null+++ b/frontend/src/components/Plan/logic/poller/poller.ts@@ -0,0 +1,393 @@+import { includes } from "lodash-es";+import { computed, ref, watch, watchEffect } from "vue";+import { useRoute } from "vue-router";+import { useProgressivePoll } from "@/composables/useProgressivePoll";+import {+ PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,+ PROJECT_V1_ROUTE_PLAN_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL,+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,+} from "@/router/dashboard/projectV1";+import { useCurrentProjectV1 } from "@/store";+import { usePlanContext } from "../context";+import {+ refreshPlan,+ refreshPlanCheckRuns,+ refreshRollout,+ refreshIssue,+ refreshIssueComments,+} from "./utils";++export type ResourceType =+ | "plan"+ | "planCheckRuns"+ | "issue"+ | "issueComments"+ | "rollout";++export interface ResourcePollerOptions {+ resources?: ResourceType[];+}++// Progressive polling configuration:+// - min: 2s - Initial polling interval+// - max: 60s - Maximum polling interval after progressive growth+// - growth: 1.5x - Each interval is 1.5x the previous (2s → 3s → 4.5s → 6.75s → ...)+// - jitter: ±3s - Random variation to prevent thundering herd+const POLLER_INTERVAL = { min: 2000, max: 60000, growth: 1.5, jitter: 3000 };++export const useResourcePoller = (options: ResourcePollerOptions = {}) => {+ const { resources } = options;+ const route = useRoute();+ const { project } = useCurrentProjectV1();+ const { isCreating, plan, planCheckRuns, issue, rollout, events } =+ usePlanContext();++ // Track refreshing state+ const isRefreshing = ref(false);++ const resourcesToPolled = computed<ResourceType[]>(() => {+ // If specific resources are provided, use them directly+ if (resources && resources.length > 0) {+ return resources;+ }++ const routeName = route.name as string;++ // Plan-specific pages+ if (+ includes(+ [+ PROJECT_V1_ROUTE_PLAN_DETAIL,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,+ PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,+ ],+ routeName+ )+ ) {+ return ["plan"];+ }++ if (includes([PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS], routeName)) {+ return ["planCheckRuns"];+ }++ // Issue-specific pages+ if (includes([PROJECT_V1_ROUTE_ISSUE_DETAIL_V1], routeName)) {+ return ["issue", "issueComments"];+ }++ // Rollout-specific pages+ if (+ includes(+ [+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL,+ PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,+ ],+ routeName+ )+ ) {+ return ["issue", "rollout"];+ }++ // Default to polling all resources+ return ["plan", "issue", "issueComments", "rollout"];+ });++ // Create refresh functions for each resource+ const refreshPlanOnly = async () => {+ if (!plan.value) return;+ await refreshPlan(plan);+ };++ const refreshPlanCheckRunsOnly = async () => {+ if (!plan.value || !planCheckRuns) return;+ await refreshPlanCheckRuns(plan.value, project.value, planCheckRuns);+ };++ const refreshIssueOnly = async () => {+ if (!issue?.value) return;+ await refreshIssue(issue as any);+ };++ const refreshIssueCommentsOnly = async () => {+ if (!issue?.value) return;+ await refreshIssueComments(issue.value);+ };++ const refreshRolloutOnly = async () => {+ if (!plan.value?.rollout || !rollout) return;+ await refreshRollout(plan.value.rollout, project.value, rollout);+ };++ // Track which resource is being refreshed for the event+ const resourceBeingRefreshed = ref<ResourceType | null>(null);++ // Wrap refresh functions to manage isRefreshing state for auto polling+ const wrapWithRefreshingState = (+ refreshFn: () => Promise<void>,+ resource: ResourceType+ ) => {+ return async () => {+ isRefreshing.value = true;+ resourceBeingRefreshed.value = resource;+ try {+ await refreshFn();+ // Emit event after successful refresh+ events.emit("resource-refresh-completed", {+ resources: [resource],+ isManual: false,+ });+ } finally {+ isRefreshing.value = false;+ resourceBeingRefreshed.value = null;+ }+ };+ };++ // Create pollers for each resource with more reasonable intervals+ const planPoller = useProgressivePoll(+ wrapWithRefreshingState(refreshPlanOnly, "plan"),+ {+ interval: POLLER_INTERVAL,+ }+ );++ const planCheckRunsPoller = useProgressivePoll(+ wrapWithRefreshingState(refreshPlanCheckRunsOnly, "planCheckRuns"),+ {+ interval: POLLER_INTERVAL,+ }+ );++ const issuePoller = useProgressivePoll(+ wrapWithRefreshingState(refreshIssueOnly, "issue"),+ {+ interval: POLLER_INTERVAL,+ }+ );++ const issueCommentsPoller = useProgressivePoll(+ wrapWithRefreshingState(refreshIssueCommentsOnly, "issueComments"),+ {+ interval: POLLER_INTERVAL,+ }+ );++ const rolloutPoller = useProgressivePoll(+ wrapWithRefreshingState(refreshRolloutOnly, "rollout"),+ {+ interval: POLLER_INTERVAL,+ }+ );++ // Function to restart all active pollers (resets progressive intervals)+ const restartActivePollers = () => {+ const activeResources = resourcesToPolled.value;+ const shouldPoll = !isCreating.value;++ if (!shouldPoll) return;++ // Stop all pollers first+ planPoller.stop();+ planCheckRunsPoller.stop();+ issuePoller.stop();+ issueCommentsPoller.stop();+ rolloutPoller.stop();++ // Reset poller states+ pollerStates.plan = false;+ pollerStates.planCheckRuns = false;+ pollerStates.issue = false;+ pollerStates.issueComments = false;+ pollerStates.rollout = false;++ // Restart active ones (this will reset the progressive intervals)+ if (activeResources.includes("plan")) {+ planPoller.start();+ pollerStates.plan = true;+ }+ if (activeResources.includes("planCheckRuns")) {+ planCheckRunsPoller.start();+ pollerStates.planCheckRuns = true;+ }+ if (activeResources.includes("issue")) {+ issuePoller.start();+ pollerStates.issue = true;+ }+ if (activeResources.includes("issueComments")) {+ issueCommentsPoller.start();+ pollerStates.issueComments = true;+ }+ if (activeResources.includes("rollout")) {+ rolloutPoller.start();+ pollerStates.rollout = true;+ }++ // Do immediate refresh for the new route+ setTimeout(() => refreshAll(), 100);+ };++ // Watch for route changes and restart pollers to ensure fresh data+ watch(+ () => route.name,+ (newRouteName, oldRouteName) => {+ if (newRouteName !== oldRouteName && newRouteName) {+ restartActivePollers();+ }+ }+ );++ // Set up event listeners+ events.on("status-changed", async ({ eager }) => {+ if (eager) {+ await refreshAll();+ }+ });++ events.on("perform-issue-review-action", async () => {+ await Promise.all([refreshIssueOnly(), refreshIssueCommentsOnly()]);+ events.emit("status-changed", { eager: true });+ });++ events.on("perform-issue-status-action", async () => {+ await refreshIssueOnly();+ events.emit("status-changed", { eager: true });+ });++ const refreshAll = async (isManual = false) => {+ const activeResources = resourcesToPolled.value;+ const refreshPromises = [];++ if (activeResources.includes("plan"))+ refreshPromises.push(refreshPlanOnly());+ if (activeResources.includes("planCheckRuns"))+ refreshPromises.push(refreshPlanCheckRunsOnly());+ if (activeResources.includes("issue"))+ refreshPromises.push(refreshIssueOnly());+ if (activeResources.includes("issueComments"))+ refreshPromises.push(refreshIssueCommentsOnly());+ if (activeResources.includes("rollout"))+ refreshPromises.push(refreshRolloutOnly());++ isRefreshing.value = true;+ try {+ await Promise.all(refreshPromises);+ // Emit event after successful refresh+ events.emit("resource-refresh-completed", {+ resources: activeResources,+ isManual,+ });+ } finally {+ isRefreshing.value = false;+ }+ };++ const refreshAllManual = async () => {+ if (isRefreshing.value) return;++ await refreshAll(true);+ };++ // Track if we've done initial refresh to avoid duplicate calls+ let hasInitialRefresh = false;+ // Track which pollers are currently running to avoid unnecessary restarts+ const pollerStates = {+ plan: false,+ planCheckRuns: false,+ issue: false,+ issueComments: false,+ rollout: false,+ };++ // Watch for resource changes and start/stop pollers accordingly+ watchEffect(() => {+ const activeResources = resourcesToPolled.value;+ const shouldPoll = !isCreating.value;++ if (shouldPoll) {+ if (activeResources.includes("plan") && !pollerStates.plan) {+ planPoller.start();+ pollerStates.plan = true;+ } else if (!activeResources.includes("plan") && pollerStates.plan) {+ planPoller.stop();+ pollerStates.plan = false;+ }++ if (+ activeResources.includes("planCheckRuns") &&+ !pollerStates.planCheckRuns+ ) {+ planCheckRunsPoller.start();+ pollerStates.planCheckRuns = true;+ } else if (+ !activeResources.includes("planCheckRuns") &&+ pollerStates.planCheckRuns+ ) {+ planCheckRunsPoller.stop();+ pollerStates.planCheckRuns = false;+ }++ if (activeResources.includes("issue") && !pollerStates.issue) {+ issuePoller.start();+ pollerStates.issue = true;+ } else if (!activeResources.includes("issue") && pollerStates.issue) {+ issuePoller.stop();+ pollerStates.issue = false;+ }++ if (+ activeResources.includes("issueComments") &&+ !pollerStates.issueComments+ ) {+ issueCommentsPoller.start();+ pollerStates.issueComments = true;+ } else if (+ !activeResources.includes("issueComments") &&+ pollerStates.issueComments+ ) {+ issueCommentsPoller.stop();+ pollerStates.issueComments = false;+ }++ if (activeResources.includes("rollout") && !pollerStates.rollout) {+ rolloutPoller.start();+ pollerStates.rollout = true;+ } else if (!activeResources.includes("rollout") && pollerStates.rollout) {+ rolloutPoller.stop();+ pollerStates.rollout = false;+ }++ // Do initial refresh only once when polling starts+ if (!hasInitialRefresh && activeResources.length > 0) {+ hasInitialRefresh = true;+ // Small delay to avoid race conditions with component initialization+ setTimeout(() => refreshAll(), 100);+ }+ } else {+ // Stop all pollers when creating+ planPoller.stop();+ planCheckRunsPoller.stop();+ issuePoller.stop();+ issueCommentsPoller.stop();+ rolloutPoller.stop();+ // Reset poller states+ pollerStates.plan = false;+ pollerStates.planCheckRuns = false;+ pollerStates.issue = false;+ pollerStates.issueComments = false;+ pollerStates.rollout = false;+ }+ });++ return {+ refreshAll,+ refreshAllManual,+ restartActivePollers,+ isRefreshing,+ activeResources: resourcesToPolled,+ };+};diff --git a/frontend/src/components/Plan/logic/poller/utils.ts b/frontend/src/components/Plan/logic/poller/utils.tsnew file mode 100644index 0000000000..41685c7c42--- /dev/null+++ b/frontend/src/components/Plan/logic/poller/utils.ts@@ -0,0 +1,128 @@+import { create } from "@bufbuild/protobuf";+import { reactive, type Ref } from "vue";+import {+ issueServiceClientConnect,+ planServiceClientConnect,+ rolloutServiceClientConnect,+} from "@/grpcweb";+import { useIssueCommentStore } from "@/store";+import type { ComposedProject } from "@/types";+import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";+import {+ GetPlanRequestSchema,+ ListPlanCheckRunsRequestSchema,+} from "@/types/proto-es/v1/plan_service_pb";+import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";+import { ListIssueCommentsRequest } from "@/types/proto/v1/issue_service";+import type { Issue } from "@/types/proto/v1/issue_service";+import type { Plan, PlanCheckRun } from "@/types/proto/v1/plan_service";+import type { Rollout } from "@/types/proto/v1/rollout_service";+import { hasProjectPermissionV2 } from "@/utils";+import { convertNewIssueToOld } from "@/utils/v1/issue-conversions";+import {+ convertNewPlanCheckRunToOld,+ convertNewPlanToOld,+} from "@/utils/v1/plan-conversions";+import { convertNewRolloutToOld } from "@/utils/v1/rollout-conversions";++interface RefreshTimestamps {+ plan?: number;+ planCheckRuns?: number;+ rollout?: number;+ issue?: number;+ issueComments?: number;+}++const lastRefreshTime = reactive<RefreshTimestamps>({});++export const getLastRefreshTime = (+ resource: keyof RefreshTimestamps+): number | undefined => {+ return lastRefreshTime[resource];+};++export const refreshPlan = async (plan: Ref<Plan>): Promise<void> => {+ const request = create(GetPlanRequestSchema, {+ name: plan.value.name,+ });+ const response = await planServiceClientConnect.getPlan(request);+ plan.value = convertNewPlanToOld(response);+ lastRefreshTime.plan = Date.now();+ console.debug(+ "Plan refreshed at:",+ new Date(lastRefreshTime.plan).toISOString()+ );+};++export const refreshPlanCheckRuns = async (+ plan: Plan,+ project: ComposedProject,+ planCheckRuns: Ref<PlanCheckRun[]>+): Promise<void> => {+ if (!hasProjectPermissionV2(project, "bb.planCheckRuns.list")) {+ return;+ }++ const request = create(ListPlanCheckRunsRequestSchema, {+ parent: plan.name,+ latestOnly: true,+ });+ const response = await planServiceClientConnect.listPlanCheckRuns(request);+ planCheckRuns.value = response.planCheckRuns.map(convertNewPlanCheckRunToOld);+ lastRefreshTime.planCheckRuns = Date.now();+ console.debug(+ "Plan check runs refreshed at:",+ new Date(lastRefreshTime.planCheckRuns).toISOString()+ );+};++export const refreshRollout = async (+ rolloutName: string,+ project: ComposedProject,+ rollout: Ref<Rollout | undefined>+): Promise<void> => {+ if (!hasProjectPermissionV2(project, "bb.rollouts.get")) {+ return;+ }++ const rolloutRequest = create(GetRolloutRequestSchema, {+ name: rolloutName,+ });+ const newRollout =+ await rolloutServiceClientConnect.getRollout(rolloutRequest);+ rollout.value = convertNewRolloutToOld(newRollout);+ lastRefreshTime.rollout = Date.now();+ console.debug(+ "Rollout refreshed at:",+ new Date(lastRefreshTime.rollout).toISOString()+ );+};++export const refreshIssue = async (issue: Ref<Issue>): Promise<void> => {+ const request = create(GetIssueRequestSchema, {+ name: issue.value.name,+ });+ const newIssue = await issueServiceClientConnect.getIssue(request);+ const updatedIssue = convertNewIssueToOld(newIssue);+ issue.value = updatedIssue;+ lastRefreshTime.issue = Date.now();+ console.debug(+ "Issue refreshed at:",+ new Date(lastRefreshTime.issue).toISOString()+ );+};++export const refreshIssueComments = async (issue: Issue): Promise<void> => {+ const issueCommentStore = useIssueCommentStore();+ await issueCommentStore.listIssueComments(+ ListIssueCommentsRequest.fromPartial({+ parent: issue.name,+ pageSize: 100,+ })+ );+ lastRefreshTime.issueComments = Date.now();+ console.debug(+ "Issue comments refreshed at:",+ new Date(lastRefreshTime.issueComments).toISOString()+ );+};diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vueindex 12072b1399..60e859b8d3 100644--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue@@ -53,7 +53,7 @@ import { extractPlanCheckRunUID } from "@/utils";import { planCheckRunResultStatus } from "./common";const props = defineProps<{- planCheckRunList: PlanCheckRun[];+ planCheckRuns: PlanCheckRun[];type: PlanCheckRun_Type;clickable?: boolean;selected?: boolean;@@ -67,7 +67,7 @@ const { t } = useI18n();const latestPlanCheckRun = computed(() => {// Get the latest PlanCheckRun by UID.- return maxBy(props.planCheckRunList, (check) =>+ return maxBy(props.planCheckRuns, (check) =>Number(extractPlanCheckRunUID(check.name)))!;});diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vueindex 91891f3f86..0ed8d5130a 100644--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadgeBar.vue@@ -6,7 +6,7 @@:type="group.type":clickable="true":selected="group.type === selectedType"- :plan-check-run-list="group.list"+ :planCheckRuns="group.list"@click="$emit('select-type', group.type)"/></div>diff --git a/frontend/src/components/PlanCheckRun/common.ts b/frontend/src/components/PlanCheckRun/common.tsindex 8eaa6cfada..e12fb4abad 100644--- a/frontend/src/components/PlanCheckRun/common.ts+++ b/frontend/src/components/PlanCheckRun/common.ts@@ -33,7 +33,7 @@ export type PlanCheckRunSummary = {};export const planCheckRunSummaryForCheckRunList = (- planCheckRunList: PlanCheckRun[]+ planCheckRuns: PlanCheckRun[]) => {const summary: PlanCheckRunSummary = {runningCount: 0,@@ -42,11 +42,11 @@ export const planCheckRunSummaryForCheckRunList = (errorCount: 0,};- planCheckRunList = planCheckRunList.filter(+ planCheckRuns = planCheckRuns.filter((check) => !HiddenPlanCheckTypes.has(check.type));- const listGroupByTypeTargetSheet = planCheckRunList.reduce(+ const listGroupByTypeTargetSheet = planCheckRuns.reduce((acc, checkRun) => {const key = `${checkRun.type}-${checkRun.target}-${checkRun.sheet}`;if (!acc[key]) {diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 1a19efe210..74a7ddd1f5 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -129,6 +129,8 @@"delete": "Delete","history": "History","loading": "Loading",+ "just-now": "just now",+ "n-seconds-ago": "{count} seconds ago","copy": "Copy","copied": "Copied","click-to-copy": "Click to copy",@@ -1106,6 +1108,9 @@},"checks": {"self": "Checks"+ },+ "refresh-indicator": {+ "last-refresh": "Last refresh: {time}"}},"rollout": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 66cf84b056..d7324f1586 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -129,6 +129,8 @@"delete": "Eliminar","history": "Historial","loading": "Cargando",+ "just-now": "En este momento",+ "n-seconds-ago": "Hace {count} segundos","copy": "Copiar","copied": "Copiado","click-to-copy": "Haga clic para copiar",@@ -1106,6 +1108,9 @@},"checks": {"self": "Cheques"+ },+ "refresh-indicator": {+ "last-refresh": "Última actualización: {time}"}},"rollout": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex daac6b5bab..c231e97128 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -129,6 +129,8 @@"delete": "消去","history": "履歴","loading": "読み込み中",+ "just-now": "ちょうど今",+ "n-seconds-ago": "{count} 秒前","copy": "コピー","copied": "コピーされました","click-to-copy": "クリックしてコピー",@@ -1106,6 +1108,9 @@},"checks": {"self": "小切手"+ },+ "refresh-indicator": {+ "last-refresh": "最終更新: {time}"}},"rollout": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 55411b763c..e25544088d 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -129,6 +129,8 @@"delete": "Xóa","history": "Lịch sử","loading": "Đang tải",+ "just-now": "ngay bây giờ",+ "n-seconds-ago": "{count} giây trước","copy": "Sao chép","copied": "Đã sao chép","click-to-copy": "Nhấp để sao chép",@@ -1106,6 +1108,9 @@},"checks": {"self": "Kiểm tra"+ },+ "refresh-indicator": {+ "last-refresh": "Làm mới lần cuối: {time}"}},"rollout": {@@ -2802,4 +2807,4 @@"last-visit": "Lần truy cập cuối","changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"}-}\ No newline at end of file+}diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex c7a5963709..9599b07902 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -129,6 +129,8 @@"delete": "删除","history": "历史记录","loading": "加载中",+ "just-now": "现在",+ "n-seconds-ago": "{count} 秒前","copy": "拷贝","copied": "已拷贝","click-to-copy": "点击复制",@@ -1106,6 +1108,9 @@},"checks": {"self": "检查"+ },+ "refresh-indicator": {+ "last-refresh": "上次刷新:{time}"}},"rollout": {@@ -2802,4 +2807,4 @@"last-visit": "上次访问","changelog-for-version": "{version} 的更新日志"}-}\ No newline at end of file+}diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex e4d753c16c..f31177870d 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -1,9 +1,9 @@+import { create } from "@bufbuild/protobuf";+import { createContextValues } from "@connectrpc/connect";import { orderBy, uniq } from "lodash-es";import { defineStore } from "pinia";import { computed, reactive, ref, unref, watchEffect } from "vue";import { useRoute } from "vue-router";-import { create } from "@bufbuild/protobuf";-import { createContextValues } from "@connectrpc/connect";import { projectServiceClientConnect } from "@/grpcweb";import { silentContextKey } from "@/grpcweb/context-key";import type { ComposedProject, MaybeRef, ResourceId } from "@/types";@@ -17,11 +17,6 @@ import {isValidProjectName,} from "@/types";import { State as NewState } from "@/types/proto-es/v1/common_pb";-import { convertStateToOld } from "@/utils/v1/common-conversions";-import type {- Project,- ListProjectsResponse,-} from "@/types/proto/v1/project_service";import {GetProjectRequestSchema,ListProjectsRequestSchema,@@ -32,8 +27,16 @@ import {BatchDeleteProjectsRequestSchema,UndeleteProjectRequestSchema,} from "@/types/proto-es/v1/project_service_pb";-import { convertNewProjectToOld, convertOldProjectToNew } from "@/utils/v1/project-conversions";+import type {+ Project,+ ListProjectsResponse,+} from "@/types/proto/v1/project_service";import { hasWorkspacePermissionV2 } from "@/utils";+import { convertStateToOld } from "@/utils/v1/common-conversions";+import {+ convertNewProjectToOld,+ convertOldProjectToNew,+} from "@/utils/v1/project-conversions";import { projectNamePrefix } from "./common";import { useProjectIamPolicyStore } from "./projectIamPolicy";@@ -121,7 +124,10 @@ export const useProjectV1Store = defineStore("project_v1", () => {projects: ComposedProject[];nextPageToken?: string;}> => {- const contextValues = createContextValues().set(silentContextKey, params.silent ?? true);+ const contextValues = createContextValues().set(+ silentContextKey,+ params.silent ?? true+ );let response: ListProjectsResponse | undefined = undefined;let pageToken = params.pageToken;@@ -134,7 +140,10 @@ export const useProjectV1Store = defineStore("project_v1", () => {filter: getListProjectFilter(params.filter ?? {}),showDeleted: params.filter?.state === NewState.DELETED ? true : false,});- const connectResponse = await projectServiceClientConnect.listProjects(request, { contextValues });+ const connectResponse = await projectServiceClientConnect.listProjects(+ request,+ { contextValues }+ );resp = {projects: connectResponse.projects.map(convertNewProjectToOld),nextPageToken: connectResponse.nextPageToken,@@ -146,7 +155,10 @@ export const useProjectV1Store = defineStore("project_v1", () => {filter: getListProjectFilter(params.filter ?? {}),showDeleted: params.filter?.state === NewState.DELETED ? true : false,});- const connectResponse = await projectServiceClientConnect.searchProjects(request, { contextValues });+ const connectResponse =+ await projectServiceClientConnect.searchProjects(request, {+ contextValues,+ });resp = {projects: connectResponse.projects.map(convertNewProjectToOld),nextPageToken: connectResponse.nextPageToken,diff --git a/frontend/src/views/project/CICDLayout.vue b/frontend/src/views/project/CICDLayout.vueindex 907a4eaed2..1a5b2f6137 100644--- a/frontend/src/views/project/CICDLayout.vue+++ b/frontend/src/views/project/CICDLayout.vue@@ -17,10 +17,11 @@@click="handleTabChange(tab)"/>- <!-- Suffix slot for Specifications tab -->- <template v-if="tabKey === TabKey.Specifications" #suffix>- <div class="pr-4 flex flex-row justify-end items-center">- <CurrentSpecSelector />+ <!-- Suffix slot -->+ <template #suffix>+ <div class="pr-4 flex flex-row justify-end items-center gap-4">+ <CurrentSpecSelector v-if="tabKey === TabKey.Specifications" />+ <RefreshIndicator v-if="!isCreating" /></div></template></NTabs>@@ -50,6 +51,7 @@ import {} from "@/components/Plan";import { HeaderSection } from "@/components/Plan/components";import CurrentSpecSelector from "@/components/Plan/components/CurrentSpecSelector.vue";+import RefreshIndicator from "@/components/Plan/components/RefreshIndicator.vue";import { useSpecsValidation } from "@/components/Plan/components/common";import { gotoSpec } from "@/components/Plan/components/common/utils";import { provideIssueReviewContext } from "@/components/Plan/logic/issue-review";@@ -86,7 +88,7 @@ const props = defineProps<{}>();const { t } = useI18n();-const { isCreating, plan, planCheckRunList, issue, rollout, isInitializing } =+const { isCreating, plan, planCheckRuns, issue, rollout, isInitializing } =useInitializePlan(toRef(props, "projectId"),toRef(props, "planId"),@@ -109,7 +111,7 @@ providePlanContext({isCreating,plan,- planCheckRunList,+ planCheckRuns,issue,rollout,...planBaseContext,@@ -211,7 +213,12 @@ const tabRender = (tab: TabKey) => {};const handleTabChange = (tab: TabKey) => {- const params = route.params;+ if (!route || !route.params) {+ console.warn("Route or route.params is undefined");+ return;+ }++ const params = { ...route.params };if (isCreating.value) {params.planId = "create";} else {@@ -224,11 +231,13 @@ const handleTabChange = (tab: TabKey) => {}}+ const query = route.query || {};+if (tab === TabKey.Overview) {router.push({name: PROJECT_V1_ROUTE_PLAN_DETAIL,params: params,- query: route.query,+ query: query,});} else if (tab === TabKey.Specifications) {// Auto select the first spec when switching to Specifications tab.@@ -239,26 +248,26 @@ const handleTabChange = (tab: TabKey) => {router.push({name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,params: params,- query: route.query,+ query: query,});}} else if (tab === TabKey.Checks) {router.push({name: PROJECT_V1_ROUTE_PLAN_DETAIL_CHECK_RUNS,params: params,- query: route.query,+ query: query,});} else if (tab === TabKey.Review) {router.push({name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,params: params,- query: route.query,+ query: query,});} else if (tab === TabKey.Rollout) {router.push({name: PROJECT_V1_ROUTE_ROLLOUT_DETAIL,params: params,- query: route.query,+ query: query,});}};diff --git a/frontend/src/views/project/IssueDetailView.vue b/frontend/src/views/project/IssueDetailView.vueindex 5c15fed84a..8ea4562072 100644--- a/frontend/src/views/project/IssueDetailView.vue+++ b/frontend/src/views/project/IssueDetailView.vue@@ -3,8 +3,5 @@</template><script lang="ts" setup>-import { usePollPlan } from "@/components/Plan";import { IssueReviewView } from "@/components/Plan/components/IssueReviewView";--usePollPlan();</script>diff --git a/frontend/src/views/project/PlanCheckRunsView.vue b/frontend/src/views/project/PlanCheckRunsView.vueindex ac691cabde..2f2483a5b1 100644--- a/frontend/src/views/project/PlanCheckRunsView.vue+++ b/frontend/src/views/project/PlanCheckRunsView.vue@@ -3,8 +3,5 @@</template><script lang="ts" setup>-import { usePollPlan } from "@/components/Plan";import { ChecksView } from "@/components/Plan/components";--usePollPlan();</script>diff --git a/frontend/src/views/project/PlanDetailView.vue b/frontend/src/views/project/PlanDetailView.vueindex d8e2362490..a3c42ff2de 100644--- a/frontend/src/views/project/PlanDetailView.vue+++ b/frontend/src/views/project/PlanDetailView.vue@@ -3,8 +3,5 @@</template><script lang="ts" setup>-import { usePollPlan } from "@/components/Plan";import { Overview } from "@/components/Plan/components";--usePollPlan();</script>diff --git a/frontend/src/views/project/PlanSpecDetailView.vue b/frontend/src/views/project/PlanSpecDetailView.vueindex d66b147b2b..87773028aa 100644--- a/frontend/src/views/project/PlanSpecDetailView.vue+++ b/frontend/src/views/project/PlanSpecDetailView.vue@@ -3,8 +3,5 @@</template><script lang="ts" setup>-import { usePollPlan } from "@/components/Plan";import SpecsView from "@/components/Plan/components/SpecsView.vue";--usePollPlan();</script>diff --git a/frontend/src/views/project/ProjectPlanDetail.vue b/frontend/src/views/project/ProjectPlanDetail.vueindex eb7cea6d8e..f0114c0a39 100644--- a/frontend/src/views/project/ProjectPlanDetail.vue+++ b/frontend/src/views/project/ProjectPlanDetail.vue@@ -32,7 +32,7 @@ const props = defineProps<{}>();const { t } = useI18n();-const { isCreating, plan, planCheckRunList, issue, rollout, isInitializing } =+const { isCreating, plan, planCheckRuns, issue, rollout, isInitializing } =useInitializePlan(toRef(props, "projectId"),toRef(props, "planId"),@@ -52,7 +52,7 @@ providePlanContext({isCreating,plan,- planCheckRunList,+ planCheckRuns,issue,rollout,...planBaseContext,diff --git a/frontend/src/views/project/RolloutDetailView.vue b/frontend/src/views/project/RolloutDetailView.vueindex 73661c443a..cc2d280d19 100644--- a/frontend/src/views/project/RolloutDetailView.vue+++ b/frontend/src/views/project/RolloutDetailView.vue@@ -3,8 +3,5 @@</template><script lang="ts" setup>-import { usePollPlan } from "@/components/Plan";import { RolloutView } from "@/components/Plan/components/RolloutView";--usePollPlan();</script>