Skip to content

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

feat(plan): redesign plan-detail page layout (#20374)

Danny Xu62a62ec5b5b0
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 300cc66010..9e7d46cc6f 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -261,7 +261,6 @@
"deleted": "Deleted",
"demo-mode": "Demo",
"deny": "Deny",
- "deploying": "Deploying",
"description": "Description",
"detail": "Detail",
"detailed-guide": "detailed guide",
@@ -308,7 +307,6 @@
"id": "ID",
"import": "Import",
"in-progress": "In Progress",
- "in-review": "In Review",
"info": "Info",
"instance": "Instance",
"instances": "Instances",
@@ -1297,6 +1295,9 @@
"self": "Isolation Level"
},
"labels-required-for-review": "Labels are required before requesting review",
+ "meta": {
+ "created-by-at": "Created by {user} · {time}"
+ },
"navigator": {
"changes": "Changes",
"checks": "Checks",
@@ -1335,10 +1336,6 @@
"run": "Run checks",
"select-isolation-level": "Select isolation level",
"select-targets": "Select Targets",
- "sidebar": {
- "created-by-at": "Created by {user} · {time}",
- "future-sections-hint": "Review, Labels, Issue link appear after submission"
- },
"spec": {
"change": "Change",
"type": {
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 7c3378cee7..4239f63ee8 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -261,7 +261,6 @@
"deleted": "Eliminado",
"demo-mode": "Demostración",
"deny": "Denegar",
- "deploying": "Desplegando",
"description": "Descripción",
"detail": "Detalle",
"detailed-guide": "guía detallada",
@@ -308,7 +307,6 @@
"id": "ID",
"import": "Importar",
"in-progress": "En progreso",
- "in-review": "En revisión",
"info": "Información",
"instance": "Instancia",
"instances": "Instancias",
@@ -1297,6 +1295,9 @@
"self": "Nivel de Aislamiento"
},
"labels-required-for-review": "Se requieren etiquetas antes de solicitar revisión",
+ "meta": {
+ "created-by-at": "Creado por {user} · {time}"
+ },
"navigator": {
"changes": "Cambios",
"checks": "Verificaciones",
@@ -1335,10 +1336,6 @@
"run": "Volver a verificar",
"select-isolation-level": "Seleccionar nivel de aislamiento",
"select-targets": "Seleccionar objetivos",
- "sidebar": {
- "created-by-at": "Creado por {user} · {time}",
- "future-sections-hint": "Revisión, etiquetas y enlace del issue aparecen después del envío"
- },
"spec": {
"change": "Cambiar",
"type": {
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index f3096cb34e..e4fc095b49 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -261,7 +261,6 @@
"deleted": "削除されました",
"demo-mode": "デモモード",
"deny": "拒否",
- "deploying": "デプロイ中",
"description": "説明",
"detail": "詳細",
"detailed-guide": "詳細ガイド",
@@ -308,7 +307,6 @@
"id": "ID",
"import": "輸入",
"in-progress": "進行中",
- "in-review": "レビュー中",
"info": "情報",
"instance": "インスタンス",
"instances": "インスタンス",
@@ -1297,6 +1295,9 @@
"self": "分離レベル"
},
"labels-required-for-review": "レビューをリクエストする前にラベルが必要です",
+ "meta": {
+ "created-by-at": "{user} が作成 · {time}"
+ },
"navigator": {
"changes": "変更点",
"checks": "チェック",
@@ -1335,10 +1336,6 @@
"run": "再チェック",
"select-isolation-level": "分離レベルを選択",
"select-targets": "ターゲットを選択",
- "sidebar": {
- "created-by-at": "{user} が作成 · {time}",
- "future-sections-hint": "レビュー、ラベル、Issue リンクは送信後に表示されます"
- },
"spec": {
"change": "変化",
"type": {
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 6e404d63fb..4c0a01b617 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -261,7 +261,6 @@
"deleted": "Đã xóa",
"demo-mode": "Chế độ Demo",
"deny": "Từ chối",
- "deploying": "Đang triển khai",
"description": "Mô tả",
"detail": "Chi tiết",
"detailed-guide": "Hướng dẫn chi tiết",
@@ -308,7 +307,6 @@
"id": "ID",
"import": "Nhập",
"in-progress": "Đang tiến hành",
- "in-review": "Đang xem xét",
"info": "Thông tin",
"instance": "Phiên bản",
"instances": "Phiên bản",
@@ -1297,6 +1295,9 @@
"self": "Mức Độ Cô Lập"
},
"labels-required-for-review": "Cần có nhãn trước khi yêu cầu xem xét",
+ "meta": {
+ "created-by-at": "Tạo bởi {user} · {time}"
+ },
"navigator": {
"changes": "Thay đổi",
"checks": "Kiểm tra",
@@ -1335,10 +1336,6 @@
"run": "Kiểm tra lại",
"select-isolation-level": "Chọn mức độ cô lập",
"select-targets": "Chọn mục tiêu",
- "sidebar": {
- "created-by-at": "Tạo bởi {user} · {time}",
- "future-sections-hint": "Xem xét, nhãn và liên kết issue sẽ xuất hiện sau khi gửi"
- },
"spec": {
"change": "Thay đổi",
"type": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index ac917b0c81..487ab97e66 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -261,7 +261,6 @@
"deleted": "已删除",
"demo-mode": "演示模式",
"deny": "拒绝",
- "deploying": "部署中",
"description": "描述",
"detail": "详情",
"detailed-guide": "详细指南",
@@ -308,7 +307,6 @@
"id": "ID",
"import": "导入",
"in-progress": "进行中",
- "in-review": "审批中",
"info": "信息",
"instance": "实例",
"instances": "实例",
@@ -1297,6 +1295,9 @@
"self": "隔离级别"
},
"labels-required-for-review": "提交审批前需要选择标签",
+ "meta": {
+ "created-by-at": "由 {user} 创建 · {time}"
+ },
"navigator": {
"changes": "变更项",
"checks": "SQL 检查",
@@ -1335,10 +1336,6 @@
"run": "重新检查",
"select-isolation-level": "选择隔离级别",
"select-targets": "选择目标库",
- "sidebar": {
- "created-by-at": "由 {user} 创建 · {time}",
- "future-sections-hint": "审批、标签、工单链接将在提交后显示"
- },
"spec": {
"change": "变更项",
"type": {
diff --git a/frontend/src/react/locales/en-US.json b/frontend/src/react/locales/en-US.json
index bf2ae5b468..a792399e9d 100644
--- a/frontend/src/react/locales/en-US.json
+++ b/frontend/src/react/locales/en-US.json
@@ -360,6 +360,7 @@
"reject": "Reject",
"rejected": "Rejected",
"release": "Release",
+ "remove": "Remove",
"reorder": "Reorder",
"required-permission": "Required permissions",
"required-workspace-permission": "Following permissions are required to initialize the workspace UX",
@@ -450,7 +451,6 @@
"common.archived": "Archived",
"common.back-to-workspace": "Back to workspace",
"common.cancel": "Cancel",
- "common.canceled": "Canceled",
"common.cannot-undo-this-action": "You cannot undo this action",
"common.catalog": "Catalog",
"common.close": "Close",
@@ -472,7 +472,6 @@
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Deleted",
"common.demo-mode": "Demo",
- "common.deploying": "Deploying",
"common.detail": "Detail",
"common.detailed-guide": "detailed guide",
"common.edit": "Edit",
@@ -480,7 +479,6 @@
"common.environment": "Environment",
"common.import": "Import",
"common.in-progress": "In progress",
- "common.in-review": "In Review",
"common.issue": "Issue",
"common.key": "Key",
"common.labels": "Labels",
@@ -1583,6 +1581,9 @@
"editor": {
"save-changes-before-continuing": "Please save or cancel your changes before continuing"
},
+ "meta": {
+ "created-by-at": "Created by {{user}} · {{time}}"
+ },
"navigator": {
"changes": "Changes",
"deploy": "Deploy",
@@ -1590,10 +1591,6 @@
},
"new-plan": "New Plan",
"plans": "Plans",
- "sidebar": {
- "created-by-at": "Created by {{user}} · {{time}}",
- "future-sections-hint": "Review, labels, and rollout details appear after submission"
- },
"subtitle": "Draft database changes and run pre-checks before creating an issue for approval.",
"targets": {
"title": "Targets"
diff --git a/frontend/src/react/locales/es-ES.json b/frontend/src/react/locales/es-ES.json
index 998b3766e2..6571d387f5 100644
--- a/frontend/src/react/locales/es-ES.json
+++ b/frontend/src/react/locales/es-ES.json
@@ -354,6 +354,7 @@
"reject": "Reject",
"rejected": "Rechazado",
"release": "Versión",
+ "remove": "Eliminar",
"reorder": "Reordenar",
"required-permission": "Permisos necesarios",
"required-workspace-permission": "Se requieren los siguientes permisos para inicializar el espacio de trabajo UX",
@@ -443,7 +444,6 @@
"common.archived": "Archivada",
"common.back-to-workspace": "Back to workspace",
"common.cancel": "Cancelar",
- "common.canceled": "Cancelado",
"common.cannot-undo-this-action": "No se puede deshacer esta acción",
"common.catalog": "Catálogo",
"common.close": "Cerrar",
@@ -465,7 +465,6 @@
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Eliminado",
"common.demo-mode": "Demo",
- "common.deploying": "Desplegando",
"common.detail": "Detail",
"common.detailed-guide": "guía detallada",
"common.edit": "Editar",
@@ -473,7 +472,6 @@
"common.environment": "Entorno",
"common.import": "Importar",
"common.in-progress": "En progreso",
- "common.in-review": "En revisión",
"common.issue": "Issue",
"common.key": "Clave",
"common.labels": "Etiquetas",
@@ -1575,6 +1573,9 @@
"editor": {
"save-changes-before-continuing": "Guarde o cancele sus cambios antes de continuar."
},
+ "meta": {
+ "created-by-at": "Creado por {{user}} · {{time}}"
+ },
"navigator": {
"changes": "Cambios",
"deploy": "Desplegar",
@@ -1582,10 +1583,6 @@
},
"new-plan": "Nuevo plan",
"plans": "Planes",
- "sidebar": {
- "created-by-at": "Creado por {{user}} · {{time}}",
- "future-sections-hint": "La revisión, las etiquetas y el despliegue aparecen después del envío"
- },
"subtitle": "Redactar cambios en la base de datos y ejecutar comprobaciones previas antes de crear un problema para su aprobación.",
"targets": {
"title": "Objetivos"
diff --git a/frontend/src/react/locales/ja-JP.json b/frontend/src/react/locales/ja-JP.json
index 49727c81df..39578c7459 100644
--- a/frontend/src/react/locales/ja-JP.json
+++ b/frontend/src/react/locales/ja-JP.json
@@ -354,6 +354,7 @@
"reject": "Reject",
"rejected": "却下",
"release": "リリース",
+ "remove": "削除",
"reorder": "並び替え",
"required-permission": "必要な権限",
"required-workspace-permission": "ワークスペース UX の初期化には以下の権限が必要です",
@@ -443,7 +444,6 @@
"common.archived": "アーカイブ済み",
"common.back-to-workspace": "Back to workspace",
"common.cancel": "キャンセル",
- "common.canceled": "キャンセル",
"common.cannot-undo-this-action": "この操作は元に戻せません",
"common.catalog": "カタログ",
"common.close": "閉じる",
@@ -465,7 +465,6 @@
"common.delete-resource": "Delete {{type}}",
"common.deleted": "削除されました",
"common.demo-mode": "Demo",
- "common.deploying": "デプロイ中",
"common.detail": "Detail",
"common.detailed-guide": "詳細ガイド",
"common.edit": "編集",
@@ -473,7 +472,6 @@
"common.environment": "環境",
"common.import": "インポート",
"common.in-progress": "進行中",
- "common.in-review": "レビュー中",
"common.issue": "Issue",
"common.key": "キー",
"common.labels": "ラベル",
@@ -1575,6 +1573,9 @@
"editor": {
"save-changes-before-continuing": "続行する前に変更を保存またはキャンセルしてください"
},
+ "meta": {
+ "created-by-at": "{{user}} が作成 · {{time}}"
+ },
"navigator": {
"changes": "変更点",
"deploy": "デプロイ",
@@ -1582,10 +1583,6 @@
},
"new-plan": "プランの作成",
"plans": "プラン",
- "sidebar": {
- "created-by-at": "{{user}} が作成 · {{time}}",
- "future-sections-hint": "送信後にレビュー、ラベル、デプロイ情報が表示されます"
- },
"subtitle": "承認のためにイシューを作成する前に、データベースの変更を下書きし、事前チェックを実行します。",
"targets": {
"title": "ターゲット"
diff --git a/frontend/src/react/locales/vi-VN.json b/frontend/src/react/locales/vi-VN.json
index e9180b9ed5..d9bc265614 100644
--- a/frontend/src/react/locales/vi-VN.json
+++ b/frontend/src/react/locales/vi-VN.json
@@ -354,6 +354,7 @@
"reject": "Reject",
"rejected": "Đã từ chối",
"release": "Phiên bản",
+ "remove": "Gỡ bỏ",
"reorder": "Sắp xếp lại",
"required-permission": "Quyền hạn cần thiết",
"required-workspace-permission": "Các quyền sau đây cần thiết để khởi tạo không gian làm việc UX",
@@ -443,7 +444,6 @@
"common.archived": "Đã lưu trữ",
"common.back-to-workspace": "Back to workspace",
"common.cancel": "Hủy",
- "common.canceled": "Đã hủy",
"common.cannot-undo-this-action": "Bạn không thể hoàn tác hành động này.",
"common.catalog": "Danh mục",
"common.close": "Đóng",
@@ -465,7 +465,6 @@
"common.delete-resource": "Delete {{type}}",
"common.deleted": "Đã xóa",
"common.demo-mode": "Demo",
- "common.deploying": "Đang triển khai",
"common.detail": "Detail",
"common.detailed-guide": "Hướng dẫn chi tiết",
"common.edit": "Chỉnh sửa",
@@ -473,7 +472,6 @@
"common.environment": "Môi trường",
"common.import": "Nhập",
"common.in-progress": "Đang thực hiện",
- "common.in-review": "Đang xem xét",
"common.issue": "Issue",
"common.key": "Khóa",
"common.labels": "Nhãn",
@@ -1575,6 +1573,9 @@
"editor": {
"save-changes-before-continuing": "Vui lòng lưu hoặc hủy thay đổi của bạn trước khi tiếp tục"
},
+ "meta": {
+ "created-by-at": "Tạo bởi {{user}} · {{time}}"
+ },
"navigator": {
"changes": "Thay đổi",
"deploy": "Triển khai",
@@ -1582,10 +1583,6 @@
},
"new-plan": "Kế hoạch mới",
"plans": "Kế hoạch",
- "sidebar": {
- "created-by-at": "Tạo bởi {{user}} · {{time}}",
- "future-sections-hint": "Sau khi gửi sẽ hiển thị review, nhãn và thông tin triển khai"
- },
"subtitle": "Soạn thảo các thay đổi cơ sở dữ liệu và chạy các bước kiểm tra sơ bộ trước khi tạo vấn đề để phê duyệt.",
"targets": {
"title": "Mục tiêu"
diff --git a/frontend/src/react/locales/zh-CN.json b/frontend/src/react/locales/zh-CN.json
index 69b6b3202c..1523716da3 100644
--- a/frontend/src/react/locales/zh-CN.json
+++ b/frontend/src/react/locales/zh-CN.json
@@ -354,6 +354,7 @@
"reject": "驳回",
"rejected": "已拒绝",
"release": "版本",
+ "remove": "移除",
"reorder": "排序",
"required-permission": "所需权限",
"required-workspace-permission": "初始化工作空间 UX 需要以下权限",
@@ -443,7 +444,6 @@
"common.archived": "已归档",
"common.back-to-workspace": "Back to workspace",
"common.cancel": "取消",
- "common.canceled": "已取消",
"common.cannot-undo-this-action": "这个操作无法撤销",
"common.catalog": "Catalog",
"common.close": "关闭",
@@ -465,7 +465,6 @@
"common.delete-resource": "删除{{type}}",
"common.deleted": "已删除",
"common.demo-mode": "Demo",
- "common.deploying": "部署中",
"common.detail": "Detail",
"common.detailed-guide": "详细指南",
"common.edit": "编辑",
@@ -473,7 +472,6 @@
"common.environment": "环境",
"common.import": "导入",
"common.in-progress": "进行中",
- "common.in-review": "审批中",
"common.issue": "工单",
"common.key": "键",
"common.labels": "标签",
@@ -1575,6 +1573,9 @@
"editor": {
"save-changes-before-continuing": "请保存或取消更改,然后再继续"
},
+ "meta": {
+ "created-by-at": "由 {{user}} 创建 · {{time}}"
+ },
"navigator": {
"changes": "变更项",
"deploy": "部署",
@@ -1582,10 +1583,6 @@
},
"new-plan": "创建变更计划",
"plans": "变更计划",
- "sidebar": {
- "created-by-at": "由 {{user}} 创建 · {{time}}",
- "future-sections-hint": "提交后会显示审批、标签和部署信息"
- },
"subtitle": "草拟数据库变更并运行预检查,然后创建工单以请求审批。",
"targets": {
"title": "目标库"
diff --git a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
index 50ad0b3cf0..03560d5768 100644
--- a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
+++ b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.test.tsx
@@ -105,13 +105,8 @@ vi.mock("./components/PlanDetailHeader", () => ({
PlanDetailHeader: () => null,
}));
-vi.mock("./components/PlanDetailMetadataSidebar", () => ({
- PlanDetailMetadataSidebar: () => null,
-}));
-
vi.mock("./shell/constants", () => ({
- SIDEBAR_WIDTH_NARROW_PX: 320,
- WIDE_SIDEBAR_BREAKPOINT_PX: 1024,
+ INLINE_TASK_PANEL_BREAKPOINT_PX: 1024,
}));
vi.mock("./shell/hooks/usePlanDetailPage", () => ({
@@ -150,14 +145,11 @@ const buildPage = (): PlanDetailPageState =>
closeTaskPanel: vi.fn(),
containerWidth: 1200,
currentUser: { name: "users/[email protected]" },
- desktopSidebarWidth: 320,
expandPhase: vi.fn(),
isCreating: true,
isEditing: false,
isInitializing: false,
isRefreshing: false,
- lastRefreshTime: 0,
- mobileSidebarOpen: false,
pageKey: "foo/create/spec-1",
patchState: vi.fn(),
pendingLeaveConfirm: false,
@@ -184,8 +176,7 @@ const buildPage = (): PlanDetailPageState =>
routePhase: "changes",
selectedTaskName: undefined,
setEditing: vi.fn(),
- setMobileSidebarOpen: vi.fn(),
- sidebarMode: "NONE",
+ layoutMode: "NONE",
taskRuns: [],
togglePhase: vi.fn(),
}) as unknown as PlanDetailPageState;
diff --git a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
index 3c82583cce..8efe679047 100644
--- a/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
+++ b/frontend/src/react/pages/project/plan-detail/ProjectPlanDetailPage.tsx
@@ -27,12 +27,8 @@ import { PlanDetailReviewApprovalFlow } from "./components/PlanDetailApprovalFlo
import { PlanDetailChangesBranch } from "./components/PlanDetailChangesBranch";
import { PlanDetailDeployFuture } from "./components/PlanDetailDeployFuture";
import { PlanDetailHeader } from "./components/PlanDetailHeader";
-import { PlanDetailMetadataSidebar } from "./components/PlanDetailMetadataSidebar";
import { PlanDetailStoreProvider } from "./shared/stores/PlanDetailStoreProvider";
-import {
- SIDEBAR_WIDTH_NARROW_PX,
- WIDE_SIDEBAR_BREAKPOINT_PX,
-} from "./shell/constants";
+import { INLINE_TASK_PANEL_BREAKPOINT_PX } from "./shell/constants";
import { usePlanDetailPage } from "./shell/hooks/usePlanDetailPage";
import {
PlanDetailProvider,
@@ -97,29 +93,17 @@ function ProjectPlanDetailPageInner({
return undefined;
}, [page.rollout, page.routeTaskId]);
const supportsInlineDetailPanel =
- page.sidebarMode === "DESKTOP" &&
- page.containerWidth >= WIDE_SIDEBAR_BREAKPOINT_PX;
- const showDesktopSidebar = page.sidebarMode === "DESKTOP" && !selectedTask;
+ page.layoutMode === "DESKTOP" &&
+ page.containerWidth >= INLINE_TASK_PANEL_BREAKPOINT_PX;
const showDesktopDetail = supportsInlineDetailPanel && !!selectedTask;
const showTaskDrawer =
- !!selectedTask && !showDesktopDetail && page.sidebarMode !== "NONE";
- const showMobileSidebar = page.sidebarMode === "MOBILE";
+ !!selectedTask && !showDesktopDetail && page.layoutMode !== "NONE";
- const desktopSidebarStyle = useMemo(
- () => ({
- width: `${page.desktopSidebarWidth || SIDEBAR_WIDTH_NARROW_PX}px`,
- }),
- [page.desktopSidebarWidth]
- );
const desktopLayoutStyle = useMemo<CSSProperties>(() => {
const baseStyle: CSSProperties = {
minHeight: "calc(100vh - 4rem)",
};
- if (page.sidebarMode !== "DESKTOP") {
- return baseStyle;
- }
-
if (showDesktopDetail) {
return {
...baseStyle,
@@ -127,20 +111,8 @@ function ProjectPlanDetailPageInner({
};
}
- if (showDesktopSidebar) {
- return {
- ...baseStyle,
- gridTemplateColumns: `minmax(0, 1fr) ${page.desktopSidebarWidth || SIDEBAR_WIDTH_NARROW_PX}px`,
- };
- }
-
return baseStyle;
- }, [
- page.desktopSidebarWidth,
- page.sidebarMode,
- showDesktopDetail,
- showDesktopSidebar,
- ]);
+ }, [showDesktopDetail]);
const phaseConfigs = useMemo(() => {
const hasIssue = !!page.issue;
const hasRollout = !!page.rollout;
@@ -340,14 +312,6 @@ function ProjectPlanDetailPageInner({
</div>
</main>
- {showDesktopSidebar && (
- <DesktopColumn tag="aside" style={desktopSidebarStyle}>
- <div className="p-4">
- <PlanDetailMetadataSidebar />
- </div>
- </DesktopColumn>
- )}
-
{showDesktopDetail && selectedTask && (
<DesktopColumn
header={
@@ -379,23 +343,6 @@ function ProjectPlanDetailPageInner({
</div>
)}
- <Sheet
- onOpenChange={page.setMobileSidebarOpen}
- open={showMobileSidebar && page.mobileSidebarOpen}
- >
- <SheetContent
- className="w-[20rem] max-w-[calc(100vw-2rem)]"
- width="standard"
- >
- <SheetHeader>
- <SheetTitle>{t("common.detail")}</SheetTitle>
- </SheetHeader>
- <SheetBody className="p-4">
- <PlanDetailMetadataSidebar />
- </SheetBody>
- </SheetContent>
- </Sheet>
-
<Sheet
onOpenChange={(open) => {
if (!open) {
@@ -582,20 +529,16 @@ function ReviewBranch() {
function DesktopColumn({
children,
header,
- style,
- tag: Tag = "div",
}: {
children: ReactNode;
header?: ReactNode;
- style?: CSSProperties;
- tag?: "aside" | "div";
}) {
return (
- <Tag className="min-w-0 border-l bg-white" style={style}>
+ <div className="min-w-0 border-l bg-white">
<div className="sticky top-0 flex max-h-[calc(100vh-4rem)] min-h-[calc(100vh-4rem)] flex-col overflow-hidden">
{header ? <div className="shrink-0">{header}</div> : null}
<div className="min-h-0 flex-1 overflow-y-auto">{children}</div>
</div>
- </Tag>
+ </div>
);
}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailAggregateChecks.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailAggregateChecks.tsx
new file mode 100644
index 0000000000..c06b4d1d48
--- /dev/null
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailAggregateChecks.tsx
@@ -0,0 +1,43 @@
+import { useMemo } from "react";
+import { PlanCheckSection } from "@/react/components/plan-check/PlanCheckSection";
+import { usePlanCheckActions } from "../hooks/usePlanCheckActions";
+import { usePlanDetailContext } from "../shell/PlanDetailContext";
+import { getPlanCheckSummaryWithFallback } from "../utils/planCheck";
+
+// Plan-wide checks rendered as a verdict-line footer at the bottom of the
+// CHANGES phase card, so reviewers can scan aggregate check status across
+// every spec without clicking into each tab. Drill-down details still live
+// in the PlanCheckSection drawer. Create mode renders nothing here — there
+// is no plan yet to aggregate against; per-spec PlanDetailDraftChecks
+// covers that case.
+export function PlanDetailAggregateChecks() {
+ const page = usePlanDetailContext();
+ const { allowRunChecks, isRunningChecks, refreshChecks, runChecks } =
+ usePlanCheckActions();
+ const summary = useMemo(
+ () =>
+ getPlanCheckSummaryWithFallback(
+ page.planCheckRuns,
+ page.plan.planCheckRunStatusCount
+ ),
+ [page.plan.planCheckRunStatusCount, page.planCheckRuns]
+ );
+
+ if (summary.total === 0 && !allowRunChecks) {
+ return null;
+ }
+
+ return (
+ <div className="border-t px-4 py-4">
+ <PlanCheckSection
+ canRun={allowRunChecks}
+ includeRunFailure
+ isRunning={isRunningChecks}
+ onRefreshOnOpen={refreshChecks}
+ onRun={runChecks}
+ planCheckRuns={page.planCheckRuns}
+ summaryOverride={summary}
+ />
+ </div>
+ );
+}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailApprovalFlow.test.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailApprovalFlow.test.tsx
index 37f12ca5c6..ac7ff5a1b1 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailApprovalFlow.test.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailApprovalFlow.test.tsx
@@ -153,15 +153,12 @@ const makePageState = ({
activePhases: new Set(["review"]),
closeTaskPanel: vi.fn(),
containerWidth: 0,
- desktopSidebarWidth: 0,
expandPhase: vi.fn(),
isCreating: false,
isEditing: false,
isInitializing: false,
isRefreshing: false,
issue,
- lastRefreshTime: 0,
- mobileSidebarOpen: false,
pageKey: "projects/p1/plans/1",
patchState: vi.fn(),
plan: { creator: "users/me", name: "projects/p1/plans/1" },
@@ -179,8 +176,7 @@ const makePageState = ({
routeTaskId: undefined,
selectedTaskName: undefined,
setEditing: vi.fn(),
- setMobileSidebarOpen: vi.fn(),
- sidebarMode: "NONE",
+ layoutMode: "NONE",
specId: undefined,
taskRuns: [],
togglePhase: vi.fn(),
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
index 7d1df3fad0..7bdd761ad5 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.test.tsx
@@ -242,8 +242,8 @@ vi.mock("../utils/specMutation", () => ({
updateSpecSheetWithStatement: vi.fn(),
}));
-vi.mock("./PlanDetailChecks", () => ({
- PlanDetailChecks: () => null,
+vi.mock("./PlanDetailAggregateChecks", () => ({
+ PlanDetailAggregateChecks: () => null,
}));
vi.mock("./PlanDetailDraftChecks", () => ({
@@ -364,15 +364,12 @@ function buildPageState(): PlanDetailPageState {
currentUser: {
name: "users/[email protected]",
} as PlanDetailPageState["currentUser"],
- desktopSidebarWidth: 320,
expandPhase: vi.fn(),
isCreating: true,
isEditing: false,
isInitializing: false,
isRefreshing: false,
isRunningChecks: false,
- lastRefreshTime: 0,
- mobileSidebarOpen: false,
pageKey: "foo/create/spec-1",
patchState: mocks.patchState,
pendingLeaveConfirm: false,
@@ -413,8 +410,7 @@ function buildPageState(): PlanDetailPageState {
selectedTaskName: undefined,
setEditing: vi.fn(),
setIsRunningChecks: vi.fn(),
- setMobileSidebarOpen: vi.fn(),
- sidebarMode: "DESKTOP",
+ layoutMode: "DESKTOP",
taskRuns: [],
togglePhase: vi.fn(),
};
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
index 535510b810..fc87154ee2 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChangesBranch.tsx
@@ -131,7 +131,7 @@ import {
getDatabaseGroupRouteParams,
splitInlineDatabases,
} from "../utils/targets";
-import { PlanDetailChecks } from "./PlanDetailChecks";
+import { PlanDetailAggregateChecks } from "./PlanDetailAggregateChecks";
import { PlanDetailDraftChecks } from "./PlanDetailDraftChecks";
import { PlanDetailStatementSection } from "./PlanDetailStatementSection";
import { PlanDetailTabItem, PlanDetailTabStrip } from "./PlanDetailTabStrip";
@@ -576,22 +576,21 @@ export function PlanDetailChangesBranch({
spec={selectedSpec}
/>
{!specHasRelease &&
- (page.isCreating ? (
- selectedSpec.config.case === "changeDatabaseConfig" ? (
- <PlanDetailDraftChecks
- key={selectedSpec.id}
- checkResults={draftCheckResultsBySpecId[selectedSpec.id]}
- onCheckResultsChange={handleDraftCheckResultsChange}
- selectedSpec={selectedSpec}
- />
- ) : null
- ) : (
- <PlanDetailChecks selectedSpec={selectedSpec} />
- ))}
+ page.isCreating &&
+ selectedSpec.config.case === "changeDatabaseConfig" && (
+ <PlanDetailDraftChecks
+ key={selectedSpec.id}
+ checkResults={draftCheckResultsBySpecId[selectedSpec.id]}
+ onCheckResultsChange={handleDraftCheckResultsChange}
+ selectedSpec={selectedSpec}
+ />
+ )}
{!specHasRelease && <OptionsSection selectedSpec={selectedSpec} />}
</div>
</div>
+ {!page.isCreating && <PlanDetailAggregateChecks />}
+
<TargetSelectorSheet
currentTargets={currentTargets}
onConfirm={handleTargetsUpdate}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChecks.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailChecks.tsx
deleted file mode 100644
index fbd206163f..0000000000
Binary files a/frontend/src/react/pages/project/plan-detail/components/PlanDetailChecks.tsx and /dev/null differ
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
index bce0b6e798..22858954f4 100644
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailHeader.tsx
@@ -1,5 +1,5 @@
import { clone, create } from "@bufbuild/protobuf";
-import { Ban, ChevronUp, Loader2, Menu, Plus } from "lucide-react";
+import { Ban, ChevronUp, Loader2, Plus } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { issueServiceClientConnect, planServiceClientConnect } from "@/connect";
@@ -52,6 +52,7 @@ import {
shouldStayOnPlanDetailPage,
} from "../utils/header";
import { getLocalSheetByName, removeLocalSheet } from "../utils/localSheet";
+import { PlanDetailMeta } from "./PlanDetailMeta";
export function PlanDetailHeader() {
const { t } = useTranslation();
@@ -577,15 +578,6 @@ export function PlanDetailHeader() {
)}
</>
)}
- {page.sidebarMode === "MOBILE" && (
- <Button
- onClick={() => page.setMobileSidebarOpen(true)}
- size="sm"
- variant="ghost"
- >
- <Menu className="h-5 w-5" />
- </Button>
- )}
</div>
</div>
@@ -708,6 +700,8 @@ export function PlanDetailHeader() {
</Button>
) : null}
</div>
+
+ <PlanDetailMeta />
</div>
);
}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailMeta.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailMeta.tsx
new file mode 100644
index 0000000000..afa5d3fe8c
--- /dev/null
+++ b/frontend/src/react/pages/project/plan-detail/components/PlanDetailMeta.tsx
@@ -0,0 +1,231 @@
+import { create } from "@bufbuild/protobuf";
+import { Plus, X } from "lucide-react";
+import { useEffect, useMemo, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { issueServiceClientConnect } from "@/connect";
+import { Checkbox } from "@/react/components/ui/checkbox";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/react/components/ui/popover";
+import { cn } from "@/react/lib/utils";
+import { extractUserEmail, pushNotification } from "@/store";
+import { getTimeForPbTimestampProtoEs } from "@/types";
+import {
+ IssueSchema,
+ IssueStatus,
+ UpdateIssueRequestSchema,
+} from "@/types/proto-es/v1/issue_service_pb";
+import { hasProjectPermissionV2, humanizeTs } from "@/utils";
+import { usePlanDetailContext } from "../shell/PlanDetailContext";
+
+export function PlanDetailMeta() {
+ const { t } = useTranslation();
+ const page = usePlanDetailContext();
+ const { patchState } = page;
+ const project = page.project;
+ const [now, setNow] = useState(Date.now());
+
+ useEffect(() => {
+ if (page.isCreating) return;
+ // Only consumer is the plan-creation timestamp, which never advances
+ // faster than once a minute — no need for a 1s tick.
+ const timer = window.setInterval(() => setNow(Date.now()), 60_000);
+ return () => window.clearInterval(timer);
+ }, [page.isCreating]);
+
+ const creatorEmail = useMemo(
+ () => extractUserEmail(page.plan.creator),
+ [page.plan.creator]
+ );
+ const createdTimeDisplay = useMemo(() => {
+ const ts = getTimeForPbTimestampProtoEs(page.plan.createTime, 0);
+ if (!ts) return "";
+ void now;
+ return humanizeTs(ts / 1000);
+ }, [now, page.plan.createTime]);
+ const allowChangeLabels = useMemo(() => {
+ if (!project || !page.issue || page.issue.status !== IssueStatus.OPEN) {
+ return false;
+ }
+ return hasProjectPermissionV2(project, "bb.issues.update");
+ }, [page.issue, project]);
+
+ if (page.isCreating) {
+ return null;
+ }
+
+ const handleLabelsUpdate = async (labels: string[]) => {
+ if (!page.issue) return;
+ const issuePatch = create(IssueSchema, page.issue);
+ issuePatch.labels = labels;
+ try {
+ const response = await issueServiceClientConnect.updateIssue(
+ create(UpdateIssueRequestSchema, {
+ issue: issuePatch,
+ updateMask: { paths: ["labels"] },
+ })
+ );
+ patchState({ issue: response });
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+ } catch (error) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("common.failed"),
+ description: String(error),
+ });
+ }
+ };
+
+ return (
+ <div className="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-control-placeholder">
+ <span>
+ {t("plan.meta.created-by-at", {
+ time: createdTimeDisplay,
+ user: creatorEmail,
+ })}
+ </span>
+
+ {page.issue && (
+ <>
+ <span aria-hidden="true">·</span>
+ <InlineLabels
+ allowChange={allowChangeLabels}
+ issueLabels={project?.issueLabels ?? []}
+ labels={page.issue.labels || []}
+ onUpdate={handleLabelsUpdate}
+ />
+ </>
+ )}
+ </div>
+ );
+}
+
+function InlineLabels({
+ allowChange,
+ issueLabels,
+ labels,
+ onUpdate,
+}: {
+ allowChange: boolean;
+ issueLabels: Array<{ color: string; value: string }>;
+ labels: string[];
+ onUpdate: (labels: string[]) => Promise<void>;
+}) {
+ const { t } = useTranslation();
+ const [open, setOpen] = useState(false);
+ const [isUpdating, setIsUpdating] = useState(false);
+
+ const toggleLabel = async (value: string) => {
+ const next = labels.includes(value)
+ ? labels.filter((label) => label !== value)
+ : [...labels, value];
+ try {
+ setIsUpdating(true);
+ await onUpdate(next);
+ } finally {
+ setIsUpdating(false);
+ }
+ };
+
+ const chips = labels.map((value) => {
+ const option = issueLabels.find((item) => item.value === value);
+ return (
+ <span
+ key={value}
+ className="inline-flex items-center gap-1 rounded-xs bg-control-bg px-1.5 py-0.5 text-xs text-control"
+ >
+ <span
+ className="size-2.5 shrink-0 rounded-sm"
+ style={{ backgroundColor: option?.color }}
+ />
+ <span className="truncate">{value}</span>
+ {allowChange && (
+ <button
+ aria-label={t("common.remove")}
+ className={cn(
+ "inline-flex shrink-0 items-center justify-center text-control-placeholder transition-colors",
+ isUpdating
+ ? "cursor-not-allowed opacity-60"
+ : "hover:text-control"
+ )}
+ disabled={isUpdating}
+ onClick={() => void toggleLabel(value)}
+ type="button"
+ >
+ <X className="size-3" />
+ </button>
+ )}
+ </span>
+ );
+ });
+
+ const triggerDisabled = !allowChange || isUpdating;
+
+ return (
+ <div className="flex flex-wrap items-center gap-1">
+ {chips}
+ <Popover open={open} onOpenChange={allowChange ? setOpen : undefined}>
+ <PopoverTrigger
+ render={
+ <button
+ className={cn(
+ "inline-flex items-center gap-1 rounded-xs border border-dashed border-control-border px-1.5 py-0.5 text-xs text-control-placeholder transition-colors",
+ allowChange &&
+ !isUpdating &&
+ "hover:border-control hover:text-control",
+ triggerDisabled && "cursor-not-allowed opacity-60"
+ )}
+ disabled={triggerDisabled}
+ type="button"
+ />
+ }
+ >
+ <Plus className="size-3" />
+ <span>{t("issue.labels")}</span>
+ </PopoverTrigger>
+ <PopoverContent
+ side="bottom"
+ align="start"
+ initialFocus={false}
+ finalFocus={false}
+ className="w-56 overflow-hidden bg-white p-0"
+ >
+ <div className="max-h-60 overflow-y-auto">
+ {issueLabels.length === 0 ? (
+ <div className="px-3 py-6 text-sm text-control-placeholder">
+ {t("common.no-data")}
+ </div>
+ ) : (
+ issueLabels.map((option) => {
+ const isSelected = labels.includes(option.value);
+ return (
+ <button
+ key={option.value}
+ className="flex w-full items-center gap-x-2 px-3 py-2 text-left text-sm transition-colors hover:bg-control-bg"
+ disabled={isUpdating}
+ onClick={() => void toggleLabel(option.value)}
+ type="button"
+ >
+ <Checkbox checked={isSelected} />
+ <span
+ className="size-4 shrink-0 rounded-sm"
+ style={{ backgroundColor: option.color }}
+ />
+ <span>{option.value}</span>
+ </button>
+ );
+ })
+ )}
+ </div>
+ </PopoverContent>
+ </Popover>
+ </div>
+ );
+}
diff --git a/frontend/src/react/pages/project/plan-detail/components/PlanDetailMetadataSidebar.tsx b/frontend/src/react/pages/project/plan-detail/components/PlanDetailMetadataSidebar.tsx
deleted file mode 100644
index 5ffffd33f5..0000000000
--- a/frontend/src/react/pages/project/plan-detail/components/PlanDetailMetadataSidebar.tsx
+++ /dev/null
@@ -1,371 +0,0 @@
-import { create } from "@bufbuild/protobuf";
-import { RefreshCw } from "lucide-react";
-import { useEffect, useMemo, useState } from "react";
-import { useTranslation } from "react-i18next";
-import { issueServiceClientConnect } from "@/connect";
-import { PlanCheckSection } from "@/react/components/plan-check/PlanCheckSection";
-import { Button } from "@/react/components/ui/button";
-import { Checkbox } from "@/react/components/ui/checkbox";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/react/components/ui/popover";
-import { Tooltip } from "@/react/components/ui/tooltip";
-import { cn } from "@/react/lib/utils";
-import {
- extractUserEmail,
- pushNotification,
- useEnvironmentV1Store,
-} from "@/store";
-import { getTimeForPbTimestampProtoEs } from "@/types";
-import {
- IssueSchema,
- IssueStatus,
- UpdateIssueRequestSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- formatAbsoluteDateTime,
- getStageStatus,
- hasProjectPermissionV2,
- humanizeTs,
-} from "@/utils";
-import { usePlanCheckActions } from "../hooks/usePlanCheckActions";
-import { usePlanDetailContext } from "../shell/PlanDetailContext";
-import { getPlanCheckSummaryWithFallback } from "../utils/planCheck";
-import { getPlanDetailSidebarStatusInfo } from "../utils/sidebarStatus";
-import { PlanDetailSidebarApprovalFlow } from "./PlanDetailApprovalFlow";
-
-export function PlanDetailMetadataSidebar() {
- const { t } = useTranslation();
- const page = usePlanDetailContext();
- const { patchState, refreshState } = page;
- const environmentStore = useEnvironmentV1Store();
- const project = page.project;
- const [now, setNow] = useState(Date.now());
-
- useEffect(() => {
- const timer = window.setInterval(() => setNow(Date.now()), 1000);
- return () => window.clearInterval(timer);
- }, []);
-
- const creatorEmail = useMemo(
- () => extractUserEmail(page.plan.creator),
- [page.plan.creator]
- );
- const createdTimeDisplay = useMemo(() => {
- const ts = getTimeForPbTimestampProtoEs(page.plan.createTime, 0);
- if (!ts) return "";
- void now;
- return humanizeTs(ts / 1000);
- }, [now, page.plan.createTime]);
- const statusInfo = useMemo(() => {
- return getPlanDetailSidebarStatusInfo({
- isCreating: page.isCreating,
- issue: page.issue,
- planState: page.plan.state,
- rollout: page.rollout,
- t,
- });
- }, [page.isCreating, page.issue, page.plan.state, page.rollout, t]);
- const planCheckSummary = useMemo(
- () =>
- getPlanCheckSummaryWithFallback(
- page.planCheckRuns,
- page.plan.planCheckRunStatusCount
- ),
- [page.plan.planCheckRunStatusCount, page.planCheckRuns]
- );
- const { allowRunChecks, isRunningChecks, refreshChecks, runChecks } =
- usePlanCheckActions();
- const allowChangeLabels = useMemo(() => {
- if (!project || !page.issue || page.issue.status !== IssueStatus.OPEN) {
- return false;
- }
- return hasProjectPermissionV2(project, "bb.issues.update");
- }, [page.issue, project]);
- const lastRefreshDisplay = useMemo(() => {
- if (!page.lastRefreshTime) return "";
- void now;
- const diff = Date.now() - page.lastRefreshTime;
- if (diff < 3_600_000) {
- return humanizeTs(Math.floor(page.lastRefreshTime / 1000));
- }
- return formatAbsoluteDateTime(page.lastRefreshTime);
- }, [now, page.lastRefreshTime]);
-
- return (
- <div className="flex w-full shrink-0 flex-col text-sm">
- <div className="flex flex-col gap-3 pb-3">
- {!page.isCreating && (
- <div className="flex flex-col">
- <p className="text-xs text-control-placeholder">
- {t("plan.sidebar.created-by-at", {
- time: createdTimeDisplay,
- user: creatorEmail,
- })}
- </p>
- </div>
- )}
-
- <div>
- <h4 className="mb-1 textinfolabel">{t("common.status")}</h4>
- <div className="flex items-center gap-2">
- <div
- className={cn("h-2.5 w-2.5 rounded-full", statusInfo.dotClass)}
- />
- <span className="text-sm font-medium text-main">
- {statusInfo.label}
- </span>
- </div>
- </div>
-
- {planCheckSummary.total > 0 && (
- <PlanCheckSection
- canRun={allowRunChecks}
- headingClassName="textinfolabel"
- includeRunFailure
- isRunning={isRunningChecks}
- onRefreshOnOpen={refreshChecks}
- onRun={runChecks}
- planCheckRuns={page.planCheckRuns}
- summaryOverride={planCheckSummary}
- />
- )}
- </div>
-
- {page.issue && (
- <div className="flex flex-col gap-3 border-t py-3">
- <PlanDetailSidebarApprovalFlow />
- <IssueLabelsSection
- issueLabels={project?.issueLabels ?? []}
- labels={page.issue.labels || []}
- allowChange={allowChangeLabels}
- onUpdate={async (labels) => {
- const issuePatch = create(IssueSchema, page.issue);
- issuePatch.labels = labels;
- try {
- const response = await issueServiceClientConnect.updateIssue(
- create(UpdateIssueRequestSchema, {
- issue: issuePatch,
- updateMask: { paths: ["labels"] },
- })
- );
- patchState({ issue: response });
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- } catch (error) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.failed"),
- description: String(error),
- });
- }
- }}
- />
- </div>
- )}
-
- {page.rollout && page.rollout.stages.length > 0 && (
- <div className="flex flex-col gap-3 border-t py-3">
- <h4 className="textinfolabel">
- {t("rollout.stage.self", { count: 2 })}
- </h4>
- {page.rollout.stages.map((stage) => {
- const completed = stage.tasks.filter(
- (task) =>
- task.status === Task_Status.DONE ||
- task.status === Task_Status.SKIPPED
- ).length;
- const env = environmentStore.getEnvironmentByName(
- stage.environment
- );
- const stageStatus = getStageStatus(stage);
- return (
- <div key={stage.name} className="flex items-center gap-2">
- <StageStatusDot status={stageStatus} />
- <span className="text-main">{env.title}</span>
- <span className="text-control-placeholder">
- ({completed}/{stage.tasks.length})
- </span>
- </div>
- );
- })}
- </div>
- )}
-
- {!page.issue && (
- <div className="border-t pt-3">
- <p className="text-sm text-control-placeholder">
- {t("plan.sidebar.future-sections-hint")}
- </p>
- </div>
- )}
-
- {!page.isCreating && (
- <div className="pt-1">
- <div className="hidden items-center gap-2 sm:flex">
- {lastRefreshDisplay && (
- <Tooltip content={formatAbsoluteDateTime(page.lastRefreshTime)}>
- <span className="text-xs text-gray-400">
- {lastRefreshDisplay}
- </span>
- </Tooltip>
- )}
- <Button
- className="opacity-60"
- disabled={page.isRefreshing}
- onClick={() => void refreshState()}
- size="xs"
- variant="ghost"
- >
- <RefreshCw
- className={cn("h-3 w-3", page.isRefreshing && "animate-spin")}
- />
- <span>{t("common.refresh")}</span>
- </Button>
- </div>
- </div>
- )}
- </div>
- );
-}
-
-function IssueLabelsSection({
- allowChange,
- issueLabels,
- labels,
- onUpdate,
-}: {
- allowChange: boolean;
- issueLabels: Array<{ color: string; value: string }>;
- labels: string[];
- onUpdate: (labels: string[]) => Promise<void>;
-}) {
- const { t } = useTranslation();
- const [open, setOpen] = useState(false);
- const [isUpdating, setIsUpdating] = useState(false);
-
- const options = useMemo(
- () =>
- issueLabels.map((label) => ({
- color: label.color,
- value: label.value,
- })),
- [issueLabels]
- );
-
- const toggleLabel = async (value: string) => {
- const next = labels.includes(value)
- ? labels.filter((label) => label !== value)
- : [...labels, value];
- try {
- setIsUpdating(true);
- await onUpdate(next);
- } finally {
- setIsUpdating(false);
- }
- };
-
- return (
- <div className="flex flex-col gap-y-1">
- <div className="flex items-center gap-x-1 textinfolabel">
- <span>{t("issue.labels")}</span>
- </div>
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger
- render={
- <button
- className={cn(
- "flex min-h-9 w-full items-center justify-between gap-2 rounded-sm border border-control-border bg-white px-3 py-1.5 text-left text-sm transition-colors",
- allowChange && !isUpdating && "hover:bg-control-bg",
- open && "border-accent shadow-[0_0_0_1px_var(--color-accent)]",
- (!allowChange || isUpdating) && "cursor-not-allowed opacity-60"
- )}
- disabled={!allowChange || isUpdating}
- type="button"
- />
- }
- >
- <div className="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
- {labels.length > 0 ? (
- labels.map((value) => {
- const option = options.find((item) => item.value === value);
- return (
- <span
- key={value}
- className="inline-flex items-center gap-1 rounded-xs bg-control-bg px-1.5 py-0.5 text-xs"
- >
- <span
- className="size-2.5 shrink-0 rounded-sm"
- style={{ backgroundColor: option?.color }}
- />
- <span className="truncate">{value}</span>
- </span>
- );
- })
- ) : (
- <span className="text-control-placeholder">
- {t("common.select")}
- </span>
- )}
- </div>
- </PopoverTrigger>
-
- <PopoverContent
- side="bottom"
- align="start"
- initialFocus={false}
- finalFocus={false}
- style={{ width: "var(--anchor-width)" }}
- className="overflow-hidden bg-white p-0"
- >
- <div className="max-h-60 overflow-y-auto">
- {options.length === 0 ? (
- <div className="px-3 py-6 text-sm text-control-placeholder">
- {t("common.no-data")}
- </div>
- ) : (
- options.map((option) => {
- const isSelected = labels.includes(option.value);
- return (
- <button
- key={option.value}
- className="flex w-full items-center gap-x-2 px-3 py-2 text-left text-sm transition-colors hover:bg-control-bg"
- disabled={isUpdating}
- onClick={() => void toggleLabel(option.value)}
- type="button"
- >
- <Checkbox checked={isSelected} />
- <span
- className="size-4 shrink-0 rounded-sm"
- style={{ backgroundColor: option.color }}
- />
- <span>{option.value}</span>
- </button>
- );
- })
- )}
- </div>
- </PopoverContent>
- </Popover>
- </div>
- );
-}
-
-function StageStatusDot({ status }: { status: Task_Status }) {
- const dotClass =
- status === Task_Status.DONE || status === Task_Status.SKIPPED
- ? "bg-success"
- : status === Task_Status.FAILED
- ? "bg-error"
- : status === Task_Status.RUNNING || status === Task_Status.PENDING
- ? "bg-accent"
- : "bg-control-placeholder";
- return <div className={cn("h-2.5 w-2.5 rounded-full", dotClass)} />;
-}
diff --git a/frontend/src/react/pages/project/plan-detail/hooks/usePlanCheckActions.tsx b/frontend/src/react/pages/project/plan-detail/hooks/usePlanCheckActions.tsx
index 918efd47c7..a9cb2a0e19 100644
--- a/frontend/src/react/pages/project/plan-detail/hooks/usePlanCheckActions.tsx
+++ b/frontend/src/react/pages/project/plan-detail/hooks/usePlanCheckActions.tsx
@@ -19,11 +19,8 @@ import {
import { hasProjectPermissionV2 } from "@/utils";
import { usePlanDetailContext } from "../shell/PlanDetailContext";
-// Wraps the run / refresh logic shared between PlanDetailChecks (per-spec
-// section in the body) and the plan-level summary in PlanDetailMetadataSidebar.
-// The running flag lives on the page context so both surfaces disable their
-// Run buttons together — otherwise the user could trigger two concurrent
-// runPlanChecks calls from the same page.
+// The running flag lives on the page context so concurrent triggers of
+// runPlanChecks on the same page are disabled together.
export function usePlanCheckActions() {
const { t } = useTranslation();
const page = usePlanDetailContext();
diff --git a/frontend/src/react/pages/project/plan-detail/shared/stores/pollingSlice.ts b/frontend/src/react/pages/project/plan-detail/shared/stores/pollingSlice.ts
index f8b812c04c..d5fe3f359f 100644
--- a/frontend/src/react/pages/project/plan-detail/shared/stores/pollingSlice.ts
+++ b/frontend/src/react/pages/project/plan-detail/shared/stores/pollingSlice.ts
@@ -5,10 +5,8 @@ export const createPollingSlice: PlanDetailSliceCreator<PollingSlice> = (
) => ({
isRefreshing: false,
isRunningChecks: false,
- lastRefreshTime: 0,
pollTimerId: undefined,
setRefreshing: (v) => set({ isRefreshing: v }),
setRunningChecks: (v) => set({ isRunningChecks: v }),
- setLastRefreshTime: (t) => set({ lastRefreshTime: t }),
setPollTimerId: (id) => set({ pollTimerId: id }),
});
diff --git a/frontend/src/react/pages/project/plan-detail/shared/stores/types.ts b/frontend/src/react/pages/project/plan-detail/shared/stores/types.ts
index 335f21c28f..8f3d7197fd 100644
--- a/frontend/src/react/pages/project/plan-detail/shared/stores/types.ts
+++ b/frontend/src/react/pages/project/plan-detail/shared/stores/types.ts
@@ -57,11 +57,9 @@ export type SelectionSlice = {
export type PollingSlice = {
isRefreshing: boolean;
isRunningChecks: boolean;
- lastRefreshTime: number;
pollTimerId: number | undefined;
setRefreshing: (v: boolean) => void;
setRunningChecks: (v: boolean) => void;
- setLastRefreshTime: (t: number) => void;
setPollTimerId: (id: number | undefined) => void;
};
diff --git a/frontend/src/react/pages/project/plan-detail/shell/constants.ts b/frontend/src/react/pages/project/plan-detail/shell/constants.ts
index 89b1512762..26ff31b1db 100644
--- a/frontend/src/react/pages/project/plan-detail/shell/constants.ts
+++ b/frontend/src/react/pages/project/plan-detail/shell/constants.ts
@@ -7,9 +7,8 @@ export const POLLER_INTERVAL = {
export const PROJECT_NAME_PREFIX = "projects/";
-// Width below which the sidebar collapses into a mobile drawer.
+// Width below which the layout switches to mobile mode.
export const MOBILE_BREAKPOINT_PX = 780;
-// Width at or above which the sidebar widens.
-export const WIDE_SIDEBAR_BREAKPOINT_PX = 1280;
-export const SIDEBAR_WIDTH_NARROW_PX = 240;
-export const SIDEBAR_WIDTH_WIDE_PX = 336;
+// Width at or above which the task detail panel renders inline as a
+// side-by-side column instead of as a drawer.
+export const INLINE_TASK_PANEL_BREAKPOINT_PX = 1024;
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/types.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/types.ts
index 7a7a5d6e4b..26155ac33e 100644
--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/types.ts
+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/types.ts
@@ -7,7 +7,7 @@ import {
} from "@/types/proto-es/v1/rollout_service_pb";
import type { User } from "@/types/proto-es/v1/user_service_pb";
import type { PlanDetailPhase } from "../../shared/stores/types";
-import type { PlanDetailSidebarMode } from "./useSidebarMode";
+import type { PlanDetailLayoutMode } from "./useLayoutMode";
export type { PlanDetailPhase } from "../../shared/stores/types";
@@ -38,7 +38,6 @@ export interface PlanDetailPageState extends PlanDetailPageSnapshot {
isRefreshing: boolean;
isRunningChecks: boolean;
setIsRunningChecks: (running: boolean) => void;
- lastRefreshTime: number;
activePhases: Set<PlanDetailPhase>;
routeName?: string;
routePhase?: string;
@@ -46,15 +45,12 @@ export interface PlanDetailPageState extends PlanDetailPageSnapshot {
routeTaskId?: string;
selectedTaskName?: string;
pendingLeaveConfirm: boolean;
- sidebarMode: PlanDetailSidebarMode;
+ layoutMode: PlanDetailLayoutMode;
containerWidth: number;
- desktopSidebarWidth: number;
- mobileSidebarOpen: boolean;
patchState: (patch: Partial<PlanDetailPageSnapshot>) => void;
refreshState: () => Promise<void>;
bypassLeaveGuardOnce: () => void;
setEditing: (scope: string, editing: boolean) => void;
- setMobileSidebarOpen: (open: boolean) => void;
togglePhase: (phase: PlanDetailPhase) => void;
expandPhase: (phase: PlanDetailPhase) => void;
closeTaskPanel: () => void;
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/useDerivedPlanState.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/useDerivedPlanState.ts
index bd6129d475..c86a320343 100644
--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/useDerivedPlanState.ts
+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/useDerivedPlanState.ts
@@ -5,12 +5,12 @@ import type {
PlanDetailPhase,
} from "./types";
import type { useEditingScopes } from "./useEditingScopes";
+import type { useLayoutMode } from "./useLayoutMode";
import type { usePhaseState } from "./usePhaseState";
-import type { useSidebarMode } from "./useSidebarMode";
type EditingScopes = ReturnType<typeof useEditingScopes>;
+type Layout = ReturnType<typeof useLayoutMode>;
type PhaseState = ReturnType<typeof usePhaseState>;
-type Sidebar = ReturnType<typeof useSidebarMode>;
export function useDerivedPlanState(params: {
snapshot: PlanDetailPageSnapshot;
@@ -18,10 +18,9 @@ export function useDerivedPlanState(params: {
isRefreshing: boolean;
isRunningChecks: boolean;
setIsRunningChecks: (running: boolean) => void;
- lastRefreshTime: number;
phase: PhaseState;
editing: EditingScopes;
- sidebar: Sidebar;
+ layout: Layout;
routeName?: string;
routePhase?: PlanDetailPhase;
routeStageId?: string;
@@ -37,10 +36,9 @@ export function useDerivedPlanState(params: {
isRefreshing,
isRunningChecks,
setIsRunningChecks,
- lastRefreshTime,
phase,
editing,
- sidebar,
+ layout,
routeName,
routePhase,
routeStageId,
@@ -73,7 +71,6 @@ export function useDerivedPlanState(params: {
isRefreshing,
isRunningChecks,
setIsRunningChecks,
- lastRefreshTime,
activePhases: phase.activePhases,
routeName,
routePhase,
@@ -81,15 +78,12 @@ export function useDerivedPlanState(params: {
routeTaskId,
selectedTaskName,
pendingLeaveConfirm: editing.pendingLeaveConfirm,
- sidebarMode: sidebar.sidebarMode,
- containerWidth: sidebar.containerWidth,
- desktopSidebarWidth: sidebar.sidebarWidth,
- mobileSidebarOpen: sidebar.isMobileSidebarOpen,
+ layoutMode: layout.layoutMode,
+ containerWidth: layout.containerWidth,
bypassLeaveGuardOnce: editing.bypassLeaveGuardOnce,
patchState,
refreshState,
setEditing: editing.setEditing,
- setMobileSidebarOpen: sidebar.setMobileSidebarOpen,
togglePhase: phase.togglePhase,
expandPhase: phase.expandPhase,
closeTaskPanel,
@@ -101,7 +95,6 @@ export function useDerivedPlanState(params: {
isEditing,
isRefreshing,
isRunningChecks,
- lastRefreshTime,
patchState,
phase,
refreshState,
@@ -110,8 +103,8 @@ export function useDerivedPlanState(params: {
routePhase,
routeStageId,
routeTaskId,
+ layout,
selectedTaskName,
- sidebar,
snapshot,
]
);
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/useLayoutMode.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/useLayoutMode.ts
new file mode 100644
index 0000000000..87d0f23291
--- /dev/null
+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/useLayoutMode.ts
@@ -0,0 +1,40 @@
+import { useEffect, useState } from "react";
+import { MOBILE_BREAKPOINT_PX } from "../constants";
+
+export type PlanDetailLayoutMode = "NONE" | "DESKTOP" | "MOBILE";
+
+export function useLayoutMode(pageHost: HTMLElement | null) {
+ const [layoutMode, setLayoutMode] = useState<PlanDetailLayoutMode>("NONE");
+ const [containerWidth, setContainerWidth] = useState(0);
+
+ useEffect(() => {
+ if (!pageHost) {
+ setLayoutMode("NONE");
+ setContainerWidth(0);
+ return;
+ }
+
+ const updateLayout = () => {
+ const width = pageHost.getBoundingClientRect().width;
+ const mode: PlanDetailLayoutMode =
+ width === 0
+ ? "NONE"
+ : width < MOBILE_BREAKPOINT_PX
+ ? "MOBILE"
+ : "DESKTOP";
+ setContainerWidth(width);
+ setLayoutMode(mode);
+ };
+
+ updateLayout();
+ const observer = new ResizeObserver(() => updateLayout());
+ observer.observe(pageHost);
+
+ return () => observer.disconnect();
+ }, [pageHost]);
+
+ return {
+ layoutMode,
+ containerWidth,
+ };
+}
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts
index 655e190d9b..d40e924e64 100644
--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts
+++ b/frontend/src/react/pages/project/plan-detail/shell/hooks/usePlanDetailPage.ts
@@ -24,12 +24,12 @@ import type { PlanDetailPageSnapshot, PlanDetailPageState } from "./types";
import { useDerivedPlanState } from "./useDerivedPlanState";
import { useEditingScopes } from "./useEditingScopes";
import { useInitialFetch } from "./useInitialFetch";
+import { useLayoutMode } from "./useLayoutMode";
import { useLeaveGuard } from "./useLeaveGuard";
import { usePhaseState } from "./usePhaseState";
import { usePolling } from "./usePolling";
import { useRedirects } from "./useRedirects";
import { useRouteSelection } from "./useRouteSelection";
-import { useSidebarMode } from "./useSidebarMode";
const buildDefaultSnapshot = (
projectId: string,
@@ -92,10 +92,9 @@ export const usePlanDetailPage = ({
const phase = usePhaseState();
const editing = useEditingScopes();
const storeApi = usePlanDetailStoreApi();
- const sidebar = useSidebarMode(pageHost);
+ const layout = useLayoutMode(pageHost);
const [isRefreshing, setIsRefreshing] = useState(false);
const [isRunningChecks, setIsRunningChecks] = useState(false);
- const [lastRefreshTime, setLastRefreshTime] = useState(0);
const latestSnapshotRef = useRef(snapshot);
const { resolveLeaveConfirm } = useLeaveGuard();
const isEditing = editing.isEditing;
@@ -163,7 +162,6 @@ export const usePlanDetailPage = ({
routeQueryRef.current
);
patchState(patch);
- setLastRefreshTime(Date.now());
} finally {
setIsRefreshing(false);
}
@@ -239,10 +237,9 @@ export const usePlanDetailPage = ({
isRefreshing,
isRunningChecks,
setIsRunningChecks,
- lastRefreshTime,
phase,
editing,
- sidebar,
+ layout,
routeName,
routePhase,
routeStageId,
diff --git a/frontend/src/react/pages/project/plan-detail/shell/hooks/useSidebarMode.ts b/frontend/src/react/pages/project/plan-detail/shell/hooks/useSidebarMode.ts
deleted file mode 100644
index 60ddcf6397..0000000000
--- a/frontend/src/react/pages/project/plan-detail/shell/hooks/useSidebarMode.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-import { useEffect, useRef, useState } from "react";
-import {
- MOBILE_BREAKPOINT_PX,
- SIDEBAR_WIDTH_NARROW_PX,
- SIDEBAR_WIDTH_WIDE_PX,
- WIDE_SIDEBAR_BREAKPOINT_PX,
-} from "../constants";
-
-export type PlanDetailSidebarMode = "NONE" | "DESKTOP" | "MOBILE";
-
-export function useSidebarMode(pageHost: HTMLElement | null) {
- const [sidebarMode, setSidebarMode] = useState<PlanDetailSidebarMode>("NONE");
- const [containerWidth, setContainerWidth] = useState(0);
- const [sidebarWidth, setSidebarWidth] = useState(0);
- const [isMobileSidebarOpen, setMobileSidebarOpen] = useState(false);
- const isMobileSidebarOpenRef = useRef(isMobileSidebarOpen);
- isMobileSidebarOpenRef.current = isMobileSidebarOpen;
-
- useEffect(() => {
- if (!pageHost) {
- setSidebarMode("NONE");
- setContainerWidth(0);
- setSidebarWidth(0);
- setMobileSidebarOpen(false);
- return;
- }
-
- const updateSidebar = () => {
- const width = pageHost.getBoundingClientRect().width;
- const mode: PlanDetailSidebarMode =
- width === 0
- ? "NONE"
- : width < MOBILE_BREAKPOINT_PX
- ? "MOBILE"
- : "DESKTOP";
- setContainerWidth(width);
- setSidebarWidth(
- width < WIDE_SIDEBAR_BREAKPOINT_PX
- ? SIDEBAR_WIDTH_NARROW_PX
- : SIDEBAR_WIDTH_WIDE_PX
- );
- setSidebarMode(mode);
- if (mode !== "MOBILE") {
- setMobileSidebarOpen(false);
- }
- };
-
- updateSidebar();
- const observer = new ResizeObserver(() => updateSidebar());
- observer.observe(pageHost);
-
- return () => observer.disconnect();
- }, [pageHost]);
-
- return {
- sidebarMode,
- containerWidth,
- sidebarWidth,
- isMobileSidebarOpen,
- setMobileSidebarOpen,
- };
-}
diff --git a/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.test.ts b/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.test.ts
deleted file mode 100644
index da9ce410c6..0000000000
--- a/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.test.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-import { describe, expect, test } from "vitest";
-import { ApprovalStatus, State } from "@/types/proto-es/v1/common_pb";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { getPlanDetailSidebarStatusInfo } from "./sidebarStatus";
-
-const labels: Record<string, string> = {
- "common.approved": "Approved",
- "common.canceled": "Canceled",
- "common.deploying": "Deploying",
- "common.done": "Done",
- "common.draft": "Draft",
- "common.failed": "Failed",
- "common.in-review": "In Review",
- "common.not-started": "Not started",
- "common.rejected": "Rejected",
-};
-
-const t = (key: string) => labels[key] ?? key;
-
-const status = ({
- issue,
- rollout,
-}: {
- issue?: {
- approvalStatus: ApprovalStatus;
- status: IssueStatus;
- };
- rollout?: Rollout;
-}) =>
- getPlanDetailSidebarStatusInfo({
- isCreating: false,
- issue,
- planState: State.ACTIVE,
- rollout,
- t,
- });
-
-const rolloutWith = (...statuses: Task_Status[]): Rollout =>
- ({
- stages: [
- {
- tasks: statuses.map((taskStatus) => ({ status: taskStatus })),
- },
- ],
- }) as unknown as Rollout;
-
-describe("plan detail sidebar status", () => {
- test("maps review statuses like the Vue sidebar", () => {
- expect(status({}).label).toBe("Draft");
- expect(
- status({
- issue: {
- approvalStatus: ApprovalStatus.REJECTED,
- status: IssueStatus.OPEN,
- },
- })
- ).toEqual({ dotClass: "bg-warning", label: "Rejected" });
- expect(
- status({
- issue: {
- approvalStatus: ApprovalStatus.SKIPPED,
- status: IssueStatus.OPEN,
- },
- })
- ).toEqual({ dotClass: "bg-success", label: "Approved" });
- });
-
- test("maps rollout statuses like the Vue sidebar", () => {
- expect(status({ rollout: rolloutWith(Task_Status.RUNNING) })).toEqual({
- dotClass: "bg-accent",
- label: "Deploying",
- });
- expect(status({ rollout: rolloutWith(Task_Status.DONE) })).toEqual({
- dotClass: "bg-success",
- label: "Done",
- });
- expect(status({ rollout: rolloutWith(Task_Status.FAILED) })).toEqual({
- dotClass: "bg-error",
- label: "Failed",
- });
- expect(status({ rollout: rolloutWith(Task_Status.CANCELED) })).toEqual({
- dotClass: "bg-control-placeholder",
- label: "Canceled",
- });
- expect(status({ rollout: rolloutWith(Task_Status.NOT_STARTED) })).toEqual({
- dotClass: "bg-control-placeholder",
- label: "Not started",
- });
- });
-});
diff --git a/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.ts b/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.ts
deleted file mode 100644
index f9443e16c1..0000000000
--- a/frontend/src/react/pages/project/plan-detail/utils/sidebarStatus.ts
+++ /dev/null
@@ -1,132 +0,0 @@
-import { ApprovalStatus, State } from "@/types/proto-es/v1/common_pb";
-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-
-type T = (key: string, options?: Record<string, unknown>) => string;
-
-const TASK_STATUS_FILTERS: Task_Status[] = [
- Task_Status.RUNNING,
- Task_Status.FAILED,
- Task_Status.PENDING,
- Task_Status.NOT_STARTED,
- Task_Status.CANCELED,
- Task_Status.DONE,
- Task_Status.SKIPPED,
-];
-
-export interface SidebarStatusInfo {
- dotClass: string;
- label: string;
-}
-
-export const getPlanDetailSidebarStatusInfo = ({
- isCreating,
- issue,
- planState,
- rollout,
- t,
-}: {
- isCreating: boolean;
- issue?: Pick<Issue, "approvalStatus" | "status">;
- planState: State;
- rollout?: Rollout;
- t: T;
-}): SidebarStatusInfo => {
- if (isCreating) {
- return { dotClass: "bg-control-placeholder", label: t("common.creating") };
- }
- if (planState === State.DELETED) {
- return { dotClass: "bg-control-placeholder", label: t("common.closed") };
- }
- if (issue?.status === IssueStatus.CANCELED) {
- return { dotClass: "bg-control-placeholder", label: t("common.closed") };
- }
- if (rollout) {
- return getRolloutStatusInfo(rollout, t);
- }
- return getReviewStatusInfo(issue, t);
-};
-
-const getReviewStatusInfo = (
- issue: Pick<Issue, "approvalStatus" | "status"> | undefined,
- t: T
-): SidebarStatusInfo => {
- if (!issue) {
- return { dotClass: "bg-control-placeholder", label: t("common.draft") };
- }
- if (issue.status === IssueStatus.DONE) {
- return { dotClass: "bg-success", label: t("common.approved") };
- }
-
- switch (issue.approvalStatus) {
- case ApprovalStatus.APPROVED:
- case ApprovalStatus.SKIPPED:
- return { dotClass: "bg-success", label: t("common.approved") };
- case ApprovalStatus.REJECTED:
- return { dotClass: "bg-warning", label: t("common.rejected") };
- default:
- return { dotClass: "bg-accent", label: t("common.in-review") };
- }
-};
-
-const getRolloutStatusInfo = (rollout: Rollout, t: T): SidebarStatusInfo => {
- const hasCompletedTasks = rollout.stages
- .flatMap((stage) => stage.tasks)
- .some(
- (task) =>
- task.status === Task_Status.DONE || task.status === Task_Status.SKIPPED
- );
-
- switch (getRolloutStatus(rollout)) {
- case Task_Status.DONE:
- case Task_Status.SKIPPED:
- return { dotClass: "bg-success", label: t("common.done") };
- case Task_Status.FAILED:
- return { dotClass: "bg-error", label: t("common.failed") };
- case Task_Status.RUNNING:
- case Task_Status.PENDING:
- return { dotClass: "bg-accent", label: t("common.deploying") };
- case Task_Status.CANCELED:
- return {
- dotClass: "bg-control-placeholder",
- label: t("common.canceled"),
- };
- case Task_Status.NOT_STARTED:
- if (hasCompletedTasks) {
- return { dotClass: "bg-accent", label: t("common.deploying") };
- }
- return {
- dotClass: "bg-control-placeholder",
- label: t("common.not-started"),
- };
- default:
- return {
- dotClass: "bg-control-placeholder",
- label: t("common.not-started"),
- };
- }
-};
-
-const getStageStatus = (tasks: Array<{ status: Task_Status }>): Task_Status => {
- if (tasks.length === 0) return Task_Status.NOT_STARTED;
- for (const status of TASK_STATUS_FILTERS) {
- if (tasks.some((task) => task.status === status)) {
- return status;
- }
- }
- return Task_Status.NOT_STARTED;
-};
-
-const getRolloutStatus = (rollout: Rollout): Task_Status => {
- if (rollout.stages.length === 0) return Task_Status.NOT_STARTED;
- for (const status of TASK_STATUS_FILTERS) {
- if (
- rollout.stages.some((stage) => getStageStatus(stage.tasks) === status)
- ) {
- return status;
- }
- }
- return Task_Status.NOT_STARTED;
-};