Просмотр исходного кода

display pod memory request exceeded error message

jusrhee 5 лет назад
Родитель
Сommit
dcf29c6e44

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

@@ -368,7 +368,7 @@ export default class ExpandedChart extends Component<PropsType, StateType> {
     // Append universal tabs
     // Append universal tabs
     tabOptions.push(
     tabOptions.push(
       { label: "Status", value: "status" },
       { label: "Status", value: "status" },
-      { label: "Metrics", value: "metrics" },
+      //{ label: "Metrics", value: "metrics" },
       { label: "Chart Overview", value: "graph" }
       { label: "Chart Overview", value: "graph" }
     );
     );
 
 

+ 8 - 3
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/ControllerTab.tsx

@@ -11,6 +11,7 @@ type PropsType = {
   selectPod: Function;
   selectPod: Function;
   isLast?: boolean;
   isLast?: boolean;
   isFirst?: boolean;
   isFirst?: boolean;
+  setPodError: (x: string) => void;
 };
 };
 
 
 type StateType = {
 type StateType = {
@@ -102,16 +103,18 @@ export default class ControllerTab extends Component<PropsType, StateType> {
   };
   };
 
 
   getPodStatus = (status: any) => {
   getPodStatus = (status: any) => {
-    if (status?.phase == "Pending" && status?.containerStatuses !== undefined) {
+    if (status?.phase === "Pending" && status?.containerStatuses !== undefined) {
       return status.containerStatuses[0].state.waiting.reason;
       return status.containerStatuses[0].state.waiting.reason;
       // return 'waiting'
       // return 'waiting'
+    } else if (status?.phase === "Pending") {
+      return "Pending"
     }
     }
 
 
-    if (status?.phase == "Failed") {
+    if (status?.phase === "Failed") {
       return "failed";
       return "failed";
     }
     }
 
 
-    if (status?.phase == "Running") {
+    if (status?.phase === "Running") {
       let collatedStatus = "running";
       let collatedStatus = "running";
 
 
       status?.containerStatuses?.forEach((s: any) => {
       status?.containerStatuses?.forEach((s: any) => {
@@ -150,6 +153,8 @@ export default class ControllerTab extends Component<PropsType, StateType> {
               key={pod.metadata?.name}
               key={pod.metadata?.name}
               selected={selectedPod?.metadata?.name === pod?.metadata?.name}
               selected={selectedPod?.metadata?.name === pod?.metadata?.name}
               onClick={() => {
               onClick={() => {
+                this.props.setPodError("");
+                (status === "failed" && pod.status?.message) && this.props.setPodError(pod.status?.message);
                 selectPod(pod);
                 selectPod(pod);
               }}
               }}
             >
             >

+ 5 - 2
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/Logs.tsx

@@ -4,6 +4,7 @@ import { Context } from "shared/Context";
 
 
 type PropsType = {
 type PropsType = {
   selectedPod: any;
   selectedPod: any;
+  podError: string;
 };
 };
 
 
 type StateType = {
 type StateType = {
@@ -40,7 +41,7 @@ export default class Logs extends Component<PropsType, StateType> {
       return <Message>Please select a pod to view its logs.</Message>;
       return <Message>Please select a pod to view its logs.</Message>;
     }
     }
     if (this.state.logs.length == 0) {
     if (this.state.logs.length == 0) {
-      return <Message>No logs to display from this pod.</Message>;
+      return <Message>{this.props.podError || "No logs to display from this pod."}</Message>;
     }
     }
     return this.state.logs.map((log, i) => {
     return this.state.logs.map((log, i) => {
       return <Log key={i}>{log}</Log>;
       return <Log key={i}>{log}</Log>;
@@ -206,9 +207,11 @@ const LogStream = styled.div`
 const Message = styled.div`
 const Message = styled.div`
   display: flex;
   display: flex;
   height: 100%;
   height: 100%;
-  width: 100%;
+  width: calc(100% - 150px);
   align-items: center;
   align-items: center;
   justify-content: center;
   justify-content: center;
+  margin-left: 75px;
+  text-align: center;
   color: #ffffff44;
   color: #ffffff44;
   font-size: 13px;
   font-size: 13px;
 `;
 `;

+ 4 - 0
dashboard/src/main/home/cluster-dashboard/expanded-chart/status/StatusSection.tsx

@@ -20,6 +20,7 @@ type StateType = {
   selectedPod: any;
   selectedPod: any;
   controllers: any[];
   controllers: any[];
   loading: boolean;
   loading: boolean;
+  podError: string;
 };
 };
 
 
 export default class StatusSection extends Component<PropsType, StateType> {
 export default class StatusSection extends Component<PropsType, StateType> {
@@ -29,11 +30,13 @@ export default class StatusSection extends Component<PropsType, StateType> {
     selectedPod: {} as any,
     selectedPod: {} as any,
     controllers: [] as any[],
     controllers: [] as any[],
     loading: true,
     loading: true,
+    podError: "",
   };
   };
 
 
   renderLogs = () => {
   renderLogs = () => {
     return (
     return (
       <Logs
       <Logs
+        podError={this.state.podError}
         key={this.state.selectedPod?.metadata?.name}
         key={this.state.selectedPod?.metadata?.name}
         selectedPod={this.state.selectedPod}
         selectedPod={this.state.selectedPod}
       />
       />
@@ -56,6 +59,7 @@ export default class StatusSection extends Component<PropsType, StateType> {
           controller={c}
           controller={c}
           isLast={i === this.state.controllers.length - 1}
           isLast={i === this.state.controllers.length - 1}
           isFirst={i === 0}
           isFirst={i === 0}
+          setPodError={(x: string) => this.setState({ podError: x })}
         />
         />
       );
       );
     });
     });

+ 2 - 2
dashboard/src/main/home/sidebar/Sidebar.tsx

@@ -441,7 +441,7 @@ const StyledSidebar = styled.section`
   animation-fill-mode: forwards;
   animation-fill-mode: forwards;
   @keyframes showSidebar {
   @keyframes showSidebar {
     from {
     from {
-      margin-left: -220px;
+      margin-left: -200px;
     }
     }
     to {
     to {
       margin-left: 0px;
       margin-left: 0px;
@@ -452,7 +452,7 @@ const StyledSidebar = styled.section`
       margin-left: 0px;
       margin-left: 0px;
     }
     }
     to {
     to {
-      margin-left: -220px;
+      margin-left: -200px;
     }
     }
   }
   }
 `;
 `;