Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: moving ud containers logs as default in pods view #2378

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions ui/src/utils/fetcherHooks/podsViewFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,20 @@ export const usePodsViewFetch = (
const containers: string[] = [];
const containerSpecMap = new Map<string, PodContainerSpec>();

const containersList = JSON.parse(
JSON.stringify(pod?.spec?.containers)
);
const containersList: any[] = [];
pod?.spec?.initContainers
?.filter((initContainer: any) => initContainer?.restartPolicy === "Always")
?.filter(
(initContainer: any) =>
initContainer?.restartPolicy === "Always"
)
?.forEach((container: any) => containersList.push(container));

const specContainers = JSON.parse(
JSON.stringify(pod?.spec?.containers)
);

containersList.push(...specContainers);

containersList?.forEach((container: any) => {
const cpu = container?.resources?.requests?.cpu;
let cpuParsed: undefined | number;
Expand Down Expand Up @@ -130,7 +137,7 @@ export const usePodsViewFetch = (

useEffect(() => {
fetchPods();
},[vertexId, requestKey, host]);
}, [vertexId, requestKey, host]);

useEffect(() => {
if (pods?.length) {
Expand Down Expand Up @@ -243,10 +250,10 @@ export const usePodsViewFetch = (
// Retry fetching pods details if there is an error
useEffect(() => {
const currentTime = Date.now();
if (podsDetailsErr && (currentTime - lastRetryTime > 5000)) {
if (podsDetailsErr && currentTime - lastRetryTime > 5000) {
const retryFetch = setTimeout(() => {
fetchPodDetails();
setLastRetryTime(currentTime);
fetchPodDetails();
setLastRetryTime(currentTime);
}, 5000);

return () => clearTimeout(retryFetch);
Expand Down
Loading