Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(frontend): extract StageContentSidebar for responsive rollout view (#18239)
boojack419c92c1e94b
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageContentSidebar.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageContentSidebar.vuenew file mode 100644index 0000000000..43f39fed23--- /dev/null+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageContentSidebar.vue@@ -0,0 +1,74 @@+<template>+ <!-- Desktop: Sticky sidebar -->+ <div+ v-if="isWideScreen"+ class="shrink-0 pr-4 self-start sticky top-0 w-64"+ >+ <!-- Rollback action at top -->+ <StageTaskRunsRollback class="px-3 pt-1 pb-2" :stage="stage" />+ <!-- Run history section with border -->+ <div class="border rounded-lg">+ <StageTimeline+ :stage="stage"+ :task-runs="taskRuns"+ mode="sidebar"+ />+ </div>+ </div>++ <!-- Mobile: Drawer trigger button -->+ <template v-else>+ <NButton+ size="small"+ quaternary+ class="!px-2"+ @click="showDrawer = true"+ >+ <template #icon>+ <MenuIcon :size="16" />+ </template>+ </NButton>++ <!-- Mobile drawer -->+ <Drawer v-model:show="showDrawer" placement="right">+ <DrawerContent :title="environment?.title" style="width: 20rem">+ <!-- Rollback action at top -->+ <StageTaskRunsRollback class="pb-3" :stage="stage" />+ <StageTimeline+ :stage="stage"+ :task-runs="taskRuns"+ mode="drawer"+ />+ </DrawerContent>+ </Drawer>+ </template>+</template>++<script lang="ts" setup>+import { useWindowSize } from "@vueuse/core";+import { MenuIcon } from "lucide-vue-next";+import { NButton } from "naive-ui";+import { computed, ref } from "vue";+import { Drawer, DrawerContent } from "@/components/v2";+import { useEnvironmentV1Store } from "@/store";+import type { Stage, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";+import StageTaskRunsRollback from "./StageTaskRunsRollback.vue";+import StageTimeline from "./StageTimeline.vue";++const props = defineProps<{+ stage: Stage | null | undefined;+ taskRuns: TaskRun[];+}>();++const environmentStore = useEnvironmentV1Store();+const { width: windowWidth } = useWindowSize();+const isWideScreen = computed(() => windowWidth.value >= 768);+const showDrawer = ref(false);++const environment = computed(() => {+ if (!props.stage) {+ return null;+ }+ return environmentStore.getEnvironmentByName(props.stage.environment);+});+</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vueindex 1fa6e4e1ca..4e71ea2b6b 100644--- a/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vue+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageContentView.vue@@ -53,22 +53,18 @@</template>{{ $t("rollout.stage.confirm-create") }}</NPopconfirm>+ <!-- Mobile: Timeline drawer trigger (rightmost) -->+ <StageContentSidebar+ v-if="!isWideScreen && isStageCreated(selectedStage)"+ :stage="selectedStage"+ :task-runs="taskRuns"+ /></div></div></div><!-- Main content area: responsive layout -->- <div class="flex" :class="isWideScreen ? 'flex-row' : 'flex-col'">- <!-- Timeline: inline above on narrow screen -->- <div v-if="!isWideScreen && isStageCreated(selectedStage)" class="mb-4">- <StageTimeline- :stage="selectedStage"- :task-runs="taskRuns"- :is-inline="true"- class="border-y"- />- </div>-+ <div class="flex flex-row"><!-- Task list content --><div class="flex-1 min-w-0"><TaskList@@ -79,19 +75,12 @@/></div>- <!-- Timeline: sidebar on wide screen (sticky) -->- <div+ <!-- Desktop: Timeline sidebar -->+ <StageContentSidebarv-if="isWideScreen && isStageCreated(selectedStage)"- class="shrink-0 pr-4 self-start sticky top-0"- >- <div class="w-64 border rounded-lg">- <StageTimeline- :stage="selectedStage"- :task-runs="taskRuns"- :is-inline="false"- />- </div>- </div>+ :stage="selectedStage"+ :task-runs="taskRuns"+ /></div></div>@@ -103,7 +92,7 @@</template><script lang="ts" setup>-import { useMediaQuery } from "@vueuse/core";+import { useWindowSize } from "@vueuse/core";import { PlayIcon, PlusIcon } from "lucide-vue-next";import { NButton, NPopconfirm, NTag } from "naive-ui";import { computed, ref } from "vue";@@ -112,7 +101,7 @@ import { useEnvironmentV1Store } from "@/store";import type { Rollout, Stage } from "@/types/proto-es/v1/rollout_service_pb";import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";import { usePlanContextWithRollout } from "../../../logic";-import StageTimeline from "./StageTimeline.vue";+import StageContentSidebar from "./StageContentSidebar.vue";import TaskFilter from "./TaskFilter.vue";import TaskList from "./TaskList.vue";@@ -130,8 +119,9 @@ defineEmits<{const environmentStore = useEnvironmentV1Store();const filterStatuses = ref<Task_Status[]>([]);-// Responsive layout: sidebar on wide screen, inline on narrow-const isWideScreen = useMediaQuery("(min-width: 1024px)");+// Responsive layout: sidebar on wide screen (>= 768px), drawer on narrow+const { width: windowWidth } = useWindowSize();+const isWideScreen = computed(() => windowWidth.value >= 768);const { taskRuns } = usePlanContextWithRollout();diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageTaskRunsRollback.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageTaskRunsRollback.vueindex a334d6f8f4..f1de06cd4a 100644--- a/frontend/src/components/Plan/components/RolloutView/v2/StageTaskRunsRollback.vue+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageTaskRunsRollback.vue@@ -1,5 +1,5 @@<template>- <div v-if="rollbackableTaskRuns.length > 0" class="px-3 pb-3">+ <div v-if="rollbackableTaskRuns.length > 0"><NButton size="small" text @click="showRollbackDrawer = true"><template #icon><DatabaseBackupIcon :size="16" />diff --git a/frontend/src/components/Plan/components/RolloutView/v2/StageTimeline.vue b/frontend/src/components/Plan/components/RolloutView/v2/StageTimeline.vueindex bfb218ab43..4825d039b2 100644--- a/frontend/src/components/Plan/components/RolloutView/v2/StageTimeline.vue+++ b/frontend/src/components/Plan/components/RolloutView/v2/StageTimeline.vue@@ -2,30 +2,20 @@<div><!-- Header --><div- class="flex items-center justify-between px-3 py-2"- @click="isInline && (isCollapsed = !isCollapsed)"+ class="flex items-center justify-between"+ :class="isSidebarMode ? 'px-3 py-2' : 'pb-2'"><div class="flex items-center gap-2">- <!-- Only show toggle icon in inline mode -->- <component- :is="isCollapsed ? ChevronRightIcon : ChevronDownIcon"- v-if="isInline"- class="w-4 h-4 text-gray-500"- /><span class="text-sm font-medium text-gray-700">{{ $t("task.run-history") }}</span></div></div>- <!-- Rollback entry -->- <StageTaskRunsRollback :stage="stage" />-- <!-- Timeline entries: always show in sidebar mode, toggle in inline mode -->+ <!-- Timeline entries --><div- v-if="isExpanded"- class="overflow-y-auto px-3 pt-1 pb-3"- :class="isInline ? 'max-h-48' : 'max-h-[calc(100vh-300px)]'"+ class="overflow-y-auto pt-1 pb-3"+ :class="isSidebarMode ? 'px-3 max-h-[calc(100vh-300px)]' : 'px-1'"><div v-if="isLoading" class="py-4 flex justify-center"><BBSpin />@@ -132,13 +122,9 @@</template><script lang="ts" setup>-import {- ChevronDownIcon,- ChevronRightIcon,- SquareChartGanttIcon,-} from "lucide-vue-next";+import { SquareChartGanttIcon } from "lucide-vue-next";import { NTimeline, NTimelineItem, NTooltip } from "naive-ui";-import { computed, ref } from "vue";+import { computed, ref, watch } from "vue";import BBSpin from "@/bbkit/BBSpin.vue";import TaskRunDetail from "@/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue";import TimestampDisplay from "@/components/misc/Timestamp.vue";@@ -161,24 +147,41 @@ import {mapTaskRunStatusToTaskStatus,} from "./composables/useTaskRunUtils";import ScheduledTimeIndicator from "./ScheduledTimeIndicator.vue";-import StageTaskRunsRollback from "./StageTaskRunsRollback.vue";const props = withDefaults(defineProps<{stage: Stage | null | undefined;taskRuns: TaskRun[];- isInline?: boolean;+ // "sidebar" - sticky sidebar on desktop with padding and max-height+ // "drawer" - inside a drawer with minimal padding for drawer's own spacing+ mode?: "sidebar" | "drawer";}>(),{- isInline: false,+ mode: "sidebar",});+// Mode-based styling+const isSidebarMode = computed(() => props.mode === "sidebar");+const { project } = useCurrentProjectV1();-const isCollapsed = ref(false);const { navigateToTaskDetail } = useTaskNavigation();const { lastRefreshTime } = useResourcePoller();+// Track stage transitions to prevent flicker+const isStageTransitioning = ref(false);+const lastStageName = ref<string | undefined>(props.stage?.name);++watch(+ () => props.stage?.name,+ (newName) => {+ if (newName !== lastStageName.value) {+ isStageTransitioning.value = true;+ lastStageName.value = newName;+ }+ }+);+// Drawer state for task run detailconst taskRunDetailContext = ref<{show: boolean;@@ -187,9 +190,6 @@ const taskRunDetailContext = ref<{show: false,});-// In sidebar mode (not inline), always show expanded-const isExpanded = computed(() => !props.isInline || !isCollapsed.value);-// Filter task runs for this stageconst stageTaskRuns = computed(() => {if (!props.stage) return [];@@ -200,9 +200,34 @@ const stageTaskRuns = computed(() => {);});-// Check if we're still in initial loading state (never refreshed yet)-const isLoading = computed(- () => lastRefreshTime.value === 0 && stageTaskRuns.value.length === 0+// Check if we're loading (initial load or stage transition)+const isLoading = computed(() => {+ const hasNoRuns = stageTaskRuns.value.length === 0;+ const isInitialLoad = lastRefreshTime.value === 0;+ // Show loading during initial load or stage transition when no runs available+ return hasNoRuns && (isInitialLoad || isStageTransitioning.value);+});++// Clear stage transition flag when we have data for the current stage+watch(+ stageTaskRuns,+ (runs) => {+ if (runs.length > 0) {+ isStageTransitioning.value = false;+ }+ },+ { immediate: true }+);++// Also clear transition flag after a short delay to handle stages with no runs+watch(+ () => props.stage?.name,+ () => {+ // Give time for data to load, then clear transition flag+ setTimeout(() => {+ isStageTransitioning.value = false;+ }, 300);+ });// Maximum number of task runs to display in the timeline