Skip to content

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

chore: only fetch task run log for selected task (#13371)

boojack72b9e4adee22
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
index 3f9a476e3c..2d56219b56 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue
@@ -1,7 +1,7 @@
<template>
<NTabs v-model:value="state.currentTab" type="line">
<NTabPane name="LOG" :tab="$t('issue.task-run.logs')">
- <TaskRunLogTable :task-run="taskRun" />
+ <TaskRunLogTable :key="componentId" :task-run="taskRun" />
</NTabPane>
<NTabPane
v-if="showTaskRunSessionTab"
@@ -58,9 +58,7 @@ const showTaskRunSessionTab = computed(() =>
);
const showRefreshButton = computed(
- () =>
- state.currentTab === "SESSION" &&
- props.taskRun.status === TaskRun_Status.RUNNING
+ () => props.taskRun.status === TaskRun_Status.RUNNING
);
const database = computed(() =>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
index f9129165cb..294e1fcee2 100644
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
@@ -10,11 +10,13 @@
</template>
<script lang="ts" setup>
-import { computed } from "vue";
+import { computed, watchEffect } from "vue";
import {
useIssueContext,
taskRunListForTask,
} from "@/components/IssueV1/logic";
+import { rolloutServiceClient } from "@/grpcweb";
+import { TaskRun_Status } from "@/types/proto/v1/rollout_service";
import TaskRunTable from "./TaskRunTable.vue";
type ViewMode = "SINGLE" | "MERGED";
@@ -39,4 +41,16 @@ const flattenTaskRunList = computed(() => {
}
return [];
});
+
+watchEffect(async () => {
+ // Fetching the latest task run log for running task runs of selected task.
+ for (const taskRun of flattenTaskRunList.value) {
+ if (taskRun.status === TaskRun_Status.RUNNING) {
+ const taskRunLog = await rolloutServiceClient.getTaskRunLog({
+ parent: taskRun.name,
+ });
+ taskRun.taskRunLog = taskRunLog;
+ }
+ }
+});
</script>
diff --git a/frontend/src/store/modules/v1/experimental-issue.ts b/frontend/src/store/modules/v1/experimental-issue.ts
index c20c3957ad..050e15d03b 100644
--- a/frontend/src/store/modules/v1/experimental-issue.ts
+++ b/frontend/src/store/modules/v1/experimental-issue.ts
@@ -16,11 +16,7 @@ import {
} from "@/types";
import type { Issue } from "@/types/proto/v1/issue_service";
import type { Plan } from "@/types/proto/v1/plan_service";
-import {
- TaskRun_Status,
- TaskRunLog,
- type Rollout,
-} from "@/types/proto/v1/rollout_service";
+import { TaskRunLog, type Rollout } from "@/types/proto/v1/rollout_service";
import {
extractProjectResourceName,
extractUserResourceName,
@@ -91,13 +87,6 @@ export const composeIssue = async (
...taskRun,
taskRunLog: TaskRunLog.fromPartial({}),
};
- // Fetching task run log for running task runs.
- if (composed.status === TaskRun_Status.RUNNING) {
- const taskRunLog = await rolloutServiceClient.getTaskRunLog({
- parent: taskRun.name,
- });
- composed.taskRunLog = taskRunLog;
- }
composedTaskRuns.push(composed);
}
issue.rolloutTaskRunList = composedTaskRuns;