Alexander Belanger 5 лет назад
Родитель
Сommit
9db6dd12f1

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

@@ -236,7 +236,7 @@ export default class MetricsSection extends Component<PropsType, StateType> {
 
     if (this.state.selectedMetric == "nginx:errors") {
       pods = [this.state.selectedIngress?.name];
-      namespace = this.state.selectedIngress?.namespace || "default"
+      namespace = this.state.selectedIngress?.namespace || "default";
       shouldsum = false;
     }
 

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

@@ -29,7 +29,7 @@ export default class ControllerTab extends Component<PropsType, StateType> {
     pods: [] as any[],
     raw: [] as any[],
     showTooltip: [] as boolean[],
-    podPendingDelete: null as any,
+    podPendingDelete: null as any
   };
 
   updatePods = () => {
@@ -67,7 +67,7 @@ export default class ControllerTab extends Component<PropsType, StateType> {
       )
       .then(res => {
         let pods = res?.data?.map((pod: any) => {
-          console.log(pod?.metadata?.namespace)
+          console.log(pod?.metadata?.namespace);
           return {
             namespace: pod?.metadata?.namespace,
             name: pod?.metadata?.name,
@@ -95,7 +95,7 @@ export default class ControllerTab extends Component<PropsType, StateType> {
         setCurrentError(JSON.stringify(err));
         return;
       });
-  }
+  };
 
   componentDidMount() {
     this.updatePods();
@@ -168,27 +168,29 @@ export default class ControllerTab extends Component<PropsType, StateType> {
         {
           name: pod.metadata?.name,
           namespace: pod.metadata?.namespace,
-          id: this.context.currentProject.id,
+          id: this.context.currentProject.id
         }
       )
       .then(res => {
         this.updatePods();
+        this.setState({ podPendingDelete: null });
       })
       .catch(err => {
         this.context.setCurrentError(JSON.stringify(err));
+        this.setState({ podPendingDelete: null });
       });
-  }
+  };
 
   renderDeleteButton = (pod: any) => {
     return (
-      <CloseIcon 
+      <CloseIcon
         className="material-icons-outlined"
         onClick={() => this.setState({ podPendingDelete: pod })}
       >
         close
       </CloseIcon>
     );
-  }
+  };
 
   render() {
     let { controller, selectedPod, isLast, selectPod, isFirst } = this.props;
@@ -211,7 +213,7 @@ export default class ControllerTab extends Component<PropsType, StateType> {
         {this.state.raw.map((pod, i) => {
           let status = this.getPodStatus(pod.status);
           if (i === 2) {
-            status = "failed"
+            status = "failed";
           }
           return (
             <Tab

+ 3 - 5
dashboard/src/main/home/navbar/Navbar.tsx

@@ -44,15 +44,13 @@ export default class Navbar extends Component<PropsType, StateType> {
     return (
       <StyledNavbar>
         <Feedback currentView={this.props.currentView} />
-        <NavButton 
-          selected={this.state.showDropdown} 
+        <NavButton
+          selected={this.state.showDropdown}
           onClick={() =>
             this.setState({ showDropdown: !this.state.showDropdown })
           }
         >
-          <I className="material-icons-outlined">
-            account_circle
-          </I>
+          <I className="material-icons-outlined">account_circle</I>
           {this.context.user.email}
           {this.renderSettingsDropdown()}
         </NavButton>

+ 4 - 4
dashboard/src/shared/api.tsx

@@ -221,10 +221,10 @@ const deleteInvite = baseApi<{}, { id: number; invId: number }>(
 );
 
 const deletePod = baseApi<
-{
-  cluster_id: number;
-},
-{ name: string; namespace: string; id: number }
+  {
+    cluster_id: number;
+  },
+  { name: string; namespace: string; id: number }
 >("DELETE", pathParams => {
   return `/api/projects/${pathParams.id}/k8s/pods/${pathParams.namespace}/${pathParams.name}`;
 });

+ 3 - 1
dashboard/src/shared/baseApi.tsx

@@ -31,7 +31,9 @@ export const baseApi = <T extends {}, S = {}>(
         }
       });
     } else if (requestType === "DELETE") {
-      return axios.delete(endpointString + "?" + qs.stringify(params, { arrayFormat: "repeat" }));
+      return axios.delete(
+        endpointString + "?" + qs.stringify(params, { arrayFormat: "repeat" })
+      );
     } else {
       return axios.get(endpointString, {
         params,