Skip to content

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

chore: add plan check run status column (#12316)

boojackd98d66257081
diff --git a/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue b/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue
new file mode 100644
index 0000000000..959b512909
--- /dev/null
+++ b/frontend/src/components/Plan/components/PlanCheckRunStatusIcon.vue
@@ -0,0 +1,73 @@
+<template>
+ <span
+ class="flex items-center justify-center rounded-full select-none overflow-hidden"
+ :class="iconClass()"
+ >
+ <template v-if="planCheckRunStatus === PlanCheckRun_Result_Status.ERROR">
+ <span
+ class="h-2 w-2 rounded-full text-center pb-6 font-normal text-base"
+ aria-hidden="true"
+ >!</span
+ >
+ </template>
+ <template
+ v-else-if="planCheckRunStatus === PlanCheckRun_Result_Status.WARNING"
+ >
+ <span class="h-3 w-3 bg-white rounded-full" aria-hidden="true"></span>
+ </template>
+ <template
+ v-else-if="planCheckRunStatus === PlanCheckRun_Result_Status.SUCCESS"
+ >
+ <heroicons-solid:check class="w-4 h-4" />
+ </template>
+ <template v-else>
+ <span class="h-3 w-3 bg-white rounded-full" aria-hidden="true"></span>
+ </template>
+ </span>
+</template>
+
+<script lang="ts" setup>
+import type { PropType } from "vue";
+import { computed } from "vue";
+import { PlanCheckRun_Result_Status } from "@/types/proto/v1/plan_service";
+import type { ComposedPlan } from "@/types/v1/issue/plan";
+
+export type SizeType = "small" | "normal";
+
+const props = defineProps({
+ plan: {
+ required: true,
+ type: Object as PropType<ComposedPlan>,
+ },
+ size: {
+ type: String as PropType<SizeType>,
+ default: "normal",
+ },
+});
+
+const planCheckRunStatus = computed(() => {
+ const { planCheckRunStatusCount } = props.plan;
+ if (planCheckRunStatusCount["ERROR"] > 0) {
+ return PlanCheckRun_Result_Status.ERROR;
+ } else if (planCheckRunStatusCount["WARNING"] > 0) {
+ return PlanCheckRun_Result_Status.WARNING;
+ } else if (planCheckRunStatusCount["SUCCESS"] > 0) {
+ return PlanCheckRun_Result_Status.SUCCESS;
+ }
+ return PlanCheckRun_Result_Status.STATUS_UNSPECIFIED;
+});
+
+const iconClass = () => {
+ const iconClass = props.size === "normal" ? "w-5 h-5" : "w-4 h-4";
+ switch (planCheckRunStatus.value) {
+ case PlanCheckRun_Result_Status.ERROR:
+ return iconClass + " bg-error text-white";
+ case PlanCheckRun_Result_Status.WARNING:
+ return iconClass + " bg-warning text-white";
+ case PlanCheckRun_Result_Status.SUCCESS:
+ return iconClass + " bg-success text-white";
+ default:
+ return iconClass + " bg-accent text-white";
+ }
+};
+</script>
diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
index c8cf6c2884..d1143192c7 100644
--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
@@ -24,12 +24,20 @@ import { ProjectNameCell } from "@/components/v2/Model/DatabaseV1Table/cells";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
import type { ComposedPlan } from "@/types/v1/issue/plan";
import { extractProjectResourceName, humanizeTs, planSlug } from "@/utils";
+import PlanCheckRunStatusIcon from "../PlanCheckRunStatusIcon.vue";
const { t } = useI18n();
const columnList = computed((): DataTableColumn<ComposedPlan>[] => {
const columns: (DataTableColumn<ComposedPlan> & { hide?: boolean })[] = [
- // TODO(steven): show latest plan check run status.
+ {
+ key: "status",
+ title: "",
+ width: "36px",
+ render: (plan) => {
+ return <PlanCheckRunStatusIcon plan={plan} />;
+ },
+ },
{
key: "title",
title: t("issue.table.name"),