Skip to content

Commit

Permalink
Only show loading state for the first list container call (#199)
Browse files Browse the repository at this point in the history
Co-authored-by: Tio Pramayudi <[email protected]>
  • Loading branch information
tiopramayudi and tiopramayudi authored Nov 29, 2021
1 parent 68a2d65 commit 4623dc6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ui/src/components/logs/ContainerLogsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const ContainerLogsView = ({
tail_lines: "1000"
});

const [containerHaveBeenLoaded, setContainerHaveBeenLoaded] = useState(false);

const [
{ data: containers, isLoaded: containersLoaded },
getContainers
Expand All @@ -65,6 +67,9 @@ export const ContainerLogsView = ({

useEffect(
() => {
if (!containerHaveBeenLoaded) {
setContainerHaveBeenLoaded(containersLoaded);
}
if (containersLoaded && params.component_type === "") {
if (
containers.find(
Expand Down Expand Up @@ -176,7 +181,9 @@ export const ContainerLogsView = ({
</EuiTitle>

<EuiPageContent>
{componentTypes && componentTypes.length === 0 ? (
{!containerHaveBeenLoaded &&
componentTypes &&
componentTypes.length === 0 ? (
<EuiLoadingContent lines={4} />
) : logUrl && stackdriverUrl ? (
<EuiFlexGroup direction="column" gutterSize="none">
Expand Down

0 comments on commit 4623dc6

Please sign in to comment.