smitajoshi12 commented on code in PR #6724:
URL: https://github.com/apache/ozone/pull/6724#discussion_r1703852610


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/datanodes/decommissionSummary.tsx:
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { Descriptions, Popover, Tooltip } from 'antd';
+import { InfoCircleOutlined } from '@ant-design/icons';
+import { withRouter } from 'react-router-dom';
+import { RouteComponentProps } from 'react-router';
+import axios from 'axios';
+import { showDataFetchError } from '@/utils/common';
+
+interface IDecommissionSummaryProps extends RouteComponentProps<object> {
+  uuid: string;
+  isLoading: boolean;
+  summaryData: string[];
+  record: string[];
+}
+
+class DecommissionSummary extends React.Component<IDecommissionSummaryProps> {
+  constructor(props = {}) {
+    super(props);
+    this.state = {
+      uuid: this.props.uuid,
+      record: this.props.record,
+      isLoading: false,
+      summaryData: []
+    };
+  }
+
+  componentDidMount(): void {
+    this.setState({
+      isLoading: true
+    });
+    if (this.state.record && this.state.summaryData !== 'null' && 
this.state.summaryData !== 'undefined') {
+      this.fetchDecommissionSummary(this.state.uuid);
+    }
+  }
+
+  fetchDecommissionSummary = async (selectedUuid: any) => {
+    try {
+      const datanodeEndpoint = 
`/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`;
+      let infoDatanodeResponse = await axios.get(datanodeEndpoint);
+      let DatanodesDecommissionInfo = [];
+      DatanodesDecommissionInfo = infoDatanodeResponse && 
infoDatanodeResponse.data && 
infoDatanodeResponse.data.DatanodesDecommissionInfo[0];
+      this.setState({
+        loading: false,
+        summaryData: DatanodesDecommissionInfo
+      });
+    }
+    catch (error) {
+      this.setState({
+        loading: false,
+        summaryData: []
+      });
+      showDataFetchError(error.toString());
+    }
+  };
+
+  render() {
+    const { summaryData, uuid } = this.state;
+    let content;
+    
+    if ( summaryData && summaryData.length !== 0 && summaryData !== null && 
summaryData !== undefined && summaryData.datanodeDetails) {   
+      const { datanodeDetails, containers, metrics } = summaryData;
+      content = (
+        <Descriptions size="small" bordered column={1} title={`Decommission 
Status: DECOMMISSIONING`}>
+          <Descriptions.Item label="Datanode"> 
<b>{datanodeDetails.uuid}</b></Descriptions.Item>
+          <Descriptions.Item 
label="Location">({datanodeDetails.networkLocation}/{datanodeDetails.ipAddress}/{datanodeDetails.hostname})</Descriptions.Item>
+          {metrics !== null && metrics !== undefined && 
Object.keys(metrics).length !== 0 &&
+            <>
+              {<Descriptions.Item label="Decommissioning Started 
at">{metrics.decommissionStartTime}</Descriptions.Item>}
+              {<Descriptions.Item label="No. of Unclosed 
Pipelines">{metrics.numOfUnclosedPipelines}</Descriptions.Item>}
+              {<Descriptions.Item label="No. of Unclosed 
Containers">{metrics.numOfUnclosedContainers}</Descriptions.Item>}
+              {<Descriptions.Item label="No. of Under-Replicated 
Containers">{metrics.numOfUnderReplicatedContainers}</Descriptions.Item>}
+            </>
+          }
+          {
+            containers !== null && containers !== undefined && 
Object.keys(containers).length !== 0 &&

Review Comment:
   @devabhishekpal 
   Done the changes in latest commit 
https://github.com/apache/ozone/commit/3e08fb7b48adea2a78e0f77408427da00db453bf 
and done testing with local cluster data.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to