Skip to content

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

perf(frontend): enable virtual scrolling for TaskRunLogTable (#18247)

boojackf7daaa969b6c
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
index badbfd20d7..ec965c1e2b 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunLogTable/TaskRunLogTable.vue
@@ -4,6 +4,8 @@
:loading="isLoading"
:data="flattenLogEntries"
:row-key="rowKey"
+ max-height="60vh"
+ virtual-scroll
size="small"
/>
</template>
@@ -20,7 +22,6 @@ import { rolloutServiceClientConnect } from "@/grpcweb";
import {
GetTaskRunLogRequestSchema,
type TaskRun,
- TaskRunLogEntry_Type,
} from "@/types/proto-es/v1/rollout_service_pb";
import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
import {
@@ -28,7 +29,7 @@ import {
displayTaskRunLogEntryType,
type FlattenLogEntry,
} from "./common";
-import DetailCell, { detailCellRowSpan } from "./DetailCell";
+import DetailCell from "./DetailCell";
import DurationCell from "./DurationCell.vue";
import LogTimeCell from "./LogTimeCell.vue";
import StatementCell from "./StatementCell.vue";
@@ -39,7 +40,7 @@ const props = defineProps<{
}>();
const { t } = useI18n();
-const isLoading = ref(false);
+const isFetching = ref(false);
const taskRunLog = computedAsync(
async () => {
@@ -51,11 +52,16 @@ const taskRunLog = computedAsync(
},
undefined,
{
- evaluating: isLoading,
+ evaluating: isFetching,
}
);
+
+// Only show loading on initial load, not on refresh
+const isLoading = computed(
+ () => isFetching.value && !taskRunLog.value?.entries?.length
+);
+
const logEntries = computed(() => {
- if (isLoading.value) return [];
if (!props.sheet) return [];
return taskRunLog.value?.entries ?? [];
});
@@ -73,56 +79,21 @@ const lastDeployId = computed(() => last(logEntries.value)?.deployId);
const rowKey = (entry: FlattenLogEntry) => {
return `${entry.batch}-${entry.serial}`;
};
-const rowSpan = (entry: FlattenLogEntry) => {
- if (
- entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&
- entry.commandExecute
- ) {
- const { commandExecute } = entry;
- if (commandExecute.kind === "commandIndexes") {
- return commandExecute.commandIndexes.length;
- }
- return 1;
- }
- return 1;
-};
-
-const colSpan = (entry: FlattenLogEntry) => {
- if (
- entry.type === TaskRunLogEntry_Type.COMMAND_EXECUTE &&
- entry.commandExecute
- ) {
- const { commandExecute } = entry;
- if (
- commandExecute.kind === "commandIndexes" &&
- commandExecute.commandIndexes.length > 1
- ) {
- return 1;
- }
- }
- return 2;
-};
-const columns = computed(() => {
- const splitBatchAndSerialCol = flattenLogEntries.value.some(
- (entry) => colSpan(entry) === 1
- );
- const columns: (DataTableColumn<FlattenLogEntry> & { hide?: boolean })[] = [
+const columns = computed((): DataTableColumn<FlattenLogEntry>[] => {
+ return [
{
key: "batch",
- title: () => "",
- width: 50,
+ title: () => "#",
+ width: 70,
className: "whitespace-nowrap",
- titleColSpan: splitBatchAndSerialCol ? 2 : 1,
- rowSpan,
- colSpan: (entry) => {
- if (splitBatchAndSerialCol) return colSpan(entry);
- return 1;
- },
render: (entry) => {
return (
<div class="flex flex-row items-center gap-1">
- <span>{String(entry.batch + 1)}</span>
+ <span>
+ {String(entry.batch + 1)}
+ {entry.serial > 0 ? `.${entry.serial + 1}` : ""}
+ </span>
{lastDeployId.value !== entry.deployId && (
<NTooltip>
{{
@@ -142,16 +113,6 @@ const columns = computed(() => {
);
},
},
- {
- key: "serial",
- title: () => "",
- width: 50,
- className: "whitespace-nowrap",
- hide: !splitBatchAndSerialCol,
- render: (entry) => {
- return String(entry.serial + 1);
- },
- },
{
key: "type",
title: () => t("common.type"),
@@ -169,7 +130,6 @@ const columns = computed(() => {
key: "detail",
title: () => t("common.detail"),
width: "40%",
- rowSpan: detailCellRowSpan,
render: (entry) => {
return (
<div class="flex flex-row justify-start items-center">
@@ -190,7 +150,6 @@ const columns = computed(() => {
key: "duration",
title: () => t("common.duration"),
width: 120,
- rowSpan,
render: (entry) => {
return <DurationCell entry={entry} />;
},
@@ -199,12 +158,10 @@ const columns = computed(() => {
key: "log-time",
title: () => t("common.time"),
width: 120,
- rowSpan,
render: (entry) => {
return <LogTimeCell entry={entry} />;
},
},
];
- return columns.filter((column) => !column.hide);
});
</script>