sunguroku 4 лет назад
Родитель
Сommit
2fe1677cae
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

+ 9 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/ExpandedChart.tsx

@@ -59,6 +59,7 @@ const ExpandedChart: React.FC<Props> = (props) => {
     props.currentChart
     props.currentChart
   );
   );
   const [showRevisions, setShowRevisions] = useState<boolean>(false);
   const [showRevisions, setShowRevisions] = useState<boolean>(false);
+  const [loading, setLoading] = useState<boolean>(false);
   const [components, setComponents] = useState<ResourceType[]>([]);
   const [components, setComponents] = useState<ResourceType[]>([]);
   const [isPreview, setIsPreview] = useState<boolean>(false);
   const [isPreview, setIsPreview] = useState<boolean>(false);
   const [devOpsMode, setDevOpsMode] = useState<boolean>(
   const [devOpsMode, setDevOpsMode] = useState<boolean>(
@@ -194,6 +195,7 @@ const ExpandedChart: React.FC<Props> = (props) => {
   };
   };
 
 
   const updateComponents = async (currentChart: ChartType) => {
   const updateComponents = async (currentChart: ChartType) => {
+    setLoading(true);
     try {
     try {
       const res = await api.getChartComponents(
       const res = await api.getChartComponents(
         "<token>",
         "<token>",
@@ -209,8 +211,10 @@ const ExpandedChart: React.FC<Props> = (props) => {
         }
         }
       );
       );
       setComponents(res.data.Objects);
       setComponents(res.data.Objects);
+      setLoading(false);
     } catch (error) {
     } catch (error) {
       console.log(error);
       console.log(error);
+      setLoading(false);
     }
     }
   };
   };
 
 
@@ -522,12 +526,16 @@ const ExpandedChart: React.FC<Props> = (props) => {
       return c.Kind === "Service";
       return c.Kind === "Service";
     });
     });
 
 
-    if (!service?.Name || !service?.Namespace) {
+    if (loading) {
       return (
       return (
         <Url>
         <Url>
           <Bolded>Loading...</Bolded>
           <Bolded>Loading...</Bolded>
         </Url>
         </Url>
       );
       );
+    }    
+
+    if (!service?.Name || !service?.Namespace) {
+      return;
     }
     }
 
 
     return (
     return (