Skip to content

Commit

Permalink
fix: addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulkeswani101 committed Sep 20, 2024
1 parent 41eaed7 commit f459e1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/LogDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ function LogDetail({
)}
{selectedView === VIEW_TYPES.INFRAMETRICS && (
<InfraMetrics
clusterName={log.resources_string?.[RESOURCE_KEYS.CLUSTER_NAME] as string}
podName={log.resources_string?.[RESOURCE_KEYS.POD_NAME] as string}
nodeName={log.resources_string?.[RESOURCE_KEYS.NODE_NAME] as string}
hostName={log.resources_string?.[RESOURCE_KEYS.HOST_NAME] as string}
clusterName={log.resources_string?.[RESOURCE_KEYS.CLUSTER_NAME] || ''}
podName={log.resources_string?.[RESOURCE_KEYS.POD_NAME] || ''}
nodeName={log.resources_string?.[RESOURCE_KEYS.NODE_NAME] || ''}
hostName={log.resources_string?.[RESOURCE_KEYS.HOST_NAME] || ''}
logLineTimestamp={log.timestamp.toString()}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ function InfraMetrics({
clusterName,
logLineTimestamp,
}: MetricsDataProps): JSX.Element {
const initialView = podName ? VIEW_TYPES.POD : VIEW_TYPES.NODE;
const [selectedView, setSelectedView] = useState<string>(initialView);
const [selectedView, setSelectedView] = useState<string>(() =>
podName ? VIEW_TYPES.POD : VIEW_TYPES.NODE,
);

const handleModeChange = (e: RadioChangeEvent): void => {
setSelectedView(e.target.value);
Expand Down

0 comments on commit f459e1d

Please sign in to comment.