You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "devabhishekpal (via GitHub)" <gi...@apache.org> on 2024/08/01 15:22:15 UTC
[PR] HDDS-11154. Improve Overview Page UI [ozone]
devabhishekpal opened a new pull request, #7017:
URL: https://github.com/apache/ozone/pull/7017
## What changes were proposed in this pull request?
This PR will add a new Overview page which contains a better implementation for the UI
Please describe your PR in detail:
* This PR adds a new Overview Page with improved layout and design.
* The new page would help to eventually improve the overall look and feel for Recon
* Currently the page is disabled to the user so as to not affect any existing functionality
* Apart from this it also contains the initial setup for a few components that will be used in the future PR as a part of the improvement effort.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11154
## How was this patch tested?
This patch was tested manually via both localhost and building and running Ozone via docker
Screenshot:
<img width="1727" alt="Screenshot 2024-08-01 at 20 41 00" src="https://github.com/user-attachments/assets/68e0f848-6e0c-446f-864d-a4e25625d9e0">
### How to test this new UI?
Currently the UI is disabled and hidden via using a switch so that users are not able to access it accidentally.
In order to switch to the new UI please follow the below steps:
- Remove the disable property from the AntDSwitch component in app.tsx
- (For testing after build) Make sure to build after removal of the disable property in the above step
- Click on the switch in the top right corner of the UI
- This should take you to the new page
**Please Note**: Currently the links for the cards point to blank pages as those have not been implemented yet
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701258167
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
Review Comment:
I think this can be removed if for debugging purposes.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div> )
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
+ }}>
+ {(data)
+ ? <Row gutter={[0, 50]}>
+ {data}
+ </Row>
+ : <></>}
Review Comment:
Instead of returning an empty fragment when data is falsy, it's cleaner to conditionally render the element.
```suggestion
{data && (
<Row gutter={[0, 50]}>
{data}
</Row>
)}
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div> )
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
+ }}>
+ {(data)
+ ? <Row gutter={[0, 50]}>
+ {data}
+ </Row>
+ : <></>}
+ <Row>
+ <Table
Review Comment:
Can it be improved to concise code: I mean just a question , may be I am wrong: Row from Ant Design is typically used for layout, and it may not be necessary to wrap the Table component inside a Row.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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 axios, { CanceledError } from 'axios';
+import moment from 'moment';
+import filesize from 'filesize';
+import { Row, Col, Card, Button } from 'antd';
+import { CheckCircleFilled, WarningFilled } from '@ant-design/icons';
+
+import OverviewCard from '@/v2/components/overviewCard/overviewCard';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError, byteToSize } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from '@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from '@/v2/types/overview.types';
+
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+
+import './overview.less';
+import { Link } from 'react-router-dom';
+import OverviewStorageCard from '@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from '@/v2/components/overviewCard/overviewSimpleCard';
+
+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 Overview: React.FC<{}> = (props = {}) => {
+
+ let interval = 0;
+ 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].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 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 className='overview-content-v2'>
+ <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='Pipelines'
+ icon='deployment-unit'
+ loading={loading}
+ data={pipelines}
+ linkToUrl='/Pipelines' />
Review Comment:
Review is in progress, however just a quick comment here, can we at least put OM data first in sequence and then SCM data. E.g.:
OM data -> `Volume, Buckets, Keys`.... then SCM data -> `Pipelines, Deleted Containers`
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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 axios, { CanceledError } from 'axios';
+import moment from 'moment';
+import filesize from 'filesize';
+import { Row, Col, Card, Button } from 'antd';
+import { CheckCircleFilled, WarningFilled } from '@ant-design/icons';
+
+import OverviewCard from '@/v2/components/overviewCard/overviewCard';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError, byteToSize } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from '@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from '@/v2/types/overview.types';
+
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+
+import './overview.less';
+import { Link } from 'react-router-dom';
+import OverviewStorageCard from '@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from '@/v2/components/overviewCard/overviewSimpleCard';
+
+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 Overview: React.FC<{}> = (props = {}) => {
+
+ let interval = 0;
+ 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].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 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 className='overview-content-v2'>
+ <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='Pipelines'
+ icon='deployment-unit'
+ loading={loading}
+ data={pipelines}
+ linkToUrl='/Pipelines' />
+ </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='Deleted Containers'
+ icon='delete'
+ loading={loading}
+ data={deletedContainers} />
Review Comment:
Curious to know , what is the plan of expanding this UI, lets say on Overview page, if we want to show more statistics like `Decommission Info` etc. Just an example , so are we going to squeeze all statistics cards in future on `Overview` page ? or do we have any plans for different way to represent ?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703831816
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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';
+
+
+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 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].filter((resp) => resp.status === 'rejected');
Review Comment:
Done in the latest commit [225fdd6](https://github.com/apache/ozone/pull/7017/commits/225fdd6c052839bdd383e1c4f770cf59474e44b3)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
smitajoshi12 commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2268751470
@devabhishekpal
On E Charts Libraray Can we add label or text show green and red color indicates what properties.

--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2269345814
> @devabhishekpal
>
>
>
> On E Charts Libraray Can you add label or text show green,red and blue color on hovering indicates what properties on gauge chart.
>
>
>
> 
So this was actually disabled as suggested by the design since we are already showing the label/legend in the sidebar. This card would only be overview level hence need to avoid extra features
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703748001
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
+ )
+ }
+}
+
Review Comment:
Please refer to https://github.com/apache/ozone/pull/7017/files/135015d32214a036b79a0456c9b80487a803090b#r1703730117 for the reason.
Inline styles will be easier to read.
For Cards there are no css-properties defined for the various section hence we cannot extract to external stylesheet, and directly overriding library defined styles in css is to be avoided as much as possible
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
smitajoshi12 commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1704098957
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/eChart/eChart.tsx:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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, { useRef, useEffect } from "react";
+import { init, getInstanceByDom } from 'echarts';
+import type { CSSProperties } from "react";
+import type { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
+
+export interface EChartProps {
+ option: EChartsOption;
+ style?: CSSProperties;
+ settings?: SetOptionOpts;
+ loading?: boolean;
+ theme?: 'light';
+ onClick?: () => any | void;
+}
+
+const EChart = ({
+ option,
+ style,
+ settings,
+ loading,
+ theme,
+ onClick
+}: EChartProps): JSX.Element => {
+ const chartRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ // Initialize chart
+ let chart: ECharts | undefined;
+ if (chartRef.current !== null) {
+ chart = init(chartRef.current, theme);
+ if (onClick) {
+ chart.on('click', onClick);
+ }
+ }
+
+ // Add chart resize listener
+ // ResizeObserver is leading to a bit janky UX
+ function resizeChart() {
+ chart?.resize();
+ }
+ window.addEventListener("resize", resizeChart);
+
+ // Return cleanup function
+ return () => {
+ chart?.dispose();
+ window.removeEventListener("resize", resizeChart);
+ };
+ }, [theme]);
+
+ useEffect(() => {
+ // Update chart
+ if (chartRef.current !== null) {
+ const chart = getInstanceByDom(chartRef.current);
+ chart!.setOption(option, settings);
+ if (onClick) {
+ chart!.on('click', onClick);
+ }
+ }
+ }, [option, settings, theme]); // Whenever theme changes we need to add option and setting due to it being deleted in cleanup function
+
+ useEffect(() => {
Review Comment:
@devabhishekpal Could you add comments for purpose of first useEffect and Second useEffect in code.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703730117
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Since the styles are smaller in scale, having it inline or as a constant will have the same performance as the styles are a part of JSX which is required to be parsed in either scenario.
To improve performance we can shift to an external stylesheet, but even that would only improve negligible performance, hence having inline styles in this scenario is easier to read.
Here is a good article for performance of inline styles vs external stylesheets:
https://simonadcock.com/are-inline-styles-faster-than-atomic-css/
Here a 100 tags with inline styles takes ~39ms and external stylesheet takes ~30ms which is just a 9ms improvement in exchange for readability
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705323072
##########
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:
Addressed in the latest commit
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705324244
##########
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:
Currently this file is not being used in the existing code.
This would be used in the datanodes page.
Hence tooltip is not there as we are using ECharts instead
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701404683
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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 axios, { CanceledError } from 'axios';
+import moment from 'moment';
+import filesize from 'filesize';
+import { Row, Col, Card, Button } from 'antd';
+import { CheckCircleFilled, WarningFilled } from '@ant-design/icons';
+
+import OverviewCard from '@/v2/components/overviewCard/overviewCard';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError, byteToSize } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from '@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from '@/v2/types/overview.types';
+
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+
+import './overview.less';
+import { Link } from 'react-router-dom';
+import OverviewStorageCard from '@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from '@/v2/components/overviewCard/overviewSimpleCard';
+
+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 Overview: React.FC<{}> = (props = {}) => {
+
+ let interval = 0;
+ 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].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 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 className='overview-content-v2'>
+ <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='Pipelines'
+ icon='deployment-unit'
+ loading={loading}
+ data={pipelines}
+ linkToUrl='/Pipelines' />
Review Comment:
Changed this in the latest commit [fb7b0ba](https://github.com/apache/ozone/pull/7017/commits/fb7b0baab0f6c1acf2545ec09cdcd01469b5c439)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701393479
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div> )
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
+ }}>
+ {(data)
+ ? <Row gutter={[0, 50]}>
+ {data}
+ </Row>
+ : <></>}
Review Comment:
This has been addressed in [fb7b0ba](https://github.com/apache/ozone/pull/7017/commits/fb7b0baab0f6c1acf2545ec09cdcd01469b5c439)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701392903
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div> )
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
+ }}>
+ {(data)
+ ? <Row gutter={[0, 50]}>
+ {data}
+ </Row>
+ : <></>}
+ <Row>
+ <Table
Review Comment:
Thanks Devesh for pointing this out, I had originally added Row to experiment with spacing, but you are correct, since we are adding the gutter on the data Row component, we can remove the Row wrapping on table.
This is addressed in the latest commit [fb7b0ba](https://github.com/apache/ozone/pull/7017/commits/fb7b0baab0f6c1acf2545ec09cdcd01469b5c439)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703734813
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
For the Icons we are referencing the styles that are passed as props, hence we are defining it in the component.
Refactoring it in a separate constant would mean we cannot pass the styles, or if we want to we would need to return a component and pass the props for style twice:
`Card -> Icon Selector -> Actual icon constant`
This will decrease readability and also decrease performance slightly.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1704939909
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/eChart/eChart.tsx:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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, { useRef, useEffect } from "react";
+import { init, getInstanceByDom } from 'echarts';
+import type { CSSProperties } from "react";
+import type { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
+
+export interface EChartProps {
+ option: EChartsOption;
+ style?: CSSProperties;
+ settings?: SetOptionOpts;
+ loading?: boolean;
+ theme?: 'light';
+ onClick?: () => any | void;
+}
+
+const EChart = ({
+ option,
+ style,
+ settings,
+ loading,
+ theme,
+ onClick
+}: EChartProps): JSX.Element => {
+ const chartRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ // Initialize chart
+ let chart: ECharts | undefined;
+ if (chartRef.current !== null) {
+ chart = init(chartRef.current, theme);
+ if (onClick) {
+ chart.on('click', onClick);
+ }
+ }
+
+ // Add chart resize listener
+ // ResizeObserver is leading to a bit janky UX
+ function resizeChart() {
+ chart?.resize();
+ }
+ window.addEventListener("resize", resizeChart);
+
+ // Return cleanup function
+ return () => {
+ chart?.dispose();
+ window.removeEventListener("resize", resizeChart);
+ };
+ }, [theme]);
+
+ useEffect(() => {
+ // Update chart
+ if (chartRef.current !== null) {
+ const chart = getInstanceByDom(chartRef.current);
+ chart!.setOption(option, settings);
+ if (onClick) {
+ chart!.on('click', onClick);
+ }
+ }
+ }, [option, settings, theme]); // Whenever theme changes we need to add option and setting due to it being deleted in cleanup function
+
+ useEffect(() => {
Review Comment:
Added the comment in the latest commit
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
smitajoshi12 commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705109232
##########
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:
It looks good after new commit
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
smitajoshi12 commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2268718317
If we get Storage Report from Cluster API is blank or null then UI is breaking Can u check

--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2263749201
Hi @smitajoshi12, could you take a look at this PR as well?
Thanks
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 merged PR #7017:
URL: https://github.com/apache/ozone/pull/7017
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2270433497
Further error handling is currently not being done, as error pages are still under progress, and we want to wrap component in Error Boundary instead of individually handling error scenarios in code.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "smitajoshi12 (via GitHub)" <gi...@apache.org>.
smitajoshi12 commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705378542
##########
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:
OverviewSummaryCard
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2273231009
Thanks for indicating this issue @ArafatKhan2198 , removed it in the latest commit
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701393902
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard = (props: OverviewTableCardProps = {
+ data: '',
+ title: '',
+ hoverable: false,
+ loading: false,
+ columns: [],
+ tableData: [],
+ linkToUrl: '',
+ showHeader: false
+}) => {
+ let {
+ data,
+ title,
+ loading,
+ hoverable,
+ tableData,
+ columns,
+ linkToUrl,
+ showHeader
+ } = props;
+
+ console.log(showHeader);
Review Comment:
Removed in [fb7b0ba](https://github.com/apache/ozone/pull/7017/commits/fb7b0baab0f6c1acf2545ec09cdcd01469b5c439)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1701399724
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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 axios, { CanceledError } from 'axios';
+import moment from 'moment';
+import filesize from 'filesize';
+import { Row, Col, Card, Button } from 'antd';
+import { CheckCircleFilled, WarningFilled } from '@ant-design/icons';
+
+import OverviewCard from '@/v2/components/overviewCard/overviewCard';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import { showDataFetchError, byteToSize } from '@/utils/common';
+import { AxiosGetHelper, cancelRequests, PromiseAllSettledGetHelper } from '@/utils/axiosRequestHelper';
+
+import { ClusterStateResponse, OverviewState, StorageReport } from '@/v2/types/overview.types';
+
+import OverviewTableCard from '@/v2/components/overviewCard/overviewTableCard';
+
+import './overview.less';
+import { Link } from 'react-router-dom';
+import OverviewStorageCard from '@/v2/components/overviewCard/overviewStorageCard';
+import OverviewCardSimple from '@/v2/components/overviewCard/overviewSimpleCard';
+
+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 Overview: React.FC<{}> = (props = {}) => {
+
+ let interval = 0;
+ 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].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 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 className='overview-content-v2'>
+ <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='Pipelines'
+ icon='deployment-unit'
+ loading={loading}
+ data={pipelines}
+ linkToUrl='/Pipelines' />
+ </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='Deleted Containers'
+ icon='delete'
+ loading={loading}
+ data={deletedContainers} />
Review Comment:
Hello, I believe for things which are in the notification category/status checks we have a plan to introduce a notification component which would have things like decommissioning status, health check status etc.
For normal cards I believe we would be using the usual layout of:
--- Two Split card row or single large card ---
--- small cards row ---
--- Larger or Split cards ---
And later on I think we can adopt a more collapsible layout. But let me confirm a better behaviour and get back to you.
Thanks for asking this
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703723554
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/eChart/eChart.tsx:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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, { useRef, useEffect } from "react";
+import { init, getInstanceByDom } from 'echarts';
+import type { CSSProperties } from "react";
+import type { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
+
+export interface EChartProps {
+ option: EChartsOption;
+ style?: CSSProperties;
+ settings?: SetOptionOpts;
+ loading?: boolean;
+ theme?: 'light';
+ onClick?: () => any | void;
+}
+
+const EChart = ({
+ option,
+ style,
+ settings,
+ loading,
+ theme,
+ onClick
+}: EChartProps): JSX.Element => {
+ const chartRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ // Initialize chart
+ let chart: ECharts | undefined;
+ if (chartRef.current !== null) {
+ chart = init(chartRef.current, theme);
+ if (onClick) {
+ chart.on('click', onClick);
+ }
+ }
+
+ // Add chart resize listener
+ // ResizeObserver is leading to a bit janky UX
+ function resizeChart() {
+ chart?.resize();
+ }
+ window.addEventListener("resize", resizeChart);
+
+ // Return cleanup function
+ return () => {
+ chart?.dispose();
+ window.removeEventListener("resize", resizeChart);
+ };
+ }, [theme]);
+
+ useEffect(() => {
+ // Update chart
+ if (chartRef.current !== null) {
+ const chart = getInstanceByDom(chartRef.current);
Review Comment:
So we do not require null checks here, as the first useEffect() call will run on Component mount, hence ensuring the chart is never undefined/null
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703748001
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
+ )
+ }
+}
+
Review Comment:
Please refer to https://github.com/apache/ozone/pull/7017/files/135015d32214a036b79a0456c9b80487a803090b#r1703730117 for the reason.
Inline styles will be easier to read.
For Cards there are no css-properties defined for the various section hence we cannot extract to external stylesheet, and directly overriding library defined styles in css is to be avoided as much as possible
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703832508
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard: React.FC<OverviewTableCardProps> = ({
+ data = '',
+ title = '',
+ hoverable = false,
+ loading = false,
+ columns = [],
+ tableData = [],
+ linkToUrl = '',
+ showHeader = false
+}) => {
+
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div>)
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
Review Comment:
Addressed in [8c54c99](https://github.com/apache/ozone/pull/7017/commits/8c54c99a2590b11867a6b7b4e7743fb8408360e6)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703839646
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
Review Comment:
Addressed in the commit [8c54c99](https://github.com/apache/ozone/pull/7017/commits/8c54c99a2590b11867a6b7b4e7743fb8408360e6)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703841108
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Addressed the style changes in [8c54c99](https://github.com/apache/ozone/pull/7017/commits/8c54c99a2590b11867a6b7b4e7743fb8408360e6)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703730117
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Since the styles are smaller in scale, having it inline or as a constant will have the same performance as the styles are a part of JSX which is required to be parsed in either scenario.
To improve performance we can shift to an external stylesheet, but even that would only improve negligible performance, hence having inline styles in this scenario is easier to read.
Here is a good article for performance of inline styles vs external stylesheets:
https://simonadcock.com/are-inline-styles-faster-than-atomic-css/
Here a 100 tags with inline styles takes ~39ms and external stylesheet takes ~30ms which is just a 9ms improvement in exchange for readability
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703730117
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Since the styles are smaller in scale, having it inline or as a constant will have the same performance as the styles are a part of JSX which is required to be parsed in either scenario.
To improve performance we can shift to an external stylesheet, but even that would only improve negligible performance, hence having inline styles in this scenario is easier to read.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2273194846
@devabhishekpal It looks like there's an error in the build on your fork. You can check it out here: https://github.com/devabhishekpal/ozone/actions/runs/10279094710/job/28443877043. Could you please take a look?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2274987221
Thanks for working on the improvement @devabhishekpal
Thanks @devmadhuu @smitajoshi12 for the review.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703680859
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
Review Comment:
Could you please align them in one line its easier to read.
```
ozoneUsedPercentage: Math.floor((used / capacity) * 100),
nonOzoneUsedPercentage: Math.floor(((capacity - remaining - used) / capacity) * 100),
committedPercentage: Math.floor((committed / capacity) * 100),
usagePercentage: Math.floor(((capacity - remaining) / capacity) * 100),
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Would it be a good idea to introduce a constants section which will encapsulate all the hardcoded values and styles in one place
```
// ------------- Constants -------------- //
const Icons: IconOptions = {
'cluster': <ClusterOutlined />,
'deployment-unit': <DeploymentUnitOutlined />,
'database': <DatabaseOutlined />,
'container': <ContainerOutlined />,
'inbox': <InboxOutlined />,
'folder-open': <FolderOpenOutlined />,
'file-text': <FileTextOutlined />,
'delete': <DeleteOutlined />,
};
const iconStyle: React.CSSProperties = {
fontSize: '20px',
paddingRight: '4px',
float: 'inline-start',
};
const titleStyle: React.CSSProperties = {
display: 'flex',
justifyContent: 'space-between'
};
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
Review Comment:
@devmadhuu I have gone through these calculations, could you please double check them well, as these are very important for the overview and would raise a lot of escalations if not computed properly.
##########
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 = (
+ <>
Review Comment:
Could you double check these calculations as well @devmadhuu
Thanks!
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
+ )
+ }
+}
+
Review Comment:
We can move repetitive inline styles to constants outside the component to optimise performance.
```
// ------------- Styles -------------- //
const cardHeadStyle: React.CSSProperties = { fontSize: '14px' };
const cardBodyStyle: React.CSSProperties = { padding: '16px' };
const cardStyle: React.CSSProperties = {
boxSizing: 'border-box',
height: '100%',
};
const colStyle: React.CSSProperties = { justifyItems: 'center' };
const eChartStyle: React.CSSProperties = { width: '280px', height: '200px' };
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/eChart/eChart.tsx:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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, { useRef, useEffect } from "react";
+import { init, getInstanceByDom } from 'echarts';
+import type { CSSProperties } from "react";
+import type { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
+
+export interface EChartProps {
+ option: EChartsOption;
+ style?: CSSProperties;
+ settings?: SetOptionOpts;
+ loading?: boolean;
+ theme?: 'light';
+ onClick?: () => any | void;
+}
+
+const EChart = ({
+ option,
+ style,
+ settings,
+ loading,
+ theme,
+ onClick
+}: EChartProps): JSX.Element => {
+ const chartRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ // Initialize chart
+ let chart: ECharts | undefined;
+ if (chartRef.current !== null) {
+ chart = init(chartRef.current, theme);
+ if (onClick) {
+ chart.on('click', onClick);
+ }
+ }
+
+ // Add chart resize listener
+ // ResizeObserver is leading to a bit janky UX
+ function resizeChart() {
+ chart?.resize();
+ }
+ window.addEventListener("resize", resizeChart);
+
+ // Return cleanup function
+ return () => {
+ chart?.dispose();
+ window.removeEventListener("resize", resizeChart);
+ };
+ }, [theme]);
+
+ useEffect(() => {
+ // Update chart
+ if (chartRef.current !== null) {
+ const chart = getInstanceByDom(chartRef.current);
Review Comment:
Should we add null checks before accessing the chart instance to avoid using non-null assertions?
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Moving reusable styles to constants to prevent recreation during each render.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
Review Comment:
We could move repetitive inline styles to constants outside the component.
```
// ------------- Styles -------------- //
const titleContainerStyle: React.CSSProperties = {
display: 'flex',
justifyContent: 'space-between',
};
const linkStyle: React.CSSProperties = {
fontWeight: 400,
};
const cardHeadStyle: React.CSSProperties = {
fontSize: '14px',
};
const cardBodyStyle: React.CSSProperties = {
padding: '16px',
justifyTracks: 'space-between',
};
const cardStyle: React.CSSProperties = {
height: '100%',
};
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/overview/overview.tsx:
##########
@@ -0,0 +1,516 @@
+/*
+ * 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';
+
+
+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 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>>
+ ) => {
+ let responseError = [
+ clusterStateResponse,
+ taskstatusResponse,
+ openResponse,
+ deletePendingResponse
+ ].filter((resp) => resp.status === 'rejected');
Review Comment:
Could we create a separate method for handling errors something like this :-
```
// Utility to handle errors
const handleErrors = (responses) => {
const errors = responses.filter((resp) => resp.status === 'rejected');
errors.forEach(({ reason }) => {
if (reason.toString().includes("CanceledError")) {
throw new CanceledError('canceled', "ERR_CANCELED");
} else {
showDataFetchError(`Failed to ${reason.config.method} URL ${reason.config.url}\n${reason.toString()}`);
}
});
};
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
+// ------------- Component -------------- //
+const OverviewTableCard: React.FC<OverviewTableCardProps> = ({
+ data = '',
+ title = '',
+ hoverable = false,
+ loading = false,
+ columns = [],
+ tableData = [],
+ linkToUrl = '',
+ showHeader = false
+}) => {
+
+ const titleElement = (linkToUrl)
+ ? (
+ <div style={{
+ display: 'flex',
+ justifyContent: 'space-between'
+ }}>
+ {title}
+ <Link
+ to={linkToUrl}
+ style={{
+ fontWeight: 400
+ }}>View Insights</Link>
+ </div>)
+ : title
+
+ return (
+ <Card
+ size='small'
+ className={'overview-card'}
+ loading={loading}
+ hoverable={hoverable}
+ title={titleElement}
+ headStyle={{
+ fontSize: '14px'
+ }}
+ bodyStyle={{
+ padding: '16px',
+ justifyTracks: 'space-between'
+ }}
+ style={{
+ height: '100%'
Review Comment:
By refactoring the Styles part code the card section can look a lot simpler like this -
```
return (
<Card
size="small"
className="overview-card"
loading={loading}
hoverable={hoverable}
title={titleElement}
headStyle={cardHeadStyle}
bodyStyle={cardBodyStyle}
style={cardStyle}
>
{data && (
<Row gutter={[0, 50]}>
{data}
</Row>
)}
<Table
showHeader={showHeader}
tableLayout="fixed"
size="small"
pagination={false}
dataSource={tableData}
columns={columns}
/>
</Card>
);
}
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/eChart/eChart.tsx:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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, { useRef, useEffect } from "react";
+import { init, getInstanceByDom } from 'echarts';
+import type { CSSProperties } from "react";
+import type { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
+
+export interface EChartProps {
+ option: EChartsOption;
+ style?: CSSProperties;
+ settings?: SetOptionOpts;
+ loading?: boolean;
+ theme?: 'light';
+ onClick?: () => any | void;
+}
+
+const EChart = ({
+ option,
+ style,
+ settings,
+ loading,
+ theme,
+ onClick
+}: EChartProps): JSX.Element => {
+ const chartRef = useRef<HTMLDivElement>(null);
+ useEffect(() => {
+ // Initialize chart
+ let chart: ECharts | undefined;
+ if (chartRef.current !== null) {
+ chart = init(chartRef.current, theme);
+ if (onClick) {
+ chart.on('click', onClick);
+ }
+ }
+
+ // Add chart resize listener
+ // ResizeObserver is leading to a bit janky UX
+ function resizeChart() {
+ chart?.resize();
+ }
+ window.addEventListener("resize", resizeChart);
+
+ // Return cleanup function
+ return () => {
+ chart?.dispose();
+ window.removeEventListener("resize", resizeChart);
+ };
+ }, [theme]);
+
+ useEffect(() => {
+ // Update chart
+ if (chartRef.current !== null) {
+ const chart = getInstanceByDom(chartRef.current);
Review Comment:
Something like this
```
useEffect(() => {
// Handle loading state changes
if (chartRef.current !== null) {
const chart = getInstanceByDom(chartRef.current);
if (chart) {
if (loading) {
chart.showLoading();
} else {
chart.hideLoading();
}
}
}
```
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
Review Comment:
This change will enhance the readability of the code. However, I have a question @devabhishekpal Could this also improve performance optimization?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703838917
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
Review Comment:
So in this scenario actually since both the cases are in JSX, it will take equivalent time to render the CSS as it needs to parse the JSX to CSS.
As for going inline vs external stylesheet there is a good article:
https://simonadcock.com/are-inline-styles-faster-than-atomic-css/
In this they tried making 100 elements and applied inline vs external stylesheet.
They found inline style is taking ~39ms vs external style is taking ~30ms to render which is a 9ms improvement.
So on the larger scale it doesn't matter much unless it is a very complex UI. But even then React does it's own optimizations.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewTableCard.tsx:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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 { Card, Row, Table } from 'antd';
+
+import { ColumnType } from 'antd/es/table';
+import { Link } from 'react-router-dom';
+
+// ------------- Types -------------- //
+
+type TableData = {
+ key: React.Key;
+ name: string;
+ value: string;
+ action?: React.ReactElement | string;
+}
+
+type OverviewTableCardProps = {
+ title: string;
+ columns: ColumnType<TableData>[];
+ tableData: TableData[];
+ hoverable?: boolean;
+ loading?: boolean;
+ data?: string | React.ReactElement;
+ linkToUrl?: string;
+ showHeader?: boolean;
+}
+
Review Comment:
Addressed this in the commit [8c54c99](https://github.com/apache/ozone/pull/7017/commits/8c54c99a2590b11867a6b7b4e7743fb8408360e6)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703840723
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewStorageCard.tsx:
##########
@@ -0,0 +1,249 @@
+/*
+ * 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, { useMemo } from 'react';
+import filesize from 'filesize';
+import { Card, Row, Col, Table, Tag } from 'antd';
+
+import EChart from '@/v2/components/eChart/eChart';
+import OverviewCardWrapper from '@/v2/components/overviewCard/overviewCardWrapper';
+
+import { StorageReport } from '@/v2/types/overview.types';
+
+// ------------- Types -------------- //
+
+type OverviewStorageCardProps = {
+ loading?: boolean;
+ storageReport: StorageReport;
+}
+
+const size = filesize.partial({ round: 1 });
+
+function getUsagePercentages(
+ { used, remaining, capacity, committed }: StorageReport): ({
+ ozoneUsedPercentage: number,
+ nonOzoneUsedPercentage: number,
+ committedPercentage: number,
+ usagePercentage: number
+ }) {
+ return {
+ ozoneUsedPercentage: Math.floor(used / capacity * 100),
+ nonOzoneUsedPercentage: Math.floor(
+ (capacity - remaining - used)
+ / capacity * 100
+ ),
+ committedPercentage: Math.floor(committed / capacity * 100),
+ usagePercentage: Math.floor(
+ (capacity - remaining)
+ / capacity * 100
+ )
+ }
+}
+
Review Comment:
Addressed in the commit [8c54c99](https://github.com/apache/ozone/pull/7017/commits/8c54c99a2590b11867a6b7b4e7743fb8408360e6)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705331649
##########
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:
Could you suggest an alternate name?
We should avoid long names for components/files
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1705327591
##########
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:
Currently we are not completely implementing this ErrorBoundary, this is a placeholder component to implement after design is finalized for error page
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on PR #7017:
URL: https://github.com/apache/ozone/pull/7017#issuecomment-2273179111
Thanks for the patch @devabhishekpal
LGTM +1
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1703734813
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/overviewCard/overviewSimpleCard.tsx:
##########
@@ -0,0 +1,138 @@
+/*
+ * 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 { Card, Col, Row } from 'antd';
+import { Link } from 'react-router-dom';
+import { ClusterOutlined, ContainerOutlined, DatabaseOutlined, DeleteOutlined, DeploymentUnitOutlined, FileTextOutlined, FolderOpenOutlined, InboxOutlined, QuestionCircleOutlined } from '@ant-design/icons';
+
+
+// ------------- Types -------------- //
+type IconOptions = {
+ [key: string]: React.ReactElement
+}
+
+type OverviewCardProps = {
+ icon: string;
+ data: number | React.ReactElement;
+ title: string;
+ hoverable?: boolean;
+ loading?: boolean;
+ linkToUrl?: string;
+}
+
Review Comment:
Also for the Icons we are referencing the styles that are passed as props, hence we are defining it in the component.
Refactoring it in a separate constant would mean we cannot pass the styles, or if we want to we would need to return a component and pass the props for style twice:
`Card -> Icon Selector -> Actual icon constant`
This will decrease readability and also decrease performance slightly.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11154. Improve Overview Page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7017:
URL: https://github.com/apache/ozone/pull/7017#discussion_r1706438102
##########
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:
Addressed in the latest commit
##########
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:
Addressed in the latest commit
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org