Skip to content

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

chore: add expand button to plan check bar (#11963)

boojack1dff0987ed2c
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadgeBar.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadgeBar.vue
index d8d85f91e8..7a1dc8accf 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadgeBar.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBadgeBar.vue
@@ -9,6 +9,8 @@
:plan-check-run-list="group.list"
@click="$emit('select-type', group.type)"
/>
+ <!-- Default slot for other actions -->
+ <slot></slot>
</div>
</template>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
index 235fde1f66..6c0a1dca5b 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckBar.vue
@@ -1,5 +1,5 @@
<template>
- <div class="flex items-start gap-x-4">
+ <div class="w-full flex items-start gap-x-4 flex-wrap">
<div
class="textlabel h-[26px] inline-flex items-center"
:class="labelClass"
@@ -7,30 +7,59 @@
{{ $t("task.task-checks") }}
</div>
- <PlanCheckBadgeBar
- :plan-check-run-list="planCheckRunList"
- @select-type="selectedType = $event"
- />
+ <div class="flex-1">
+ <PlanCheckBadgeBar
+ v-if="!state.showPlanCheckDetail"
+ :plan-check-run-list="planCheckRunList"
+ @select-type="selectedType = $event"
+ >
+ <NTooltip v-if="planCheckRunList.length > 0" trigger="hover">
+ <template #trigger>
+ <NButton
+ strong
+ secondary
+ circle
+ bordered
+ size="small"
+ type="tertiary"
+ @click="state.showPlanCheckDetail = true"
+ >
+ <template #icon>
+ <ChevronsUpDownIcon class="w-4 h-auto" />
+ </template>
+ </NButton>
+ </template>
+ {{ $t("common.expand") }}
+ </NTooltip>
+ </PlanCheckBadgeBar>
+ </div>
- <PlanCheckRunButton
- v-if="allowRunChecks && task"
- :task="task"
- @run-checks="runChecks"
- />
+ <div class="flex justify-end items-center shrink-0">
+ <PlanCheckRunButton
+ v-if="allowRunChecks && task"
+ :task="task"
+ @run-checks="runChecks"
+ />
+ </div>
+
+ <div v-if="state.showPlanCheckDetail" class="w-full mt-2">
+ <PlanCheckPanel :plan-check-run-list="planCheckRunList" :task="task" />
+ </div>
- <PlanCheckPanel
+ <PlanCheckModal
v-if="planCheckRunList.length > 0 && selectedType"
:selected-type="selectedType"
:plan-check-run-list="planCheckRunList"
:task="task"
- @select-type="selectedType = $event"
@close="selectedType = undefined"
/>
</div>
</template>
<script lang="ts" setup>
-import { computed, ref } from "vue";
+import { ChevronsUpDownIcon } from "lucide-vue-next";
+import { NButton, NTooltip } from "naive-ui";
+import { computed, reactive, ref } from "vue";
import {
notifyNotEditableLegacyIssue,
planCheckRunListForTask,
@@ -44,9 +73,14 @@ import type {
} from "@/types/proto/v1/rollout_service";
import type { VueClass } from "@/utils";
import PlanCheckBadgeBar from "./PlanCheckBadgeBar.vue";
+import PlanCheckModal from "./PlanCheckModal.vue";
import PlanCheckPanel from "./PlanCheckPanel.vue";
import PlanCheckRunButton from "./PlanCheckRunButton.vue";
+interface LocalState {
+ showPlanCheckDetail: boolean;
+}
+
const props = defineProps<{
allowRunChecks?: boolean;
task?: Task;
@@ -55,6 +89,9 @@ const props = defineProps<{
}>();
const { issue, events } = useIssueContext();
+const state = reactive<LocalState>({
+ showPlanCheckDetail: false,
+});
const selectedType = ref<PlanCheckRun_Type>();
const planCheckRunList = computed(() => {
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
index 334b76954a..17e2734784 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
@@ -1,9 +1,9 @@
<template>
- <div class="space-y-5 divide-y pb-5 px-2">
+ <div class="space-y-3 divide-y pb-4 px-2">
<div
v-for="(row, i) in tableRows"
:key="i"
- class="pt-5 first:pt-2 space-y-2"
+ class="pt-3 first:pt-2 space-y-2"
>
<div class="flex items-center space-x-3">
<div
@@ -30,7 +30,7 @@
</span>
</template>
</div>
- <div v-if="showCategoryColumn">
+ <div v-if="showCategoryColumn" class="shrink-0">
{{ row.category }}
</div>
<div class="font-semibold">{{ row.title }}</div>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue
new file mode 100644
index 0000000000..df59d9fd7e
--- /dev/null
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckModal.vue
@@ -0,0 +1,55 @@
+<template>
+ <BBModal
+ :title="
+ task
+ ? $t('task.check-result.title', { name: task.title })
+ : $t('task.check-result.title-general')
+ "
+ class="!w-[56rem]"
+ header-class="whitespace-pre-wrap break-all gap-x-1"
+ @close="$emit('close')"
+ >
+ <PlanCheckPanel
+ :plan-check-run-list="planCheckRunList"
+ :selected-type="selectedType"
+ :task="task"
+ />
+ </BBModal>
+</template>
+
+<script setup lang="ts">
+import { first, orderBy } from "lodash-es";
+import { computed, ref, watch } from "vue";
+import type {
+ PlanCheckRun,
+ PlanCheckRun_Type,
+ Task,
+} from "@/types/proto/v1/rollout_service";
+import PlanCheckPanel from "./PlanCheckPanel.vue";
+
+const props = defineProps<{
+ planCheckRunList: PlanCheckRun[];
+ selectedType: PlanCheckRun_Type;
+ task?: Task;
+}>();
+
+defineEmits<{
+ (event: "close"): void;
+}>();
+
+const selectedPlanCheckRunList = computed(() => {
+ return orderBy(
+ props.planCheckRunList.filter(
+ (checkRun) => checkRun.type === props.selectedType
+ ),
+ (checkRun) => parseInt(checkRun.uid, 10),
+ "desc"
+ );
+});
+
+const selectedPlanCheckRunUID = ref(first(selectedPlanCheckRunList.value)?.uid);
+
+watch(selectedPlanCheckRunList, (list) => {
+ selectedPlanCheckRunUID.value = first(list)?.uid;
+});
+</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
index 6eebd8ff53..94d0263706 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckPanel.vue
@@ -1,35 +1,25 @@
<template>
- <BBModal
- :title="
- task
- ? $t('task.check-result.title', { name: task.title })
- : $t('task.check-result.title-general')
- "
- class="!w-[56rem]"
- header-class="whitespace-pre-wrap break-all gap-x-1"
- @close="$emit('close')"
- >
- <div class="space-y-4">
- <PlanCheckBadgeBar
- :plan-check-run-list="planCheckRunList"
- :selected-type="selectedType"
- @select-type="$emit('select-type', $event)"
- />
- <TabFilter
- v-if="selectedPlanCheckRunUID"
- v-model:value="selectedPlanCheckRunUID"
- :items="tabItemList"
- />
+ <div class="space-y-2">
+ <TabFilter
+ v-if="selectedPlanCheckRunUID && tabItemList.length > 1"
+ v-model:value="selectedPlanCheckRunUID"
+ :items="tabItemList"
+ />
- <PlanCheckDetail
- v-if="selectedPlanCheckRun"
- :plan-check-run="selectedPlanCheckRun"
- :environment="environment"
- :is-latest="isLatestPlanCheckRun"
- @close="$emit('close')"
- />
- </div>
- </BBModal>
+ <PlanCheckBadgeBar
+ :plan-check-run-list="planCheckRunList"
+ :selected-type="selectedTypeRef"
+ @select-type="(type) => (selectedTypeRef = type)"
+ />
+
+ <PlanCheckDetail
+ v-if="selectedPlanCheckRun"
+ :plan-check-run="selectedPlanCheckRun"
+ :environment="environment"
+ :is-latest="isLatestPlanCheckRun"
+ @close="$emit('close')"
+ />
+ </div>
</template>
<script setup lang="ts">
@@ -39,10 +29,11 @@ import { useI18n } from "vue-i18n";
import { databaseForTask, useIssueContext } from "@/components/IssueV1/logic";
import type { TabFilterItem } from "@/components/v2";
import { TabFilter } from "@/components/v2";
-import type {
- PlanCheckRun,
+import {
+ PlanCheckRun_Result_Status,
PlanCheckRun_Type,
- Task,
+ type PlanCheckRun,
+ type Task,
} from "@/types/proto/v1/rollout_service";
import { humanizeDate } from "@/utils";
import PlanCheckBadgeBar from "./PlanCheckBadgeBar.vue";
@@ -50,22 +41,42 @@ import PlanCheckDetail from "./PlanCheckDetail.vue";
const props = defineProps<{
planCheckRunList: PlanCheckRun[];
- selectedType: PlanCheckRun_Type;
+ selectedType?: PlanCheckRun_Type;
task?: Task;
}>();
defineEmits<{
- (event: "select-type", type: PlanCheckRun_Type): void;
(event: "close"): void;
}>();
+const getInitialSelectedType = () => {
+ if (props.selectedType) {
+ return props.selectedType;
+ }
+
+ // Find the first plan check run with error or warning.
+ const planCheck = props.planCheckRunList.find((checkRun) =>
+ [PlanCheckRun_Result_Status.ERROR, PlanCheckRun_Result_Status.WARNING].some(
+ (status) =>
+ checkRun.results.map((result) => result.status).includes(status)
+ )
+ );
+ if (planCheck) {
+ return planCheck.type;
+ }
+ return (
+ first(props.planCheckRunList)?.type ?? PlanCheckRun_Type.TYPE_UNSPECIFIED
+ );
+};
+
const { t } = useI18n();
const { issue } = useIssueContext();
+const selectedTypeRef = ref<PlanCheckRun_Type>(getInitialSelectedType());
const selectedPlanCheckRunList = computed(() => {
return orderBy(
props.planCheckRunList.filter(
- (checkRun) => checkRun.type === props.selectedType
+ (checkRun) => checkRun.type === selectedTypeRef.value
),
(checkRun) => parseInt(checkRun.uid, 10),
"desc"
@@ -83,7 +94,9 @@ const selectedPlanCheckRun = computed(() => {
});
const isLatestPlanCheckRun = computed(() => {
- return selectedPlanCheckRunUID.value === first(selectedPlanCheckRunList.value)?.uid;
+ return (
+ selectedPlanCheckRunUID.value === first(selectedPlanCheckRunList.value)?.uid
+ );
});
const tabItemList = computed(() => {