Skip to content

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

chore: tweak plan checks (#16927)

boojackc29bc0eeeaf0
diff --git a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
index 7277f1bac5..7b60e88835 100644
--- a/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
+++ b/frontend/src/components/Plan/components/ChecksView/ChecksView.vue
@@ -6,7 +6,7 @@
<!-- Check result summary with icons -->
<div class="flex items-center gap-3">
<div
- v-if="statusCounts.error > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.ERROR) > 0"
class="flex items-center gap-1 px-2 py-1 cursor-pointer"
:class="[
selectedStatus &&
@@ -21,11 +21,11 @@
{{ $t("common.error") }}
</span>
<span class="font-semibold">
- {{ statusCounts.error }}
+ {{ getChecksCount(PlanCheckRun_Result_Status.ERROR) }}
</span>
</div>
<div
- v-if="statusCounts.warning > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.WARNING) > 0"
class="flex items-center gap-1 px-2 py-1 cursor-pointer"
:class="[
selectedStatus &&
@@ -40,11 +40,11 @@
{{ $t("common.warning") }}
</span>
<span class="font-semibold">
- {{ statusCounts.warning }}
+ {{ getChecksCount(PlanCheckRun_Result_Status.WARNING) }}
</span>
</div>
<div
- v-if="statusCounts.success > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.SUCCESS) > 0"
class="flex items-center gap-1 px-2 py-1 cursor-pointer"
:class="[
selectedStatus &&
@@ -59,7 +59,7 @@
{{ $t("common.success") }}
</span>
<span class="font-semibold">
- {{ statusCounts.success }}
+ {{ getChecksCount(PlanCheckRun_Result_Status.SUCCESS) }}
</span>
</div>
</div>
@@ -68,9 +68,15 @@
<!-- Results List -->
<div class="flex-1 overflow-y-auto">
+ <div
+ v-if="isLoading"
+ class="flex flex-col items-center justify-center py-12"
+ >
+ <BBSpin />
+ </div>
<!-- Empty state -->
<div
- v-if="filteredCheckRuns.length === 0"
+ v-else-if="filteredCheckRuns.length === 0"
class="flex flex-col items-center justify-center py-12"
>
<CheckCircleIcon class="w-12 h-12 text-control-light opacity-50 mb-4" />
@@ -159,8 +165,9 @@ import {
ShieldIcon,
SearchCodeIcon,
} from "lucide-vue-next";
-import { computed, ref } from "vue";
+import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
+import { BBSpin } from "@/bbkit";
import { getRuleLocalization } from "@/types";
import {
PlanCheckRun_Result_Status,
@@ -170,6 +177,7 @@ import {
} from "@/types/proto-es/v1/plan_service_pb";
import { humanizeTs } from "@/utils";
import { usePlanContext } from "../../logic/context";
+import { useResourcePoller } from "../../logic/poller";
import DatabaseDisplay from "../common/DatabaseDisplay.vue";
const props = defineProps<{
@@ -177,7 +185,10 @@ const props = defineProps<{
}>();
const { t } = useI18n();
-const { planCheckRuns } = usePlanContext();
+const { plan, planCheckRuns } = usePlanContext();
+const { refreshResources } = useResourcePoller();
+
+const isLoading = ref(true);
const selectedStatus = ref<PlanCheckRun_Result_Status | undefined>(
props.defaultStatus
@@ -202,31 +213,21 @@ const filteredCheckRuns = computed(() => {
});
});
-const statusCounts = computed(() => {
- const counts = {
- success: 0,
- warning: 0,
- error: 0,
- };
-
- for (const checkRun of planCheckRuns.value) {
- for (const result of checkRun.results) {
- switch (result.status) {
- case PlanCheckRun_Result_Status.SUCCESS:
- counts.success++;
- break;
- case PlanCheckRun_Result_Status.WARNING:
- counts.warning++;
- break;
- case PlanCheckRun_Result_Status.ERROR:
- counts.error++;
- break;
- }
- }
- }
+watch(
+ () => props.defaultStatus,
+ async () => {
+ isLoading.value = true;
+ await refreshResources(["planCheckRuns"], true /** force */);
+ isLoading.value = false;
+ },
+ { immediate: true }
+);
- return counts;
-});
+const getChecksCount = (status: PlanCheckRun_Result_Status) => {
+ return (
+ plan.value.planCheckRunStatusCount[PlanCheckRun_Result_Status[status]] || 0
+ );
+};
const toggleSelectedStatus = (status: PlanCheckRun_Result_Status) => {
if (selectedStatus.value === status) {
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
index 77ce38a668..d693342b43 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/Actions.vue
@@ -299,7 +299,7 @@ const handlePlanStateChange = async (action: PlanAction) => {
"state",
]);
// The plan context should automatically refresh and redirect or update the UI.
- await resourcePoller.refreshAllManual();
+ await resourcePoller.refreshResources();
} catch (error) {
console.error(errorMessage, error);
pushNotification({
diff --git a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
index 09e845c9fe..3e17851f1e 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/OverviewSection.vue
@@ -41,35 +41,47 @@
{{ $t("plan.navigator.checks") }}
</p>
<div class="flex items-center gap-3 mt-1">
- <div
- v-if="statistics.checkStatus.error > 0"
- class="flex items-center gap-1"
+ <button
+ v-if="getChecksCount(PlanCheckRun_Result_Status.ERROR) > 0"
+ class="flex items-center gap-1 hover:opacity-80"
+ @click="selectedResultStatus = PlanCheckRun_Result_Status.ERROR"
>
<XCircleIcon class="w-5 h-5 text-error" />
<span class="text-xl font-medium text-error">{{
- statistics.checkStatus.error
+ getChecksCount(PlanCheckRun_Result_Status.ERROR)
}}</span>
- </div>
- <div
- v-if="statistics.checkStatus.warning > 0"
- class="flex items-center gap-1"
+ </button>
+ <button
+ v-if="getChecksCount(PlanCheckRun_Result_Status.WARNING) > 0"
+ class="flex items-center gap-1 hover:opacity-80"
+ @click="
+ selectedResultStatus = PlanCheckRun_Result_Status.WARNING
+ "
>
<AlertCircleIcon class="w-5 h-5 text-warning" />
<span class="text-xl font-medium text-warning">{{
- statistics.checkStatus.warning
+ getChecksCount(PlanCheckRun_Result_Status.WARNING)
}}</span>
- </div>
- <div
- v-if="statistics.checkStatus.success > 0"
- class="flex items-center gap-1"
+ </button>
+ <button
+ v-if="getChecksCount(PlanCheckRun_Result_Status.SUCCESS) > 0"
+ class="flex items-center gap-1 hover:opacity-80"
+ @click="
+ selectedResultStatus = PlanCheckRun_Result_Status.SUCCESS
+ "
>
<CheckCircleIcon class="w-5 h-5 text-success" />
<span class="text-xl font-medium text-success">{{
- statistics.checkStatus.success
+ getChecksCount(PlanCheckRun_Result_Status.SUCCESS)
}}</span>
- </div>
+ </button>
<span
- v-if="statistics.checkStatus.total === 0"
+ v-if="
+ getChecksCount(PlanCheckRun_Result_Status.ERROR) +
+ getChecksCount(PlanCheckRun_Result_Status.WARNING) +
+ getChecksCount(PlanCheckRun_Result_Status.SUCCESS) ===
+ 0
+ "
class="text-xl text-control"
>
{{ $t("plan.overview.no-checks") }}
@@ -81,6 +93,12 @@
</div>
</div>
</div>
+
+ <ChecksDrawer
+ v-if="selectedResultStatus"
+ :status="selectedResultStatus"
+ @close="selectedResultStatus = undefined"
+ />
</template>
<script setup lang="ts">
@@ -92,44 +110,31 @@ import {
AlertCircleIcon,
XCircleIcon,
} from "lucide-vue-next";
-import { computed, watch } from "vue";
+import { computed, ref, watch } from "vue";
import { useInstanceV1Store, useDBGroupStore } from "@/store";
import type { ComposedDatabaseGroup, ComposedInstance } from "@/types";
import { PlanCheckRun_Result_Status } from "@/types/proto-es/v1/plan_service_pb";
import { extractDatabaseResourceName } from "@/utils";
import { targetsForSpec, usePlanContext } from "../../logic";
+import ChecksDrawer from "../ChecksView/ChecksDrawer.vue";
const { plan } = usePlanContext();
const instanceStore = useInstanceV1Store();
const dbGroupStore = useDBGroupStore();
+const selectedResultStatus = ref<PlanCheckRun_Result_Status | undefined>(
+ undefined
+);
+
// Calculate statistics
const statistics = computed(() => {
let totalTargets = 0;
- const checkStatus = {
- total: 0,
- success:
- plan.value.planCheckRunStatusCount[
- PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.SUCCESS]
- ] || 0,
- warning:
- plan.value.planCheckRunStatusCount[
- PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.WARNING]
- ] || 0,
- error:
- plan.value.planCheckRunStatusCount[
- PlanCheckRun_Result_Status[PlanCheckRun_Result_Status.ERROR]
- ] || 0,
- };
- checkStatus.total =
- checkStatus.success + checkStatus.warning + checkStatus.error;
for (const spec of plan.value.specs) {
totalTargets += targetsForSpec(spec).length;
}
return {
totalSpecs: plan.value.specs.length,
totalTargets,
- checkStatus,
};
});
@@ -198,6 +203,12 @@ const affectedResources = computed(() => {
return resourceList;
});
+const getChecksCount = (status: PlanCheckRun_Result_Status) => {
+ return (
+ plan.value.planCheckRunStatusCount[PlanCheckRun_Result_Status[status]] || 0
+ );
+};
+
watch(
() => affectedResources.value,
() => {
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
index 012826ec8e..a9dc0dd7c2 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/Sidebar.vue
@@ -58,7 +58,7 @@ const { t } = useI18n();
const { issue } = usePlanContextWithIssue();
const currentUser = useCurrentUserV1();
const { project } = useCurrentProjectV1();
-const { requestEnhancedPolling } = useResourcePoller();
+const { refreshResources } = useResourcePoller();
const allowChange = computed(() => {
if (issue.value.status !== IssueStatus.OPEN) {
@@ -83,7 +83,7 @@ const onIssueLabelsUpdate = async (labels: string[]) => {
updateMask: { paths: ["labels"] },
});
await issueServiceClientConnect.updateIssue(request);
- requestEnhancedPolling(["issue"], true /** once */);
+ refreshResources(["issue"], true /** force */);
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -102,7 +102,7 @@ const onIssueDescriptionUpdate = async (description: string) => {
});
await issueServiceClientConnect.updateIssue(request);
// After running checks, we need to refresh the plan and plan check runs.
- requestEnhancedPolling(["issue"], true /** once */);
+ refreshResources(["issue"], true /** force */);
pushNotification({
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
index cd7c1206b4..d6e0e03105 100644
--- a/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
+++ b/frontend/src/components/Plan/components/PlanCheckSection/PlanCheckSection.vue
@@ -1,5 +1,8 @@
<template>
- <div v-if="show" class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden">
+ <div
+ v-if="shouldShow"
+ class="px-4 pt-3 flex flex-col gap-y-1 overflow-hidden"
+ >
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-1">
<h3 class="text-base font-medium">{{ $t("plan.checks.self") }}</h3>
@@ -9,28 +12,34 @@
<!-- Status Summary -->
<div class="flex items-center gap-2 text-sm">
<button
- v-if="summary.error > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.ERROR) > 0"
class="flex items-center gap-1 hover:opacity-80"
- @click="openDrawer(PlanCheckRun_Result_Status.ERROR)"
+ @click="openChecksDrawer(PlanCheckRun_Result_Status.ERROR)"
>
<XCircleIcon class="w-5 h-5 text-error" />
- <span class="text-error">{{ summary.error }}</span>
+ <span class="text-error">{{
+ getChecksCount(PlanCheckRun_Result_Status.ERROR)
+ }}</span>
</button>
<button
- v-if="summary.warning > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.WARNING) > 0"
class="flex items-center gap-1 hover:opacity-80"
- @click="openDrawer(PlanCheckRun_Result_Status.WARNING)"
+ @click="openChecksDrawer(PlanCheckRun_Result_Status.WARNING)"
>
<AlertCircleIcon class="w-5 h-5 text-warning" />
- <span class="text-warning">{{ summary.warning }}</span>
+ <span class="text-warning">{{
+ getChecksCount(PlanCheckRun_Result_Status.WARNING)
+ }}</span>
</button>
<button
- v-if="summary.success > 0"
+ v-if="getChecksCount(PlanCheckRun_Result_Status.SUCCESS) > 0"
class="flex items-center gap-1 hover:opacity-80"
- @click="openDrawer(PlanCheckRun_Result_Status.SUCCESS)"
+ @click="openChecksDrawer(PlanCheckRun_Result_Status.SUCCESS)"
>
<CheckCircleIcon class="w-5 h-5 text-success" />
- <span class="text-success">{{ summary.success }}</span>
+ <span class="text-success">{{
+ getChecksCount(PlanCheckRun_Result_Status.SUCCESS)
+ }}</span>
</button>
</div>
@@ -49,14 +58,16 @@
</div>
</div>
- <ChecksDrawer v-model:show="drawerVisible" :status="selectedStatus" />
+ <ChecksDrawer
+ v-model:show="showChecksDrawer"
+ :status="selectedResultStatus"
+ />
</div>
</template>
<script setup lang="ts">
import { create } from "@bufbuild/protobuf";
import type { ConnectError } from "@connectrpc/connect";
-import { isNumber } from "lodash-es";
import {
CheckCircleIcon,
AlertCircleIcon,
@@ -87,50 +98,32 @@ const currentUser = useCurrentUserV1();
const { project } = useCurrentProjectV1();
const { plan } = usePlanContext();
const selectedSpec = useSelectedSpec();
-const { requestEnhancedPolling } = useResourcePoller();
+const { refreshResources } = useResourcePoller();
const isRunningChecks = ref(false);
-const drawerVisible = ref(false);
-const selectedStatus = ref<PlanCheckRun_Result_Status>(
+const showChecksDrawer = ref(false);
+const selectedResultStatus = ref<PlanCheckRun_Result_Status>(
PlanCheckRun_Result_Status.SUCCESS
);
-const show = computed(() => {
+const shouldShow = computed(() => {
return planSpecHasPlanChecks(selectedSpec.value);
});
-const summary = computed(() => {
- const result = { success: 0, warning: 0, error: 0 };
- if (
- plan.value.planCheckRunStatusCount["ERROR"] &&
- isNumber(plan.value.planCheckRunStatusCount["ERROR"])
- ) {
- result.error = plan.value.planCheckRunStatusCount["ERROR"];
- }
- if (
- plan.value.planCheckRunStatusCount["WARNING"] &&
- isNumber(plan.value.planCheckRunStatusCount["WARNING"])
- ) {
- result.warning = plan.value.planCheckRunStatusCount["WARNING"];
- }
- if (
- plan.value.planCheckRunStatusCount["SUCCESS"] &&
- isNumber(plan.value.planCheckRunStatusCount["SUCCESS"])
- ) {
- result.success = plan.value.planCheckRunStatusCount["SUCCESS"];
- }
- return result;
-});
-
const allowRunChecks = computed(() => {
const me = currentUser.value;
if (extractUserId(plan.value.creator) === me.email) {
return true;
}
-
return hasProjectPermissionV2(project.value, "bb.planCheckRuns.run");
});
+const getChecksCount = (status: PlanCheckRun_Result_Status) => {
+ return (
+ plan.value.planCheckRunStatusCount[PlanCheckRun_Result_Status[status]] || 0
+ );
+};
+
const runChecks = async () => {
if (!plan.value.name || !selectedSpec.value) return;
@@ -142,7 +135,7 @@ const runChecks = async () => {
await planServiceClientConnect.runPlanChecks(request);
// After running checks, we need to refresh the plan and plan check runs.
- requestEnhancedPolling(["plan", "planCheckRuns"], true /** once */);
+ refreshResources(["plan", "planCheckRuns"], true /** force */);
pushNotification({
module: "bytebase",
@@ -161,8 +154,8 @@ const runChecks = async () => {
}
};
-const openDrawer = (status: PlanCheckRun_Result_Status) => {
- selectedStatus.value = status;
- drawerVisible.value = true;
+const openChecksDrawer = (status: PlanCheckRun_Result_Status) => {
+ selectedResultStatus.value = status;
+ showChecksDrawer.value = true;
};
</script>
diff --git a/frontend/src/components/Plan/components/RefreshIndicator.vue b/frontend/src/components/Plan/components/RefreshIndicator.vue
index 66e4ea89ab..9ca86734a6 100644
--- a/frontend/src/components/Plan/components/RefreshIndicator.vue
+++ b/frontend/src/components/Plan/components/RefreshIndicator.vue
@@ -70,6 +70,6 @@ const lastRefreshDisplay = computed(() => {
});
const handleRefresh = async () => {
- await resourcePoller.refreshAllManual();
+ await resourcePoller.refreshResources();
};
</script>
diff --git a/frontend/src/components/Plan/components/RolloutView/StageCard.vue b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
index 072af6f019..d0315a0e3f 100644
--- a/frontend/src/components/Plan/components/RolloutView/StageCard.vue
+++ b/frontend/src/components/Plan/components/RolloutView/StageCard.vue
@@ -17,7 +17,7 @@
<div class="flex items-start gap-2">
<div class="flex items-start gap-2">
<TaskStatus :status="stageStatus" size="medium" />
- <div class="flex flex-col">
+ <div class="flex flex-col gap-1">
<h3
class="text-base font-medium text-gray-900 whitespace-nowrap w-24 truncate"
>
@@ -25,9 +25,10 @@
environmentStore.getEnvironmentByName(stage.environment).title
}}
</h3>
- <span v-if="latestUpdateTime" class="text-xs text-gray-500">
- {{ humanizeTs(latestUpdateTime / 1000) }}
- </span>
+ <Timestamp
+ v-if="latestUpdateTimestamp"
+ :timestamp="latestUpdateTimestamp"
+ />
</div>
</div>
@@ -165,6 +166,7 @@
</template>
<script setup lang="ts">
+import type { Timestamp as TimestampPb } from "@bufbuild/protobuf/wkt";
import {
CircleFadingPlusIcon,
ChevronDownIcon,
@@ -178,6 +180,7 @@ import { useRouter } from "vue-router";
import DatabaseDisplay from "@/components/Plan/components/common/DatabaseDisplay.vue";
import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
+import Timestamp from "@/components/misc/Timestamp.vue";
import {
PROJECT_V1_ROUTE_ROLLOUT_DETAIL_STAGE_DETAIL,
PROJECT_V1_ROUTE_ROLLOUT_DETAIL_TASK_DETAIL,
@@ -295,19 +298,21 @@ const stageStatus = computed(() => {
return getStageStatus(stageWithFilteredTasks);
});
-const latestUpdateTime = computed(() => {
- let latestTime: number | undefined;
+const latestUpdateTimestamp = computed(() => {
+ let latestTimestamp: TimestampPb | undefined;
for (const task of props.stage.tasks) {
if (task.updateTime) {
- const taskTime = getTimeForPbTimestampProtoEs(task.updateTime, 0);
- if (!latestTime || taskTime > latestTime) {
- latestTime = taskTime;
+ if (
+ !latestTimestamp ||
+ task.updateTime.seconds > latestTimestamp.seconds
+ ) {
+ latestTimestamp = task.updateTime;
}
}
}
- return latestTime;
+ return latestTimestamp;
});
const getTaskCount = (status: Task_Status) => {
diff --git a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
index a152bc3a39..a2c3425127 100644
--- a/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
+++ b/frontend/src/components/Plan/components/RolloutView/TaskFilter.vue
@@ -1,5 +1,5 @@
<template>
- <div class="flex flex-row gap-2 items-center">
+ <div class="flex flex-row gap-1 items-center">
<template v-for="status in TASK_STATUS_FILTERS" :key="status">
<NTag
v-if="getTaskCount(status) > 0"
@@ -20,7 +20,7 @@
<template #avatar>
<TaskStatus :status="status" size="small" />
</template>
- <div class="flex flex-row items-center gap-2">
+ <div class="flex flex-row items-center gap-1">
<span class="select-none text-base">{{
stringifyTaskStatus(status)
}}</span>
diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.ts
index a452c70456..5f1dc78fc4 100644
--- a/frontend/src/components/Plan/logic/poller/poller.ts
+++ b/frontend/src/components/Plan/logic/poller/poller.ts
@@ -69,21 +69,6 @@ export const provideResourcePoller = () => {
// Track last refresh time
const lastRefreshTime = ref(0);
- const enhancedPollingResources = ref<ResourceType[]>([]);
-
- const requestEnhancedPolling = (
- resources: ResourceType[],
- once?: boolean
- ) => {
- if (once) {
- // For one-time refresh, directly call refreshAll
- refreshAll(true);
- restartPoller();
- } else {
- enhancedPollingResources.value = resources;
- }
- };
-
const resourcesFromRoute = computed<ResourceType[]>(() => {
if (isCreating.value) {
return [];
@@ -101,7 +86,7 @@ export const provideResourcePoller = () => {
routeName
)
) {
- return ["plan", "planCheckRuns"];
+ return ["plan"];
}
// Issue-specific pages
@@ -128,10 +113,7 @@ export const provideResourcePoller = () => {
});
const resourcesToPolled = computed<ResourceType[]>(() => {
- return uniq([
- ...enhancedPollingResources.value,
- ...resourcesFromRoute.value,
- ]);
+ return uniq([...resourcesFromRoute.value]);
});
// Create refresh functions for each resource
@@ -160,40 +142,33 @@ export const provideResourcePoller = () => {
await refreshTaskRuns(rollout.value, project.value, taskRuns);
};
- // Single refresh function for all resources
- const refreshActiveResources = async () => {
- const activeResources = resourcesToPolled.value;
- if (activeResources.length === 0 || isRefreshing.value) return;
+ const refreshResources = async (
+ resources: ResourceType[] = resourcesToPolled.value,
+ force?: boolean
+ ) => {
+ if ((resources.length === 0 || isRefreshing.value) && !force) return;
isRefreshing.value = true;
const refreshPromises = [];
try {
- if (activeResources.includes("plan") && plan.value) {
+ if (resources.includes("plan") && plan.value) {
refreshPromises.push(refreshPlan(plan));
}
- if (
- activeResources.includes("planCheckRuns") &&
- plan.value &&
- planCheckRuns
- ) {
+ if (resources.includes("planCheckRuns") && plan.value && planCheckRuns) {
refreshPromises.push(
refreshPlanCheckRuns(plan.value, project.value, planCheckRuns)
);
}
- if (activeResources.includes("issue") && issue?.value) {
+ if (resources.includes("issue") && issue?.value) {
refreshPromises.push(refreshIssue(issue as any));
}
- if (
- activeResources.includes("rollout") &&
- plan.value?.rollout &&
- rollout
- ) {
+ if (resources.includes("rollout") && plan.value?.rollout && rollout) {
refreshPromises.push(
refreshRollout(plan.value.rollout, project.value, rollout)
);
}
- if (activeResources.includes("taskRuns") && rollout?.value && taskRuns) {
+ if (resources.includes("taskRuns") && rollout?.value && taskRuns) {
refreshPromises.push(
refreshTaskRuns(rollout.value, project.value, taskRuns)
);
@@ -206,7 +181,7 @@ export const provideResourcePoller = () => {
// Emit event after successful refresh
events.emit("resource-refresh-completed", {
- resources: activeResources,
+ resources: resources,
isManual: false,
});
} finally {
@@ -215,7 +190,7 @@ export const provideResourcePoller = () => {
};
// Create a single poller for all resources
- const resourcePoller = useProgressivePoll(refreshActiveResources, {
+ const resourcePoller = useProgressivePoll(refreshResources, {
interval: POLLER_INTERVAL,
});
@@ -295,11 +270,6 @@ export const provideResourcePoller = () => {
}
};
- const refreshAllManual = async () => {
- if (isRefreshing.value) return;
- await refreshAll(true);
- };
-
// Set up event listeners
events.on("status-changed", async ({ eager }) => {
if (eager) {
@@ -346,11 +316,8 @@ export const provideResourcePoller = () => {
});
const poller = {
- refreshAllManual,
- requestEnhancedPolling,
- restartPoller,
+ refreshResources,
isRefreshing,
- activeResources: resourcesToPolled,
lastRefreshTime,
};