Kaynağa Gözat

Fix job logging (#3410)

Feroze Mohideen 2 yıl önce
ebeveyn
işleme
17acf6b1d0

+ 1 - 1
dashboard/src/main/home/app-dashboard/expanded-app/expanded-job/ExpandedJobRun.tsx

@@ -254,7 +254,7 @@ const ExpandedJobRun = ({
         <LogsSection
           isFullscreen={false}
           setIsFullscreen={() => { }}
-          overridingPodName={pods[0]?.metadata?.name || jobRun.metadata?.name}
+          overridingPodSelector={pods[0]?.metadata?.name || jobRun.metadata?.name}
           currentChart={currentChart}
           initData={initData}
         />

+ 1 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/jobs/ExpandedJobRun.tsx

@@ -251,7 +251,7 @@ const ExpandedJobRun = ({
         <LogsSection
           isFullscreen={false}
           setIsFullscreen={() => { }}
-          overridingPodName={pods[0]?.metadata?.name || jobRun.metadata?.name}
+          overridingPodSelector={jobRun.metadata?.name}
           currentChart={currentChart}
           initData={initData}
         />

+ 3 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/logs-section/LogsSection.tsx

@@ -34,7 +34,7 @@ type Props = {
   setIsFullscreen: (x: boolean) => void;
   initData?: InitLogData;
   setInitData?: (initData: InitLogData) => void;
-  overridingPodName?: string;
+  overridingPodSelector?: string;
 };
 
 const escapeRegExp = (str: string) => {
@@ -103,7 +103,7 @@ const LogsSection: React.FC<Props> = ({
   setIsFullscreen,
   initData = {},
   setInitData,
-  overridingPodName,
+  overridingPodSelector,
 }) => {
   const scrollToBottomRef = useRef<HTMLDivElement | undefined>(undefined);
   const { currentProject, currentCluster } = useContext(Context);
@@ -125,7 +125,7 @@ const LogsSection: React.FC<Props> = ({
   };
 
   const { logs, refresh, moveCursor, paginationInfo } = useLogs(
-    "",
+    overridingPodSelector ?? "",
     "",
     enteredSearchText,
     notify,

+ 3 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/logs-section/useAgentLogs.ts

@@ -91,7 +91,9 @@ export const useLogs = (
     nextCursor: null,
   });
 
-  currentPod = currentChart.name;
+  if (currentPod === "") {
+    currentPod = currentChart.name;
+  }
   namespace = currentChart.namespace;
 
   // if we are live: