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


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/errorBoundary/errorBoundary.tsx:
##########
@@ -0,0 +1,52 @@
+/*
+ * 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";
+
+type ErrorProps = {
+  fallback: string | React.ReactNode;
+  children: React.ReactNode;
+}
+
+type ErrorState = {
+  hasError: boolean;
+}
+
+class ErrorBoundary extends React.Component<ErrorProps, ErrorState>{
+  constructor(props: ErrorProps) {
+    super(props);
+    this.state = { hasError: false }
+  }
+
+  static getDerivedStateFromError(error: Error) {
+    return { hasError: true }
+  }
+
+  componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {
+    console.error(error, errorInfo)
+  }
+
+  render(): React.ReactNode {
+    if (this.state.hasError) {

Review Comment:
   @devabhishekpal 
   Could you add test case in PR screenshot how fallback string looks on UI.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,527 @@
+/*
+ * 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, { useEffect, useState } from 'react';
+import moment from 'moment';
+import filesize from 'filesize';
+import axios, { CanceledError } from 'axios';
+import { Row, Col, Button } from 'antd';
+import {
+  CheckCircleFilled,
+  WarningFilled
+} from '@ant-design/icons';
+import { Link } from 'react-router-dom';
+
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+import OverviewStorageCard from 
'@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from 
'@/v2/components/overviewCard/overviewSimpleCard';
+
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from 
'@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from 
'@/v2/types/overview.types';
+
+import './overview.less';
+
+
+const size = filesize.partial({ round: 1 });
+
+const getHealthIcon = (value: string): React.ReactElement => {
+  const values = value.split('/');
+  if (values.length == 2 && values[0] < values[1]) {
+    return (
+      <>
+        <div className='icon-warning' style={{
+          fontSize: '20px',
+          alignItems: 'center'
+        }}>
+          <WarningFilled style={{
+            marginRight: '5px'
+          }} />
+          Unhealthy
+        </div>
+      </>
+    )
+  }
+  return (
+    <div className='icon-success' style={{
+      fontSize: '20px',
+      alignItems: 'center'
+    }}>
+      <CheckCircleFilled style={{
+        marginRight: '5px'
+      }} />
+      Healthy
+    </div>
+  )
+}
+
+const checkResponseError = (responses: Awaited<Promise<any>>[]) => {
+  const responseError = responses.filter(
+    (resp) => resp.status === 'rejected'
+  );
+
+  if (responseError.length !== 0) {
+    responseError.forEach((err) => {
+      if (err.reason.toString().includes("CanceledError")) {
+        throw new CanceledError('canceled', "ERR_CANCELED");
+      }
+      else {
+        const reqMethod = err.reason.config.method;
+        const reqURL = err.reason.config.url
+        showDataFetchError(
+          `Failed to ${reqMethod} URL ${reqURL}\n${err.reason.toString()}`
+        );
+      }
+    })
+  }
+}
+
+const Overview: React.FC<{}> = () => {
+
+  let cancelOverviewSignal: AbortController;
+  let cancelOMDBSyncSignal: AbortController;
+
+  const [state, setState] = useState<OverviewState>({
+    loading: false,
+    datanodes: '',
+    pipelines: 0,
+    containers: 0,
+    volumes: 0,
+    buckets: 0,
+    keys: 0,
+    missingContainersCount: 0,
+    lastRefreshed: 0,
+    lastUpdatedOMDBDelta: 0,
+    lastUpdatedOMDBFull: 0,
+    omStatus: '',
+    openContainers: 0,
+    deletedContainers: 0,
+    openSummarytotalUnrepSize: 0,
+    openSummarytotalRepSize: 0,
+    openSummarytotalOpenKeys: 0,
+    deletePendingSummarytotalUnrepSize: 0,
+    deletePendingSummarytotalRepSize: 0,
+    deletePendingSummarytotalDeletedKeys: 0,
+    scmServiceId: '',
+    omServiceId: ''
+  })
+  const [storageReport, setStorageReport] = useState<StorageReport>({
+    capacity: 0,
+    used: 0,
+    remaining: 0,
+    committed: 0
+  })
+
+  // Component mounted, fetch initial data
+  useEffect(() => {
+    loadOverviewPageData();
+    autoReloadHelper.startPolling();
+    return (() => {
+      // Component will Un-mount
+      autoReloadHelper.stopPolling();
+      cancelRequests([
+        cancelOMDBSyncSignal,
+        cancelOverviewSignal
+      ]);
+    })
+  }, [])
+
+  const loadOverviewPageData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    // Cancel any previous pending requests
+    cancelRequests([
+      cancelOMDBSyncSignal,
+      cancelOverviewSignal
+    ]);
+
+    const { requests, controller } = PromiseAllSettledGetHelper([
+      '/api/v1/clusterState',
+      '/api/v1/task/status',
+      '/api/v1/keys/open/summary',
+      '/api/v1/keys/deletePending/summary'
+    ], cancelOverviewSignal);
+    cancelOverviewSignal = controller;
+
+    requests.then(axios.spread((
+      clusterStateResponse: Awaited<Promise<any>>,
+      taskstatusResponse: Awaited<Promise<any>>,
+      openResponse: Awaited<Promise<any>>,
+      deletePendingResponse: Awaited<Promise<any>>
+    ) => {
+
+      checkResponseError([
+        clusterStateResponse,
+        taskstatusResponse,
+        openResponse,
+        deletePendingResponse
+      ]);
+
+      const clusterState: ClusterStateResponse = 
clusterStateResponse.value?.data ?? {
+        missingContainers: 'N/A',
+        totalDatanodes: 'N/A',
+        healthyDatanodes: 'N/A',
+        pipelines: 'N/A',
+        storageReport: {
+          capacity: 0,
+          used: 0,
+          remaining: 0,
+          committed: 0
+        },
+        containers: 'N/A',
+        volumes: 'N/A',
+        buckets: 'N/A',
+        keys: 'N/A',
+        openContainers: 'N/A',
+        deletedContainers: 'N/A',
+        keysPendingDeletion: 'N/A',
+        scmServiceId: 'N/A',
+        omServiceId: 'N/A',
+      };
+      const taskStatus = taskstatusResponse.value?.data ?? [{
+        taskName: 'N/A',
+        lastUpdatedTimestamp: 0,
+        lastUpdatedSeqNumber: 0
+      }];
+      const missingContainersCount = clusterState.missingContainers;
+      const omDBDeltaObject = taskStatus && taskStatus.find((item: any) => 
item.taskName === 'OmDeltaRequest');
+      const omDBFullObject = taskStatus && taskStatus.find((item: any) => 
item.taskName === 'OmSnapshotRequest');
+
+      setState({
+        ...state,
+        loading: false,
+        datanodes: 
`${clusterState.healthyDatanodes}/${clusterState.totalDatanodes}`,
+        pipelines: clusterState.pipelines,
+        containers: clusterState.containers,
+        volumes: clusterState.volumes,
+        buckets: clusterState.buckets,
+        keys: clusterState.keys,
+        missingContainersCount: missingContainersCount,
+        openContainers: clusterState.openContainers,
+        deletedContainers: clusterState.deletedContainers,
+        lastRefreshed: Number(moment()),
+        lastUpdatedOMDBDelta: omDBDeltaObject?.lastUpdatedTimestamp,
+        lastUpdatedOMDBFull: omDBFullObject?.lastUpdatedTimestamp,
+        openSummarytotalUnrepSize: 
openResponse?.value?.data?.totalUnreplicatedDataSize,
+        openSummarytotalRepSize: 
openResponse?.value?.data?.totalReplicatedDataSize,
+        openSummarytotalOpenKeys: openResponse?.value?.data?.totalOpenKeys,
+        deletePendingSummarytotalUnrepSize: 
deletePendingResponse?.value?.data?.totalUnreplicatedDataSize,
+        deletePendingSummarytotalRepSize: 
deletePendingResponse?.value?.data?.totalReplicatedDataSize,
+        deletePendingSummarytotalDeletedKeys: 
deletePendingResponse?.value?.data?.totalDeletedKeys,
+        scmServiceId: clusterState?.scmServiceId,
+        omServiceId: clusterState?.omServiceId
+      });
+      setStorageReport({
+        ...storageReport,
+        ...clusterState.storageReport
+      });
+    })).catch((error: Error) => {
+      setState({
+        ...state,
+        loading: false
+      });
+      showDataFetchError(error.toString());
+    });
+  }
+
+  let autoReloadHelper: AutoReloadHelper = new 
AutoReloadHelper(loadOverviewPageData);
+
+  const syncOmData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    const { request, controller } = AxiosGetHelper(
+      '/api/v1/triggerdbsync/om',
+      cancelOMDBSyncSignal,
+      'OM-DB Sync request cancelled because data was updated'
+    );
+    cancelOMDBSyncSignal = controller;
+
+    request.then(omStatusResponse => {
+      const omStatus = omStatusResponse.data;
+      setState({
+        ...state,
+        loading: false,
+        omStatus: omStatus
+      });
+    }).catch((error: Error) => {
+      setState({
+        ...state,
+        loading: false
+      });
+      showDataFetchError(error.toString());
+    });
+  };
+
+  const {
+    loading, datanodes, pipelines,
+    containers, volumes, buckets,
+    openSummarytotalUnrepSize,
+    openSummarytotalRepSize,
+    openSummarytotalOpenKeys,
+    deletePendingSummarytotalUnrepSize,
+    deletePendingSummarytotalRepSize,
+    deletePendingSummarytotalDeletedKeys,
+    keys, missingContainersCount,
+    lastRefreshed, lastUpdatedOMDBDelta,
+    lastUpdatedOMDBFull,
+    omStatus, openContainers,
+    deletedContainers, scmServiceId, omServiceId
+  } = state;
+
+  const healthCardIndicators = (
+    <>
+      <Col span={14}>
+        Datanodes
+        {getHealthIcon(datanodes)}
+      </Col>
+      <Col span={10}>
+        Containers
+        {getHealthIcon(`${(containers - 
missingContainersCount)}/${containers}`)}
+      </Col>
+    </>
+  )
+
+  const datanodesLink = (
+    <Button
+      type='link'
+      size='small'>
+      <Link to='/Datanodes'> View More </Link>
+    </Button>
+  )
+
+  const containersLink = (missingContainersCount > 0)
+    ? (
+      <Button
+        type='link'
+        size='small'>
+        <Link to='/MissingContainers'> View More</Link>
+      </Button>
+    ) : (
+      <Button
+        type='link'
+        size='small'>
+        <Link to='/Containers'> View More</Link>
+      </Button>
+    )
+
+  return (
+    <>
+      <div className='page-header-v2'>
+        Overview
+        <AutoReloadPanel isLoading={loading} lastRefreshed={lastRefreshed}
+          lastUpdatedOMDBDelta={lastUpdatedOMDBDelta} 
lastUpdatedOMDBFull={lastUpdatedOMDBFull}
+          togglePolling={autoReloadHelper.handleAutoReloadToggle} 
onReload={loadOverviewPageData} omSyncLoad={syncOmData} omStatus={omStatus} />
+      </div>
+      <div style={{ padding: '24px' }}>
+        <Row
+          align='stretch'
+          gutter={[
+            {
+              xs: 24,
+              sm: 24,
+              md: 16,
+              lg: 16,
+              xl: 16
+            }, 20]}>
+          <Col xs={24} sm={24} md={24} lg={10} xl={10}>
+            <OverviewTableCard
+              title='Health'
+              data={healthCardIndicators}
+              showHeader={true}
+              columns={[
+                {
+                  title: '',
+                  dataIndex: 'name',
+                  key: 'name'
+                },
+                {
+                  title: 'Available',
+                  dataIndex: 'value',
+                  key: 'value',
+                  align: 'right'
+                },
+                {
+                  title: 'Actions',
+                  dataIndex: 'action',
+                  key: 'action',
+                  align: 'right'
+                }
+              ]}
+              tableData={[
+                {
+                  key: 'datanodes',
+                  name: 'Datanodes',
+                  value: datanodes,
+                  action: datanodesLink
+                },
+                {
+                  key: 'containers',
+                  name: 'Containers',
+                  value: `${(containers - 
missingContainersCount)}/${containers}`,
+                  action: containersLink
+                }
+              ]}
+            />
+          </Col>
+          <Col xs={24} sm={24} md={24} lg={14} xl={14}>
+            <OverviewStorageCard storageReport={storageReport} 
loading={loading} />
+          </Col>
+        </Row>
+        <Row gutter={[
+          {
+            xs: 24,
+            sm: 24,
+            md: 16,
+            lg: 16,
+            xl: 16
+          }, 20]}>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Volumes'
+              icon='inbox'
+              loading={loading}
+              data={volumes}
+              linkToUrl='/Volumes' />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Buckets'
+              icon='folder-open'
+              loading={loading}
+              data={buckets}
+              linkToUrl='/Buckets' />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Keys'
+              icon='file-text'
+              loading={loading}
+              data={keys} />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Pipelines'
+              icon='deployment-unit'
+              loading={loading}
+              data={pipelines}
+              linkToUrl='/Pipelines' />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Deleted Containers'
+              icon='delete'
+              loading={loading}
+              data={deletedContainers} />
+          </Col>
+        </Row>
+        <Row gutter={[
+          {
+            xs: 24,
+            sm: 24,
+            md: 16,
+            lg: 16,
+            xl: 16
+          }, 20]}>
+          <Col xs={24} sm={24} md={24} lg={12} xl={12}>
+            <OverviewTableCard

Review Comment:
   @devabhishekpal 
   Can we give Name OverviewTableSummaryCard so easily we can identify.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,527 @@
+/*
+ * 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, { useEffect, useState } from 'react';
+import moment from 'moment';
+import filesize from 'filesize';
+import axios, { CanceledError } from 'axios';
+import { Row, Col, Button } from 'antd';
+import {
+  CheckCircleFilled,
+  WarningFilled
+} from '@ant-design/icons';
+import { Link } from 'react-router-dom';
+
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+import OverviewStorageCard from 
'@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from 
'@/v2/components/overviewCard/overviewSimpleCard';
+
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from 
'@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from 
'@/v2/types/overview.types';
+
+import './overview.less';
+
+
+const size = filesize.partial({ round: 1 });
+
+const getHealthIcon = (value: string): React.ReactElement => {
+  const values = value.split('/');
+  if (values.length == 2 && values[0] < values[1]) {
+    return (
+      <>
+        <div className='icon-warning' style={{
+          fontSize: '20px',
+          alignItems: 'center'
+        }}>
+          <WarningFilled style={{
+            marginRight: '5px'
+          }} />
+          Unhealthy
+        </div>
+      </>
+    )
+  }
+  return (
+    <div className='icon-success' style={{
+      fontSize: '20px',
+      alignItems: 'center'
+    }}>
+      <CheckCircleFilled style={{
+        marginRight: '5px'
+      }} />
+      Healthy
+    </div>
+  )
+}
+
+const checkResponseError = (responses: Awaited<Promise<any>>[]) => {
+  const responseError = responses.filter(
+    (resp) => resp.status === 'rejected'
+  );
+
+  if (responseError.length !== 0) {
+    responseError.forEach((err) => {
+      if (err.reason.toString().includes("CanceledError")) {
+        throw new CanceledError('canceled', "ERR_CANCELED");
+      }
+      else {
+        const reqMethod = err.reason.config.method;
+        const reqURL = err.reason.config.url
+        showDataFetchError(
+          `Failed to ${reqMethod} URL ${reqURL}\n${err.reason.toString()}`
+        );
+      }
+    })
+  }
+}
+
+const Overview: React.FC<{}> = () => {
+
+  let cancelOverviewSignal: AbortController;
+  let cancelOMDBSyncSignal: AbortController;
+
+  const [state, setState] = useState<OverviewState>({
+    loading: false,
+    datanodes: '',
+    pipelines: 0,
+    containers: 0,
+    volumes: 0,
+    buckets: 0,
+    keys: 0,
+    missingContainersCount: 0,
+    lastRefreshed: 0,
+    lastUpdatedOMDBDelta: 0,
+    lastUpdatedOMDBFull: 0,
+    omStatus: '',
+    openContainers: 0,
+    deletedContainers: 0,
+    openSummarytotalUnrepSize: 0,
+    openSummarytotalRepSize: 0,
+    openSummarytotalOpenKeys: 0,
+    deletePendingSummarytotalUnrepSize: 0,
+    deletePendingSummarytotalRepSize: 0,
+    deletePendingSummarytotalDeletedKeys: 0,
+    scmServiceId: '',
+    omServiceId: ''
+  })
+  const [storageReport, setStorageReport] = useState<StorageReport>({
+    capacity: 0,
+    used: 0,
+    remaining: 0,
+    committed: 0
+  })
+
+  // Component mounted, fetch initial data
+  useEffect(() => {
+    loadOverviewPageData();
+    autoReloadHelper.startPolling();
+    return (() => {
+      // Component will Un-mount
+      autoReloadHelper.stopPolling();
+      cancelRequests([
+        cancelOMDBSyncSignal,
+        cancelOverviewSignal
+      ]);
+    })
+  }, [])
+
+  const loadOverviewPageData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    // Cancel any previous pending requests
+    cancelRequests([
+      cancelOMDBSyncSignal,
+      cancelOverviewSignal
+    ]);
+
+    const { requests, controller } = PromiseAllSettledGetHelper([
+      '/api/v1/clusterState',
+      '/api/v1/task/status',
+      '/api/v1/keys/open/summary',
+      '/api/v1/keys/deletePending/summary'

Review Comment:
   If we try to fail deltepending/summary api  we can Invalid number error 
message can you check
   



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,527 @@
+/*
+ * 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, { useEffect, useState } from 'react';
+import moment from 'moment';
+import filesize from 'filesize';
+import axios, { CanceledError } from 'axios';
+import { Row, Col, Button } from 'antd';
+import {
+  CheckCircleFilled,
+  WarningFilled
+} from '@ant-design/icons';
+import { Link } from 'react-router-dom';
+
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+import OverviewStorageCard from 
'@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from 
'@/v2/components/overviewCard/overviewSimpleCard';
+
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from 
'@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from 
'@/v2/types/overview.types';
+
+import './overview.less';
+
+
+const size = filesize.partial({ round: 1 });
+
+const getHealthIcon = (value: string): React.ReactElement => {
+  const values = value.split('/');
+  if (values.length == 2 && values[0] < values[1]) {
+    return (
+      <>
+        <div className='icon-warning' style={{
+          fontSize: '20px',
+          alignItems: 'center'
+        }}>
+          <WarningFilled style={{
+            marginRight: '5px'
+          }} />
+          Unhealthy
+        </div>
+      </>
+    )
+  }
+  return (
+    <div className='icon-success' style={{
+      fontSize: '20px',
+      alignItems: 'center'
+    }}>
+      <CheckCircleFilled style={{
+        marginRight: '5px'
+      }} />
+      Healthy
+    </div>
+  )
+}
+
+const checkResponseError = (responses: Awaited<Promise<any>>[]) => {
+  const responseError = responses.filter(
+    (resp) => resp.status === 'rejected'
+  );
+
+  if (responseError.length !== 0) {
+    responseError.forEach((err) => {
+      if (err.reason.toString().includes("CanceledError")) {
+        throw new CanceledError('canceled', "ERR_CANCELED");
+      }
+      else {
+        const reqMethod = err.reason.config.method;
+        const reqURL = err.reason.config.url
+        showDataFetchError(
+          `Failed to ${reqMethod} URL ${reqURL}\n${err.reason.toString()}`
+        );
+      }
+    })
+  }
+}
+
+const Overview: React.FC<{}> = () => {
+
+  let cancelOverviewSignal: AbortController;
+  let cancelOMDBSyncSignal: AbortController;
+
+  const [state, setState] = useState<OverviewState>({
+    loading: false,
+    datanodes: '',
+    pipelines: 0,
+    containers: 0,
+    volumes: 0,
+    buckets: 0,
+    keys: 0,
+    missingContainersCount: 0,
+    lastRefreshed: 0,
+    lastUpdatedOMDBDelta: 0,
+    lastUpdatedOMDBFull: 0,
+    omStatus: '',
+    openContainers: 0,
+    deletedContainers: 0,
+    openSummarytotalUnrepSize: 0,
+    openSummarytotalRepSize: 0,
+    openSummarytotalOpenKeys: 0,
+    deletePendingSummarytotalUnrepSize: 0,
+    deletePendingSummarytotalRepSize: 0,
+    deletePendingSummarytotalDeletedKeys: 0,
+    scmServiceId: '',
+    omServiceId: ''
+  })
+  const [storageReport, setStorageReport] = useState<StorageReport>({
+    capacity: 0,
+    used: 0,
+    remaining: 0,
+    committed: 0
+  })
+
+  // Component mounted, fetch initial data
+  useEffect(() => {
+    loadOverviewPageData();
+    autoReloadHelper.startPolling();
+    return (() => {
+      // Component will Un-mount
+      autoReloadHelper.stopPolling();
+      cancelRequests([
+        cancelOMDBSyncSignal,
+        cancelOverviewSignal
+      ]);
+    })
+  }, [])
+
+  const loadOverviewPageData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    // Cancel any previous pending requests
+    cancelRequests([
+      cancelOMDBSyncSignal,
+      cancelOverviewSignal
+    ]);
+
+    const { requests, controller } = PromiseAllSettledGetHelper([
+      '/api/v1/clusterState',
+      '/api/v1/task/status',
+      '/api/v1/keys/open/summary',
+      '/api/v1/keys/deletePending/summary'
+    ], cancelOverviewSignal);
+    cancelOverviewSignal = controller;
+
+    requests.then(axios.spread((
+      clusterStateResponse: Awaited<Promise<any>>,
+      taskstatusResponse: Awaited<Promise<any>>,
+      openResponse: Awaited<Promise<any>>,
+      deletePendingResponse: Awaited<Promise<any>>
+    ) => {
+
+      checkResponseError([
+        clusterStateResponse,
+        taskstatusResponse,
+        openResponse,
+        deletePendingResponse
+      ]);
+
+      const clusterState: ClusterStateResponse = 
clusterStateResponse.value?.data ?? {
+        missingContainers: 'N/A',
+        totalDatanodes: 'N/A',
+        healthyDatanodes: 'N/A',
+        pipelines: 'N/A',
+        storageReport: {
+          capacity: 0,
+          used: 0,
+          remaining: 0,
+          committed: 0
+        },
+        containers: 'N/A',
+        volumes: 'N/A',
+        buckets: 'N/A',
+        keys: 'N/A',
+        openContainers: 'N/A',
+        deletedContainers: 'N/A',
+        keysPendingDeletion: 'N/A',
+        scmServiceId: 'N/A',
+        omServiceId: 'N/A',
+      };
+      const taskStatus = taskstatusResponse.value?.data ?? [{
+        taskName: 'N/A',
+        lastUpdatedTimestamp: 0,
+        lastUpdatedSeqNumber: 0
+      }];
+      const missingContainersCount = clusterState.missingContainers;
+      const omDBDeltaObject = taskStatus && taskStatus.find((item: any) => 
item.taskName === 'OmDeltaRequest');
+      const omDBFullObject = taskStatus && taskStatus.find((item: any) => 
item.taskName === 'OmSnapshotRequest');
+
+      setState({
+        ...state,
+        loading: false,
+        datanodes: 
`${clusterState.healthyDatanodes}/${clusterState.totalDatanodes}`,
+        pipelines: clusterState.pipelines,
+        containers: clusterState.containers,
+        volumes: clusterState.volumes,
+        buckets: clusterState.buckets,
+        keys: clusterState.keys,
+        missingContainersCount: missingContainersCount,
+        openContainers: clusterState.openContainers,
+        deletedContainers: clusterState.deletedContainers,
+        lastRefreshed: Number(moment()),
+        lastUpdatedOMDBDelta: omDBDeltaObject?.lastUpdatedTimestamp,
+        lastUpdatedOMDBFull: omDBFullObject?.lastUpdatedTimestamp,
+        openSummarytotalUnrepSize: 
openResponse?.value?.data?.totalUnreplicatedDataSize,
+        openSummarytotalRepSize: 
openResponse?.value?.data?.totalReplicatedDataSize,
+        openSummarytotalOpenKeys: openResponse?.value?.data?.totalOpenKeys,
+        deletePendingSummarytotalUnrepSize: 
deletePendingResponse?.value?.data?.totalUnreplicatedDataSize,
+        deletePendingSummarytotalRepSize: 
deletePendingResponse?.value?.data?.totalReplicatedDataSize,
+        deletePendingSummarytotalDeletedKeys: 
deletePendingResponse?.value?.data?.totalDeletedKeys,
+        scmServiceId: clusterState?.scmServiceId,
+        omServiceId: clusterState?.omServiceId
+      });
+      setStorageReport({
+        ...storageReport,
+        ...clusterState.storageReport
+      });
+    })).catch((error: Error) => {
+      setState({
+        ...state,
+        loading: false
+      });
+      showDataFetchError(error.toString());
+    });
+  }
+
+  let autoReloadHelper: AutoReloadHelper = new 
AutoReloadHelper(loadOverviewPageData);
+
+  const syncOmData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    const { request, controller } = AxiosGetHelper(
+      '/api/v1/triggerdbsync/om',
+      cancelOMDBSyncSignal,
+      'OM-DB Sync request cancelled because data was updated'
+    );
+    cancelOMDBSyncSignal = controller;
+
+    request.then(omStatusResponse => {
+      const omStatus = omStatusResponse.data;
+      setState({
+        ...state,
+        loading: false,
+        omStatus: omStatus
+      });
+    }).catch((error: Error) => {
+      setState({
+        ...state,
+        loading: false
+      });
+      showDataFetchError(error.toString());
+    });
+  };
+
+  const {
+    loading, datanodes, pipelines,
+    containers, volumes, buckets,
+    openSummarytotalUnrepSize,
+    openSummarytotalRepSize,
+    openSummarytotalOpenKeys,
+    deletePendingSummarytotalUnrepSize,
+    deletePendingSummarytotalRepSize,
+    deletePendingSummarytotalDeletedKeys,
+    keys, missingContainersCount,
+    lastRefreshed, lastUpdatedOMDBDelta,
+    lastUpdatedOMDBFull,
+    omStatus, openContainers,
+    deletedContainers, scmServiceId, omServiceId
+  } = state;
+
+  const healthCardIndicators = (
+    <>
+      <Col span={14}>
+        Datanodes
+        {getHealthIcon(datanodes)}
+      </Col>
+      <Col span={10}>
+        Containers
+        {getHealthIcon(`${(containers - 
missingContainersCount)}/${containers}`)}
+      </Col>
+    </>
+  )
+
+  const datanodesLink = (
+    <Button
+      type='link'
+      size='small'>
+      <Link to='/Datanodes'> View More </Link>
+    </Button>
+  )
+
+  const containersLink = (missingContainersCount > 0)
+    ? (
+      <Button
+        type='link'
+        size='small'>
+        <Link to='/MissingContainers'> View More</Link>
+      </Button>
+    ) : (
+      <Button
+        type='link'
+        size='small'>
+        <Link to='/Containers'> View More</Link>
+      </Button>
+    )
+
+  return (
+    <>
+      <div className='page-header-v2'>
+        Overview
+        <AutoReloadPanel isLoading={loading} lastRefreshed={lastRefreshed}
+          lastUpdatedOMDBDelta={lastUpdatedOMDBDelta} 
lastUpdatedOMDBFull={lastUpdatedOMDBFull}
+          togglePolling={autoReloadHelper.handleAutoReloadToggle} 
onReload={loadOverviewPageData} omSyncLoad={syncOmData} omStatus={omStatus} />
+      </div>
+      <div style={{ padding: '24px' }}>
+        <Row
+          align='stretch'
+          gutter={[
+            {
+              xs: 24,
+              sm: 24,
+              md: 16,
+              lg: 16,
+              xl: 16
+            }, 20]}>
+          <Col xs={24} sm={24} md={24} lg={10} xl={10}>
+            <OverviewTableCard
+              title='Health'
+              data={healthCardIndicators}
+              showHeader={true}
+              columns={[
+                {
+                  title: '',
+                  dataIndex: 'name',
+                  key: 'name'
+                },
+                {
+                  title: 'Available',
+                  dataIndex: 'value',
+                  key: 'value',
+                  align: 'right'
+                },
+                {
+                  title: 'Actions',
+                  dataIndex: 'action',
+                  key: 'action',
+                  align: 'right'
+                }
+              ]}
+              tableData={[
+                {
+                  key: 'datanodes',
+                  name: 'Datanodes',
+                  value: datanodes,
+                  action: datanodesLink
+                },
+                {
+                  key: 'containers',
+                  name: 'Containers',
+                  value: `${(containers - 
missingContainersCount)}/${containers}`,
+                  action: containersLink
+                }
+              ]}
+            />
+          </Col>
+          <Col xs={24} sm={24} md={24} lg={14} xl={14}>
+            <OverviewStorageCard storageReport={storageReport} 
loading={loading} />
+          </Col>
+        </Row>
+        <Row gutter={[
+          {
+            xs: 24,
+            sm: 24,
+            md: 16,
+            lg: 16,
+            xl: 16
+          }, 20]}>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Volumes'
+              icon='inbox'
+              loading={loading}
+              data={volumes}
+              linkToUrl='/Volumes' />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Buckets'
+              icon='folder-open'
+              loading={loading}
+              data={buckets}
+              linkToUrl='/Buckets' />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple
+              title='Keys'
+              icon='file-text'
+              loading={loading}
+              data={keys} />
+          </Col>
+          <Col flex="1 0 20%">
+            <OverviewCardSimple

Review Comment:
   Instead of OverviewCardSimple can we give appropriate name



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,527 @@
+/*
+ * 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, { useEffect, useState } from 'react';
+import moment from 'moment';
+import filesize from 'filesize';
+import axios, { CanceledError } from 'axios';
+import { Row, Col, Button } from 'antd';
+import {
+  CheckCircleFilled,
+  WarningFilled
+} from '@ant-design/icons';
+import { Link } from 'react-router-dom';
+
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+import OverviewStorageCard from 
'@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from 
'@/v2/components/overviewCard/overviewSimpleCard';
+
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from 
'@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from 
'@/v2/types/overview.types';
+
+import './overview.less';
+
+
+const size = filesize.partial({ round: 1 });
+
+const getHealthIcon = (value: string): React.ReactElement => {
+  const values = value.split('/');
+  if (values.length == 2 && values[0] < values[1]) {
+    return (
+      <>
+        <div className='icon-warning' style={{
+          fontSize: '20px',
+          alignItems: 'center'
+        }}>
+          <WarningFilled style={{
+            marginRight: '5px'
+          }} />
+          Unhealthy
+        </div>
+      </>
+    )
+  }
+  return (
+    <div className='icon-success' style={{
+      fontSize: '20px',
+      alignItems: 'center'
+    }}>
+      <CheckCircleFilled style={{
+        marginRight: '5px'
+      }} />
+      Healthy
+    </div>
+  )
+}
+
+const checkResponseError = (responses: Awaited<Promise<any>>[]) => {
+  const responseError = responses.filter(
+    (resp) => resp.status === 'rejected'
+  );
+
+  if (responseError.length !== 0) {
+    responseError.forEach((err) => {
+      if (err.reason.toString().includes("CanceledError")) {
+        throw new CanceledError('canceled', "ERR_CANCELED");
+      }
+      else {
+        const reqMethod = err.reason.config.method;
+        const reqURL = err.reason.config.url
+        showDataFetchError(
+          `Failed to ${reqMethod} URL ${reqURL}\n${err.reason.toString()}`
+        );
+      }
+    })
+  }
+}
+
+const Overview: React.FC<{}> = () => {
+
+  let cancelOverviewSignal: AbortController;
+  let cancelOMDBSyncSignal: AbortController;
+
+  const [state, setState] = useState<OverviewState>({
+    loading: false,
+    datanodes: '',
+    pipelines: 0,
+    containers: 0,
+    volumes: 0,
+    buckets: 0,
+    keys: 0,
+    missingContainersCount: 0,
+    lastRefreshed: 0,
+    lastUpdatedOMDBDelta: 0,
+    lastUpdatedOMDBFull: 0,
+    omStatus: '',
+    openContainers: 0,
+    deletedContainers: 0,
+    openSummarytotalUnrepSize: 0,
+    openSummarytotalRepSize: 0,
+    openSummarytotalOpenKeys: 0,
+    deletePendingSummarytotalUnrepSize: 0,
+    deletePendingSummarytotalRepSize: 0,
+    deletePendingSummarytotalDeletedKeys: 0,
+    scmServiceId: '',
+    omServiceId: ''
+  })
+  const [storageReport, setStorageReport] = useState<StorageReport>({
+    capacity: 0,
+    used: 0,
+    remaining: 0,
+    committed: 0
+  })
+
+  // Component mounted, fetch initial data
+  useEffect(() => {
+    loadOverviewPageData();
+    autoReloadHelper.startPolling();
+    return (() => {
+      // Component will Un-mount
+      autoReloadHelper.stopPolling();
+      cancelRequests([
+        cancelOMDBSyncSignal,
+        cancelOverviewSignal
+      ]);
+    })
+  }, [])
+
+  const loadOverviewPageData = () => {
+    setState({
+      ...state,
+      loading: true
+    });
+
+    // Cancel any previous pending requests
+    cancelRequests([
+      cancelOMDBSyncSignal,
+      cancelOverviewSignal
+    ]);
+
+    const { requests, controller } = PromiseAllSettledGetHelper([
+      '/api/v1/clusterState',
+      '/api/v1/task/status',
+      '/api/v1/keys/open/summary',
+      '/api/v1/keys/deletePending/summary'

Review Comment:
   Error is because of this code
   size of undefined
    tableData={[
                   {
                     key: 'total-replicated-data',
                     name: 'Total Replicated Data',
                     value: size(deletePendingSummarytotalRepSize)
                   },
                   {
                     key: 'total-unreplicated-data',
                     name: 'Total Unreplicated Data',
                     value: size(deletePendingSummarytotalUnrepSize)
                   },
                   {
                     key: 'delete-pending-keys',
                     name: 'Delete Pending Keys',
                     value: String(deletePendingSummarytotalDeletedKeys)
                   }
   



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/storageBar/storageBar.tsx:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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 { Progress } from 'antd';
+import filesize from 'filesize';
+import Icon from '@ant-design/icons';
+import { withRouter } from 'react-router-dom';
+import Tooltip from 'antd/lib/tooltip';
+
+import { FilledIcon } from '@/utils/themeIcons';
+import { getCapacityPercent } from '@/utils/common';
+import type { StorageReport } from '@/v2/types/overview.types';
+
+const size = filesize.partial({
+  standard: 'iec',
+  round: 1
+});
+
+type StorageReportProps = {
+  showMeta: boolean;
+} & StorageReport
+
+
+const StorageBar = (props: StorageReportProps = {
+  capacity: 0,
+  used: 0,
+  remaining: 0,
+  committed: 0,
+  showMeta: true,
+}) => {
+  const { capacity, used, remaining, committed, showMeta } = props;
+
+  const nonOzoneUsed = capacity - remaining - used;
+  const totalUsed = capacity - remaining;
+  const tooltip = (
+    <>
+      <div>
+        <Icon component={FilledIcon} className='ozone-used-bg' />
+        Ozone Used ({size(used)})
+      </div>
+      <div>
+        <Icon component={FilledIcon} className='non-ozone-used-bg' />
+        Non Ozone Used ({size(nonOzoneUsed)})
+      </div>
+      <div>
+        <Icon component={FilledIcon} className='remaining-bg' />
+        Remaining ({size(remaining)})
+      </div>
+      <div>
+        <Icon component={FilledIcon} className='committed-bg' />
+        Container Pre-allocated ({size(committed)})
+      </div>
+    </>
+  );
+  const metaElement = (showMeta) ? (
+    <div>
+      {size(used + nonOzoneUsed)} / {size(capacity)}
+    </div>
+  ) : <></>;
+
+
+  return (
+    <div className='storage-cell-container'>
+      <Tooltip title={tooltip} placement='bottomLeft'>

Review Comment:
   @devabhishekpal 
   How we can triggger this tooltip not able to see on UI after channging  text 
or removing icon.



-- 
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