Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): add expand/collapse all button to task run log viewer (#18522)
boojack91e2690f91bc
diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/TaskRunLogViewer.vue b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/TaskRunLogViewer.vueindex e20cd6fe37..cfe74f8af8 100644--- a/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/TaskRunLogViewer.vue+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/TaskRunLogViewer.vue@@ -3,6 +3,40 @@v-if="sections.length > 0"class="w-full font-mono text-xs bg-gray-50 border border-gray-200 overflow-hidden rounded">+ <!-- Toolbar with summary stats and expand/collapse buttons -->+ <div+ class="flex items-center justify-between px-2 py-1 bg-gray-100 border-b border-gray-200"+ >+ <!-- Left: Summary stats -->+ <div class="flex items-center gap-x-2 text-gray-500">+ <ListIcon class="w-3.5 h-3.5" />+ <span>+ {{+ $t("task-run.log-viewer.summary", {+ sections: totalSections,+ entries: totalEntries,+ })+ }}+ </span>+ </div>++ <!-- Right: Expand/Collapse toggle button -->+ <button+ class="flex items-center gap-x-1 px-1.5 py-0.5 text-gray-600 hover:text-gray-900 hover:bg-gray-200 rounded transition-colors"+ @click="toggleExpandAll"+ >+ <component+ :is="areAllExpanded ? ChevronsDownUpIcon : ChevronsUpDownIcon"+ class="w-3.5 h-3.5"+ />+ <span>{{+ areAllExpanded+ ? $t("task-run.log-viewer.collapse-all")+ : $t("task-run.log-viewer.expand-all")+ }}</span>+ </button>+ </div>+<!-- Multi-deploy view: show deploy groups when server restarts detected --><template v-if="hasMultipleDeploys"><!-- Server restart notice -->@@ -86,6 +120,9 @@ import {AlertTriangleIcon,ChevronDownIcon,ChevronRightIcon,+ ChevronsDownUpIcon,+ ChevronsUpDownIcon,+ ListIcon,ServerIcon,} from "lucide-vue-next";import type { TaskRunLogEntry } from "@/types/proto-es/v1/rollout_service_pb";@@ -107,8 +144,21 @@ const {toggleDeploy,isSectionExpanded,isDeployExpanded,+ expandAll,+ collapseAll,+ areAllExpanded,+ totalSections,+ totalEntries,} = useTaskRunLogSections(() => props.entries,() => props.sheet);++const toggleExpandAll = () => {+ if (areAllExpanded.value) {+ collapseAll();+ } else {+ expandAll();+ }+};</script>diff --git a/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/useTaskRunLogSections.ts b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/useTaskRunLogSections.tsindex 8749b64f4a..6afc362c6a 100644--- a/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/useTaskRunLogSections.ts+++ b/frontend/src/components/Plan/components/RolloutView/v2/TaskRunLogViewer/useTaskRunLogSections.ts@@ -47,6 +47,11 @@ export interface UseTaskRunLogSectionsReturn {toggleDeploy: (deployId: string) => void;isSectionExpanded: (sectionId: string) => boolean;isDeployExpanded: (deployId: string) => boolean;+ expandAll: () => void;+ collapseAll: () => void;+ areAllExpanded: ComputedRef<boolean>;+ totalSections: ComputedRef<number>;+ totalEntries: ComputedRef<number>;}export const useTaskRunLogSections = (@@ -322,6 +327,96 @@ export const useTaskRunLogSections = (return expandedDeploys.value.has(deployId);};+ // Get all section IDs (both from flat sections and deploy groups)+ const getAllSectionIds = (): string[] => {+ if (hasMultipleDeploys.value) {+ return deployGroups.value.flatMap((group) =>+ group.sections.map((section) => section.id)+ );+ }+ return sections.value.map((section) => section.id);+ };++ // Get all deploy IDs+ const getAllDeployIds = (): string[] => {+ return deployGroups.value.map((group) => group.deployId);+ };++ const expandAll = () => {+ // Expand all sections+ for (const sectionId of getAllSectionIds()) {+ addToSet(expandedSections, sectionId);+ deleteFromSet(userCollapsedSections, sectionId);+ }+ // Expand all deploy groups (for multi-deploy view)+ if (hasMultipleDeploys.value) {+ for (const deployId of getAllDeployIds()) {+ addToSet(expandedDeploys, deployId);+ deleteFromSet(userCollapsedDeploys, deployId);+ }+ }+ };++ const collapseAll = () => {+ // Collapse all sections+ for (const sectionId of getAllSectionIds()) {+ deleteFromSet(expandedSections, sectionId);+ addToSet(userCollapsedSections, sectionId);+ }+ // Collapse all deploy groups (for multi-deploy view)+ if (hasMultipleDeploys.value) {+ for (const deployId of getAllDeployIds()) {+ deleteFromSet(expandedDeploys, deployId);+ addToSet(userCollapsedDeploys, deployId);+ }+ }+ };++ const areAllExpanded = computed((): boolean => {+ const allSectionIds = getAllSectionIds();+ if (allSectionIds.length === 0) return false;++ const allSectionsExpanded = allSectionIds.every((id) =>+ expandedSections.value.has(id)+ );++ // For multi-deploy view, also check deploy groups+ if (hasMultipleDeploys.value) {+ const allDeployIds = getAllDeployIds();+ const allDeploysExpanded = allDeployIds.every((id) =>+ expandedDeploys.value.has(id)+ );+ return allSectionsExpanded && allDeploysExpanded;+ }++ return allSectionsExpanded;+ });++ const totalSections = computed((): number => {+ if (hasMultipleDeploys.value) {+ return deployGroups.value.reduce(+ (sum, group) => sum + group.sections.length,+ 0+ );+ }+ return sections.value.length;+ });++ const totalEntries = computed((): number => {+ if (hasMultipleDeploys.value) {+ return deployGroups.value.reduce(+ (sum, group) =>+ sum ++ group.sections.reduce(+ (sSum, section) => sSum + section.entryCount,+ 0+ ),+ 0+ );+ }+ return sections.value.reduce((sum, section) => sum + section.entryCount, 0);+ });+// Auto-expand error sections (respecting user's manual collapse)watch(sections,@@ -371,5 +466,10 @@ export const useTaskRunLogSections = (toggleDeploy,isSectionExpanded,isDeployExpanded,+ expandAll,+ collapseAll,+ areAllExpanded,+ totalSections,+ totalEntries,};};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex ed4c353a34..1f6de40b75 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -394,7 +394,10 @@},"log-viewer": {"multiple-deploys-notice": "Server restart detected during execution. Logs are grouped by deployment.",- "deployment-n": "Deployment #{n}"+ "deployment-n": "Deployment #{n}",+ "expand-all": "Expand all",+ "collapse-all": "Collapse all",+ "summary": "{sections} sections · {entries} entries"}},"banner": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 3778876850..0ac50b3c84 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -394,7 +394,10 @@},"log-viewer": {"multiple-deploys-notice": "Se detectó un reinicio del servidor durante la ejecución. Los registros están agrupados por despliegue.",- "deployment-n": "Despliegue #{n}"+ "deployment-n": "Despliegue #{n}",+ "expand-all": "Expandir todo",+ "collapse-all": "Contraer todo",+ "summary": "{sections} secciones · {entries} entradas"}},"banner": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 3916583481..9dbc916fbf 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -394,7 +394,10 @@},"log-viewer": {"multiple-deploys-notice": "実行中にサーバーの再起動が検出されました。ログはデプロイごとにグループ化されています。",- "deployment-n": "デプロイ #{n}"+ "deployment-n": "デプロイ #{n}",+ "expand-all": "すべて展開",+ "collapse-all": "すべて折りたたむ",+ "summary": "{sections} セクション · {entries} エントリ"}},"banner": {diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 7fc089c4fe..85a7c002da 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -394,7 +394,10 @@},"log-viewer": {"multiple-deploys-notice": "Phát hiện khởi động lại máy chủ trong quá trình thực thi. Nhật ký được nhóm theo triển khai.",- "deployment-n": "Triển khai #{n}"+ "deployment-n": "Triển khai #{n}",+ "expand-all": "Mở rộng tất cả",+ "collapse-all": "Thu gọn tất cả",+ "summary": "{sections} phần · {entries} mục"}},"banner": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 5c2b698532..50ddde478f 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -394,7 +394,10 @@},"log-viewer": {"multiple-deploys-notice": "检测到执行期间服务重启,日志按部署分组显示。",- "deployment-n": "部署 #{n}"+ "deployment-n": "部署 #{n}",+ "expand-all": "全部展开",+ "collapse-all": "全部收起",+ "summary": "{sections} 个分组 · {entries} 条记录"}},"banner": {