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/09/05 19:08:54 UTC
[PR] HDDS-11157. Improve Datanodes page UI [ozone]
devabhishekpal opened a new pull request, #7168:
URL: https://github.com/apache/ozone/pull/7168
## What changes were proposed in this pull request?
Improve Datanodes page UI.
Please describe your PR in detail:
* This PR adds a new Datanodes 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
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11157
## How was this patch tested?
Patch was tested manually
<img width="1724" alt="Screenshot 2024-09-06 at 00 26 13" src="https://github.com/user-attachments/assets/a1d3defd-4cd5-4c67-8014-4dd187bd3daf">
<img width="1722" alt="Screenshot 2024-09-06 at 00 26 30" src="https://github.com/user-attachments/assets/b4294a86-92d1-41f6-8621-a60f5840e7fc">
<img width="1726" alt="Screenshot 2024-09-06 at 00 34 24" src="https://github.com/user-attachments/assets/0596e6fc-c491-43c2-b7e0-d3046b8db68c">
<img width="1727" alt="Screenshot 2024-09-06 at 00 34 34" src="https://github.com/user-attachments/assets/ff6b21d5-79b8-4dd4-8781-b66c7eab3008">
<img width="1724" alt="Screenshot 2024-09-06 at 00 26 02" src="https://github.com/user-attachments/assets/c071aef7-5dbc-4995-b519-a942202ec384">
**Important**
There are some bugs in current version of AntD with Popover component which causes the Popover to display in incorrect position if we scroll the table.
Currently I am waiting for AntD dependencies to update in a new release so that previous license issues with the AntD slick component do not cause incompatibility.
After this I will target upgrade to AntD v5 which should take care of this bug.
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760682498
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
Review Comment:
I believe we can go over the searchable fields. For leader count it was just a number and I didn't think it was useful making it searchable
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1764812946
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/datanodes/datanodes.tsx:
##########
@@ -0,0 +1,312 @@
+/*
+ * 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,
+ useRef,
+ useState
+} from 'react';
+import moment from 'moment';
+import { AxiosError } from 'axios';
+import {
+ Button,
+ Modal
+} from 'antd';
+import {
+ DeleteOutlined,
+ WarningFilled,
+} from '@ant-design/icons';
+import { ValueType } from 'react-select';
+
+import Search from '@/v2/components/search/search';
+import MultiSelect, { Option } from '@/v2/components/select/multiSelect';
+import DatanodesTable, { COLUMNS } from '@/v2/components/tables/datanodesTable';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { showDataFetchError } from '@/utils/common';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import {
+ AxiosGetHelper,
+ AxiosPutHelper,
+ cancelRequests
+} from '@/utils/axiosRequestHelper';
+
+import { useDebounce } from '@/v2/hooks/debounce.hook';
+import {
+ Datanode,
+ DatanodeDecomissionInfo,
+ DatanodeResponse,
+ DatanodesResponse,
+ DatanodesState
+} from '@/v2/types/datanode.types';
+
+import './datanodes.less'
+
+
+const defaultColumns = COLUMNS.map(column => ({
+ label: (typeof column.title === 'string')
+ ? column.title
+ : (column.title as Function)().props.children[0],
+ value: column.key as string
+}));
+
+const SearchableColumnOpts = [{
+ label: 'Hostname',
+ value: 'hostname'
+}, {
+ label: 'UUID',
+ value: 'uuid'
+}, {
+ label: 'Version',
+ value: 'version'
+}, {
+ label: 'Revision',
+ value: 'revision'
+}];
+
+let decommissionUuids: string | string[] = [];
+const COLUMN_UPDATE_DECOMMISSIONING = 'DECOMMISSIONING';
+
+const Datanodes: React.FC<{}> = () => {
+
+ const cancelSignal = useRef<AbortController>();
+ const cancelDecommissionSignal = useRef<AbortController>();
+
+ const [state, setState] = useState<DatanodesState>({
+ lastUpdated: 0,
+ columnOptions: defaultColumns,
+ dataSource: []
+ });
+ const [loading, setLoading] = useState<boolean>(false);
+ const [selectedColumns, setSelectedColumns] = useState<Option[]>(defaultColumns);
+ const [selectedRows, setSelectedRows] = useState<React.Key[]>([]);
+ const [searchTerm, setSearchTerm] = useState<string>('');
+ const [searchColumn, setSearchColumn] = useState<'hostname' | 'uuid' | 'version' | 'revision'>('hostname');
+ const [modalOpen, setModalOpen] = useState<boolean>(false);
+
+ const debouncedSearch = useDebounce(searchTerm, 300);
+
+ function handleColumnChange(selected: ValueType<Option, true>) {
+ setSelectedColumns(selected as Option[]);
+ }
+
+ async function loadDecommisionAPI() {
+ decommissionUuids = [];
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes/decommission/info',
+ cancelDecommissionSignal.current
+ );
+ cancelDecommissionSignal.current = controller;
+ return request
+ };
+
+ async function loadDataNodeAPI() {
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes',
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ return request;
+ };
+
+ async function removeDatanode(selectedRowKeys: string[]) {
+ setLoading(true);
+ const { request, controller } = await AxiosPutHelper(
+ '/api/v1/datanodes/remove',
+ selectedRowKeys,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ request.then(() => {
+ loadData();
+ }).catch((error) => {
+ showDataFetchError(error.toString());
+ }).finally(() => {
+ setLoading(false);
+ setSelectedRows([]);
+ });
+ }
+
+ const loadData = async () => {
+ setLoading(true);
+ // Need to call decommission API on each interval to get updated status
+ // before datanode API call to compare UUID's
+ // update 'Operation State' column in table manually before rendering
+ try {
+ let decomissionResponse = await loadDecommisionAPI();
+ decommissionUuids = decomissionResponse.data?.DatanodesDecommissionInfo?.map(
+ (item: DatanodeDecomissionInfo) => item.datanodeDetails.uuid
+ );
+ } catch (error) {
+ decommissionUuids = [];
+ showDataFetchError((error as AxiosError).toString());
+ }
+
+ try {
+ const datanodesAPIResponse = await loadDataNodeAPI();
+ const datanodesResponse: DatanodesResponse = datanodesAPIResponse.data;
+ const datanodes: DatanodeResponse[] = datanodesResponse.datanodes;
+ const dataSource: Datanode[] = datanodes?.map(
+ (datanode) => ({
+ hostname: datanode.hostname,
+ uuid: datanode.uuid,
+ state: datanode.state,
+ opState: (decommissionUuids?.includes(datanode.uuid) && datanode.opState !== 'DECOMMISSIONED')
+ ? COLUMN_UPDATE_DECOMMISSIONING
+ : datanode.opState,
+ lastHeartbeat: datanode.lastHeartbeat,
+ storageUsed: datanode.storageReport.used,
+ storageTotal: datanode.storageReport.capacity,
+ storageCommitted: datanode.storageReport.committed,
+ storageRemaining: datanode.storageReport.remaining,
+ pipelines: datanode.pipelines,
+ containers: datanode.containers,
+ openContainers: datanode.openContainers,
+ leaderCount: datanode.leaderCount,
+ version: datanode.version,
+ setupTime: datanode.setupTime,
+ revision: datanode.revision,
+ buildDate: datanode.buildDate,
+ networkLocation: datanode.networkLocation
+ })
+ );
+ setLoading(false);
+ setState({
+ ...state,
+ dataSource: dataSource,
+ lastUpdated: Number(moment())
+ });
+ } catch (error) {
+ setLoading(false);
+ showDataFetchError((error as AxiosError).toString())
+ }
+ }
+
+ const autoReloadHelper: AutoReloadHelper = new AutoReloadHelper(loadData);
+
+ useEffect(() => {
+ autoReloadHelper.startPolling();
+ loadData();
+
+ return (() => {
+ autoReloadHelper.stopPolling();
+ cancelRequests([
+ cancelSignal.current!,
+ cancelDecommissionSignal.current!
+ ]);
+ });
+ }, []);
+
+ function handleSelectionChange(rows: React.Key[]) {
+ setSelectedRows(rows);
+ }
+
+ function handleModalOk() {
+ setModalOpen(false);
+ removeDatanode(selectedRows as string[])
+ };
+
+ function handleModalCancel() {
+ setModalOpen(false);
+ setSelectedRows([]);
+ };
+
+ const { dataSource, lastUpdated, columnOptions } = state;
+
+ return (
+ <>
+ <div className='page-header-v2'>
+ Datanodes
+ <AutoReloadPanel
+ isLoading={loading}
+ lastRefreshed={lastUpdated}
+ togglePolling={autoReloadHelper.handleAutoReloadToggle}
+ onReload={loadData} />
+ </div>
+ <div style={{ padding: '24px' }}>
+ <div className='content-div'>
+ <div className='table-header-section'>
+ <div className='table-filter-section'>
+ <MultiSelect
+ options={columnOptions}
+ defaultValue={selectedColumns}
+ selected={selectedColumns}
+ placeholder='Columns'
+ onChange={handleColumnChange}
+ onTagClose={() => { }}
+ fixedColumn='hostname'
+ columnLength={columnOptions.length} />
+ {selectedRows.length > 0 &&
+ <Button
+ type="primary"
+ icon={<DeleteOutlined />}
+ style={{
+ background: '#FF4D4E',
+ borderColor: '#FF4D4E'
+ }}
+ loading={loading}
+ onClick={() => { setModalOpen(true) }}> Remove
+ </Button>
+ }
+ </div>
+ <Search
+ disabled={dataSource?.length < 1}
+ searchOptions={SearchableColumnOpts}
+ searchInput={searchTerm}
+ searchColumn={searchColumn}
+ onSearchChange={
+ (e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)
+ }
+ onChange={(value) => {
+ setSearchTerm('');
+ setSearchColumn(value as 'hostname' | 'uuid' | 'version' | 'revision')
+ }} />
+ </div>
+ <DatanodesTable
+ loading={loading}
+ data={dataSource}
+ selectedColumns={selectedColumns}
+ selectedRows={selectedRows}
+ searchColumn={searchColumn}
+ searchTerm={debouncedSearch}
+ handleSelectionChange={handleSelectionChange}
+ decommissionUuids={decommissionUuids} />
+ </div>
+ </div>
+ <Modal
+ title=''
+ centered={true}
+ visible={modalOpen}
+ onOk={handleModalOk}
+ onCancel={handleModalCancel}
+ closable={false}
+ width={400} >
+ <div style={{
+ margin: '0px 0px 5px 0px',
+ fontSize: '16px',
+ fontWeight: 'bold'
+ }}>
+ <WarningFilled className='icon-warning' style={{paddingRight: '8px'}}/>
+ Stop Tracking Datanode
+ </div>
+ Are you sure, you want recon to stop tracking the selected <strong>{selectedRows.length}</strong> datanode(s)?
Review Comment:
Yes @devmadhuu, this has been fixed and tested out after building the new changes as well
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7168:
URL: https://github.com/apache/ozone/pull/7168#issuecomment-2358720465
Hi @devmadhuu thanks for checking this out.
1. For the search one we are not currently having any button to submit the search behaviour in which case we could have used trim() in order to remove whitespaces as we know when the user clicks the button they have finished entering their input.
In the current behaviour we do not know if user wants to type any other word after space ex if the user wants to search for `some text` and he only enters till `some ` if we trim, it will remove space from the input thus not allowing spaces to be typed. So we cannot handle that scenario as the search is automatically performed if nothing is entered for 3s and we do not know if the space is intentional from the user in order to type further characters or accidentally entered.
2. Could you let me know the repro behaviour for this? The State and Operational state columns are added unless the user disables them from the column selector.
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 merged PR #7168:
URL: https://github.com/apache/ozone/pull/7168
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on PR #7168:
URL: https://github.com/apache/ozone/pull/7168#issuecomment-2352247976
I noticed Devesh's comment about organizing different functionalities into separate files. Do we need something similar for this page as well, @devabhishekpal?
https://github.com/apache/ozone/pull/7171#issuecomment-2342794750
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760670635
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/datanodes/datanodes.tsx:
##########
@@ -0,0 +1,312 @@
+/*
+ * 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,
+ useRef,
+ useState
+} from 'react';
+import moment from 'moment';
+import { AxiosError } from 'axios';
+import {
+ Button,
+ Modal
+} from 'antd';
+import {
+ DeleteOutlined,
+ WarningFilled,
+} from '@ant-design/icons';
+import { ValueType } from 'react-select';
+
+import Search from '@/v2/components/search/search';
+import MultiSelect, { Option } from '@/v2/components/select/multiSelect';
+import DatanodesTable, { COLUMNS } from '@/v2/components/tables/datanodesTable';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { showDataFetchError } from '@/utils/common';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import {
+ AxiosGetHelper,
+ AxiosPutHelper,
+ cancelRequests
+} from '@/utils/axiosRequestHelper';
+
+import { useDebounce } from '@/v2/hooks/debounce.hook';
+import {
+ Datanode,
+ DatanodeDecomissionInfo,
+ DatanodeResponse,
+ DatanodesResponse,
+ DatanodesState
+} from '@/v2/types/datanode.types';
+
+import './datanodes.less'
+
+
+const defaultColumns = COLUMNS.map(column => ({
+ label: (typeof column.title === 'string')
+ ? column.title
+ : (column.title as Function)().props.children[0],
+ value: column.key as string
+}));
+
+const SearchableColumnOpts = [{
+ label: 'Hostname',
+ value: 'hostname'
+}, {
+ label: 'UUID',
+ value: 'uuid'
+}, {
+ label: 'Version',
+ value: 'version'
+}, {
+ label: 'Revision',
+ value: 'revision'
+}];
+
+let decommissionUuids: string | string[] = [];
+const COLUMN_UPDATE_DECOMMISSIONING = 'DECOMMISSIONING';
+
+const Datanodes: React.FC<{}> = () => {
+
+ const cancelSignal = useRef<AbortController>();
+ const cancelDecommissionSignal = useRef<AbortController>();
+
+ const [state, setState] = useState<DatanodesState>({
+ lastUpdated: 0,
+ columnOptions: defaultColumns,
+ dataSource: []
+ });
+ const [loading, setLoading] = useState<boolean>(false);
+ const [selectedColumns, setSelectedColumns] = useState<Option[]>(defaultColumns);
+ const [selectedRows, setSelectedRows] = useState<React.Key[]>([]);
+ const [searchTerm, setSearchTerm] = useState<string>('');
+ const [searchColumn, setSearchColumn] = useState<'hostname' | 'uuid' | 'version' | 'revision'>('hostname');
+ const [modalOpen, setModalOpen] = useState<boolean>(false);
+
+ const debouncedSearch = useDebounce(searchTerm, 300);
+
+ function handleColumnChange(selected: ValueType<Option, true>) {
+ setSelectedColumns(selected as Option[]);
+ }
+
+ async function loadDecommisionAPI() {
+ decommissionUuids = [];
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes/decommission/info',
+ cancelDecommissionSignal.current
+ );
+ cancelDecommissionSignal.current = controller;
+ return request
+ };
+
+ async function loadDataNodeAPI() {
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes',
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ return request;
+ };
+
+ async function removeDatanode(selectedRowKeys: string[]) {
+ setLoading(true);
+ const { request, controller } = await AxiosPutHelper(
+ '/api/v1/datanodes/remove',
+ selectedRowKeys,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ request.then(() => {
+ loadData();
+ }).catch((error) => {
+ showDataFetchError(error.toString());
+ }).finally(() => {
+ setLoading(false);
+ setSelectedRows([]);
+ });
+ }
+
+ const loadData = async () => {
+ setLoading(true);
+ // Need to call decommission API on each interval to get updated status
+ // before datanode API call to compare UUID's
+ // update 'Operation State' column in table manually before rendering
+ try {
+ let decomissionResponse = await loadDecommisionAPI();
+ decommissionUuids = decomissionResponse.data?.DatanodesDecommissionInfo?.map(
+ (item: DatanodeDecomissionInfo) => item.datanodeDetails.uuid
+ );
+ } catch (error) {
+ decommissionUuids = [];
+ showDataFetchError((error as AxiosError).toString());
+ }
+
+ try {
+ const datanodesAPIResponse = await loadDataNodeAPI();
+ const datanodesResponse: DatanodesResponse = datanodesAPIResponse.data;
+ const datanodes: DatanodeResponse[] = datanodesResponse.datanodes;
+ const dataSource: Datanode[] = datanodes?.map(
+ (datanode) => ({
+ hostname: datanode.hostname,
+ uuid: datanode.uuid,
+ state: datanode.state,
+ opState: (decommissionUuids?.includes(datanode.uuid) && datanode.opState !== 'DECOMMISSIONED')
+ ? COLUMN_UPDATE_DECOMMISSIONING
+ : datanode.opState,
+ lastHeartbeat: datanode.lastHeartbeat,
+ storageUsed: datanode.storageReport.used,
+ storageTotal: datanode.storageReport.capacity,
+ storageCommitted: datanode.storageReport.committed,
+ storageRemaining: datanode.storageReport.remaining,
+ pipelines: datanode.pipelines,
+ containers: datanode.containers,
+ openContainers: datanode.openContainers,
+ leaderCount: datanode.leaderCount,
+ version: datanode.version,
+ setupTime: datanode.setupTime,
+ revision: datanode.revision,
+ buildDate: datanode.buildDate,
+ networkLocation: datanode.networkLocation
+ })
+ );
+ setLoading(false);
+ setState({
+ ...state,
+ dataSource: dataSource,
+ lastUpdated: Number(moment())
+ });
+ } catch (error) {
+ setLoading(false);
+ showDataFetchError((error as AxiosError).toString())
+ }
+ }
+
+ const autoReloadHelper: AutoReloadHelper = new AutoReloadHelper(loadData);
+
+ useEffect(() => {
+ autoReloadHelper.startPolling();
+ loadData();
+
+ return (() => {
+ autoReloadHelper.stopPolling();
+ cancelRequests([
+ cancelSignal.current!,
+ cancelDecommissionSignal.current!
+ ]);
+ });
+ }, []);
+
+ function handleSelectionChange(rows: React.Key[]) {
+ setSelectedRows(rows);
+ }
+
+ function handleModalOk() {
+ setModalOpen(false);
+ removeDatanode(selectedRows as string[])
+ };
+
+ function handleModalCancel() {
+ setModalOpen(false);
+ setSelectedRows([]);
+ };
+
+ const { dataSource, lastUpdated, columnOptions } = state;
+
+ return (
+ <>
+ <div className='page-header-v2'>
+ Datanodes
+ <AutoReloadPanel
+ isLoading={loading}
+ lastRefreshed={lastUpdated}
+ togglePolling={autoReloadHelper.handleAutoReloadToggle}
+ onReload={loadData} />
+ </div>
+ <div style={{ padding: '24px' }}>
+ <div className='content-div'>
+ <div className='table-header-section'>
+ <div className='table-filter-section'>
+ <MultiSelect
+ options={columnOptions}
+ defaultValue={selectedColumns}
+ selected={selectedColumns}
+ placeholder='Columns'
+ onChange={handleColumnChange}
+ onTagClose={() => { }}
+ fixedColumn='hostname'
+ columnLength={columnOptions.length} />
+ {selectedRows.length > 0 &&
+ <Button
+ type="primary"
+ icon={<DeleteOutlined />}
+ style={{
+ background: '#FF4D4E',
+ borderColor: '#FF4D4E'
+ }}
+ loading={loading}
+ onClick={() => { setModalOpen(true) }}> Remove
+ </Button>
+ }
+ </div>
+ <Search
+ disabled={dataSource?.length < 1}
+ searchOptions={SearchableColumnOpts}
+ searchInput={searchTerm}
+ searchColumn={searchColumn}
+ onSearchChange={
+ (e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)
+ }
+ onChange={(value) => {
+ setSearchTerm('');
+ setSearchColumn(value as 'hostname' | 'uuid' | 'version' | 'revision')
+ }} />
+ </div>
+ <DatanodesTable
+ loading={loading}
+ data={dataSource}
+ selectedColumns={selectedColumns}
+ selectedRows={selectedRows}
+ searchColumn={searchColumn}
+ searchTerm={debouncedSearch}
+ handleSelectionChange={handleSelectionChange}
+ decommissionUuids={decommissionUuids} />
+ </div>
+ </div>
+ <Modal
+ title=''
+ centered={true}
+ visible={modalOpen}
+ onOk={handleModalOk}
+ onCancel={handleModalCancel}
+ closable={false}
+ width={400} >
+ <div style={{
+ margin: '0px 0px 5px 0px',
+ fontSize: '16px',
+ fontWeight: 'bold'
+ }}>
+ <WarningFilled className='icon-warning' style={{paddingRight: '8px'}}/>
+ Stop Tracking Datanode
+ </div>
+ Are you sure, you want recon to stop tracking the selected <strong>{selectedRows.length}</strong> datanode(s)?
Review Comment:
Another issue I encountered is that when I removed all datanodes are from the list (e.g., by shutting them down), the new UI crashes and displays an error. This behavior wasn’t present in the old UI, which handled this case by showing an empty list.
<img width="944" alt="image" src="https://github.com/user-attachments/assets/36d59162-b4a1-4cd5-97fe-6a8c68a843dc">
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1764800746
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/datanodes/datanodes.tsx:
##########
@@ -0,0 +1,312 @@
+/*
+ * 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,
+ useRef,
+ useState
+} from 'react';
+import moment from 'moment';
+import { AxiosError } from 'axios';
+import {
+ Button,
+ Modal
+} from 'antd';
+import {
+ DeleteOutlined,
+ WarningFilled,
+} from '@ant-design/icons';
+import { ValueType } from 'react-select';
+
+import Search from '@/v2/components/search/search';
+import MultiSelect, { Option } from '@/v2/components/select/multiSelect';
+import DatanodesTable, { COLUMNS } from '@/v2/components/tables/datanodesTable';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { showDataFetchError } from '@/utils/common';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import {
+ AxiosGetHelper,
+ AxiosPutHelper,
+ cancelRequests
+} from '@/utils/axiosRequestHelper';
+
+import { useDebounce } from '@/v2/hooks/debounce.hook';
+import {
+ Datanode,
+ DatanodeDecomissionInfo,
+ DatanodeResponse,
+ DatanodesResponse,
+ DatanodesState
+} from '@/v2/types/datanode.types';
+
+import './datanodes.less'
+
+
+const defaultColumns = COLUMNS.map(column => ({
+ label: (typeof column.title === 'string')
+ ? column.title
+ : (column.title as Function)().props.children[0],
+ value: column.key as string
+}));
+
+const SearchableColumnOpts = [{
+ label: 'Hostname',
+ value: 'hostname'
+}, {
+ label: 'UUID',
+ value: 'uuid'
+}, {
+ label: 'Version',
+ value: 'version'
+}, {
+ label: 'Revision',
+ value: 'revision'
+}];
+
+let decommissionUuids: string | string[] = [];
+const COLUMN_UPDATE_DECOMMISSIONING = 'DECOMMISSIONING';
+
+const Datanodes: React.FC<{}> = () => {
+
+ const cancelSignal = useRef<AbortController>();
+ const cancelDecommissionSignal = useRef<AbortController>();
+
+ const [state, setState] = useState<DatanodesState>({
+ lastUpdated: 0,
+ columnOptions: defaultColumns,
+ dataSource: []
+ });
+ const [loading, setLoading] = useState<boolean>(false);
+ const [selectedColumns, setSelectedColumns] = useState<Option[]>(defaultColumns);
+ const [selectedRows, setSelectedRows] = useState<React.Key[]>([]);
+ const [searchTerm, setSearchTerm] = useState<string>('');
+ const [searchColumn, setSearchColumn] = useState<'hostname' | 'uuid' | 'version' | 'revision'>('hostname');
+ const [modalOpen, setModalOpen] = useState<boolean>(false);
+
+ const debouncedSearch = useDebounce(searchTerm, 300);
+
+ function handleColumnChange(selected: ValueType<Option, true>) {
+ setSelectedColumns(selected as Option[]);
+ }
+
+ async function loadDecommisionAPI() {
+ decommissionUuids = [];
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes/decommission/info',
+ cancelDecommissionSignal.current
+ );
+ cancelDecommissionSignal.current = controller;
+ return request
+ };
+
+ async function loadDataNodeAPI() {
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes',
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ return request;
+ };
+
+ async function removeDatanode(selectedRowKeys: string[]) {
+ setLoading(true);
+ const { request, controller } = await AxiosPutHelper(
+ '/api/v1/datanodes/remove',
+ selectedRowKeys,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ request.then(() => {
+ loadData();
+ }).catch((error) => {
+ showDataFetchError(error.toString());
+ }).finally(() => {
+ setLoading(false);
+ setSelectedRows([]);
+ });
+ }
+
+ const loadData = async () => {
+ setLoading(true);
+ // Need to call decommission API on each interval to get updated status
+ // before datanode API call to compare UUID's
+ // update 'Operation State' column in table manually before rendering
+ try {
+ let decomissionResponse = await loadDecommisionAPI();
+ decommissionUuids = decomissionResponse.data?.DatanodesDecommissionInfo?.map(
+ (item: DatanodeDecomissionInfo) => item.datanodeDetails.uuid
+ );
+ } catch (error) {
+ decommissionUuids = [];
+ showDataFetchError((error as AxiosError).toString());
+ }
+
+ try {
+ const datanodesAPIResponse = await loadDataNodeAPI();
+ const datanodesResponse: DatanodesResponse = datanodesAPIResponse.data;
+ const datanodes: DatanodeResponse[] = datanodesResponse.datanodes;
+ const dataSource: Datanode[] = datanodes?.map(
+ (datanode) => ({
+ hostname: datanode.hostname,
+ uuid: datanode.uuid,
+ state: datanode.state,
+ opState: (decommissionUuids?.includes(datanode.uuid) && datanode.opState !== 'DECOMMISSIONED')
+ ? COLUMN_UPDATE_DECOMMISSIONING
+ : datanode.opState,
+ lastHeartbeat: datanode.lastHeartbeat,
+ storageUsed: datanode.storageReport.used,
+ storageTotal: datanode.storageReport.capacity,
+ storageCommitted: datanode.storageReport.committed,
+ storageRemaining: datanode.storageReport.remaining,
+ pipelines: datanode.pipelines,
+ containers: datanode.containers,
+ openContainers: datanode.openContainers,
+ leaderCount: datanode.leaderCount,
+ version: datanode.version,
+ setupTime: datanode.setupTime,
+ revision: datanode.revision,
+ buildDate: datanode.buildDate,
+ networkLocation: datanode.networkLocation
+ })
+ );
+ setLoading(false);
+ setState({
+ ...state,
+ dataSource: dataSource,
+ lastUpdated: Number(moment())
+ });
+ } catch (error) {
+ setLoading(false);
+ showDataFetchError((error as AxiosError).toString())
+ }
+ }
+
+ const autoReloadHelper: AutoReloadHelper = new AutoReloadHelper(loadData);
+
+ useEffect(() => {
+ autoReloadHelper.startPolling();
+ loadData();
+
+ return (() => {
+ autoReloadHelper.stopPolling();
+ cancelRequests([
+ cancelSignal.current!,
+ cancelDecommissionSignal.current!
+ ]);
+ });
+ }, []);
+
+ function handleSelectionChange(rows: React.Key[]) {
+ setSelectedRows(rows);
+ }
+
+ function handleModalOk() {
+ setModalOpen(false);
+ removeDatanode(selectedRows as string[])
+ };
+
+ function handleModalCancel() {
+ setModalOpen(false);
+ setSelectedRows([]);
+ };
+
+ const { dataSource, lastUpdated, columnOptions } = state;
+
+ return (
+ <>
+ <div className='page-header-v2'>
+ Datanodes
+ <AutoReloadPanel
+ isLoading={loading}
+ lastRefreshed={lastUpdated}
+ togglePolling={autoReloadHelper.handleAutoReloadToggle}
+ onReload={loadData} />
+ </div>
+ <div style={{ padding: '24px' }}>
+ <div className='content-div'>
+ <div className='table-header-section'>
+ <div className='table-filter-section'>
+ <MultiSelect
+ options={columnOptions}
+ defaultValue={selectedColumns}
+ selected={selectedColumns}
+ placeholder='Columns'
+ onChange={handleColumnChange}
+ onTagClose={() => { }}
+ fixedColumn='hostname'
+ columnLength={columnOptions.length} />
+ {selectedRows.length > 0 &&
+ <Button
+ type="primary"
+ icon={<DeleteOutlined />}
+ style={{
+ background: '#FF4D4E',
+ borderColor: '#FF4D4E'
+ }}
+ loading={loading}
+ onClick={() => { setModalOpen(true) }}> Remove
+ </Button>
+ }
+ </div>
+ <Search
+ disabled={dataSource?.length < 1}
+ searchOptions={SearchableColumnOpts}
+ searchInput={searchTerm}
+ searchColumn={searchColumn}
+ onSearchChange={
+ (e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)
+ }
+ onChange={(value) => {
+ setSearchTerm('');
+ setSearchColumn(value as 'hostname' | 'uuid' | 'version' | 'revision')
+ }} />
+ </div>
+ <DatanodesTable
+ loading={loading}
+ data={dataSource}
+ selectedColumns={selectedColumns}
+ selectedRows={selectedRows}
+ searchColumn={searchColumn}
+ searchTerm={debouncedSearch}
+ handleSelectionChange={handleSelectionChange}
+ decommissionUuids={decommissionUuids} />
+ </div>
+ </div>
+ <Modal
+ title=''
+ centered={true}
+ visible={modalOpen}
+ onOk={handleModalOk}
+ onCancel={handleModalCancel}
+ closable={false}
+ width={400} >
+ <div style={{
+ margin: '0px 0px 5px 0px',
+ fontSize: '16px',
+ fontWeight: 'bold'
+ }}>
+ <WarningFilled className='icon-warning' style={{paddingRight: '8px'}}/>
+ Stop Tracking Datanode
+ </div>
+ Are you sure, you want recon to stop tracking the selected <strong>{selectedRows.length}</strong> datanode(s)?
Review Comment:
Is this issue taken care ?
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devmadhuu (via GitHub)" <gi...@apache.org>.
devmadhuu commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1751213827
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
+ setState({
+ ...state,
+ loading: true
+ });
+ try {
+ const { request, controller } = AxiosGetHelper(
+ `/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ const datanodesInfoResponse = await request;
+ setState({
+ ...state,
+ loading: false,
+ summaryData: datanodesInfoResponse?.data?.DatanodesDecommissionInfo[0] ?? {}
+ });
+ } catch (error) {
+ setState({
+ ...state,
+ loading: false,
+ summaryData: {}
+ });
+ showDataFetchError((error as AxiosError).toString());
+ }
+ }
+
+ useEffect(() => {
+ fetchDecommissionSummary(uuid);
+ return (() => {
+ cancelRequests([cancelSignal.current!]);
+ })
+ }, []);
+
+ let content = (
+ <Result
+ status='error'
+ title='Unable to fetch Decommission Summary data'
+ className='decommission-summary-result'/>
+ );
+
+ const { summaryData } = state;
+ if (summaryData?.datanodeDetails && summaryData?.metrics && summaryData?.containers) {
+ const {
+ datanodeDetails: { uuid, networkLocation, ipAddress, hostName },
+ containers: { UnderReplicated, UnClosed },
+ metrics: { decommissionStartTime, numOfUnclosedPipelines, numOfUnclosedContainers, numOfUnderReplicatedContainers }
+ } = summaryData as SummaryData;
+ content = (
+ <Descriptions size="small" bordered column={1} title={`Decommission Status: DECOMMISSIONING`}>
Review Comment:
Can we move this whole `Description` into its own function or component or clarity. Make it clumsy or less readable when nested inside main `if `block
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
+ setState({
+ ...state,
+ loading: true
+ });
+ try {
+ const { request, controller } = AxiosGetHelper(
+ `/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ const datanodesInfoResponse = await request;
+ setState({
+ ...state,
+ loading: false,
+ summaryData: datanodesInfoResponse?.data?.DatanodesDecommissionInfo[0] ?? {}
+ });
+ } catch (error) {
+ setState({
+ ...state,
+ loading: false,
+ summaryData: {}
+ });
+ showDataFetchError((error as AxiosError).toString());
+ }
+ }
+
+ useEffect(() => {
+ fetchDecommissionSummary(uuid);
+ return (() => {
+ cancelRequests([cancelSignal.current!]);
+ })
+ }, []);
+
+ let content = (
+ <Result
+ status='error'
+ title='Unable to fetch Decommission Summary data'
+ className='decommission-summary-result'/>
+ );
+
+ const { summaryData } = state;
+ if (summaryData?.datanodeDetails && summaryData?.metrics && summaryData?.containers) {
+ const {
+ datanodeDetails: { uuid, networkLocation, ipAddress, hostName },
+ containers: { UnderReplicated, UnClosed },
+ metrics: { decommissionStartTime, numOfUnclosedPipelines, numOfUnclosedContainers, numOfUnderReplicatedContainers }
+ } = summaryData as SummaryData;
+ content = (
+ <Descriptions size="small" bordered column={1} title={`Decommission Status: DECOMMISSIONING`}>
+ <Descriptions.Item label="Datanode"> <b>{uuid}</b></Descriptions.Item>
+ <Descriptions.Item label="Location">({networkLocation}/{ipAddress}/{hostName})</Descriptions.Item>
+ <Descriptions.Item label="Decommissioning Started at">{decommissionStartTime}</Descriptions.Item>
+ <Descriptions.Item label="No. of Unclosed Pipelines">{numOfUnclosedPipelines}</Descriptions.Item>
+ <Descriptions.Item label="No. of Unclosed Containers">{numOfUnclosedContainers}</Descriptions.Item>
+ <Descriptions.Item label="No. of Under-Replicated Containers">{numOfUnderReplicatedContainers}</Descriptions.Item>
+ <Descriptions.Item label="Under-Replicated">{UnderReplicated}</Descriptions.Item>
+ <Descriptions.Item label="Unclosed">{UnClosed}</Descriptions.Item>
+ </Descriptions>
+ );
+ }
+ // Need to check summarydata is not empty
Review Comment:
This comment seems not in sync what code is doing actually. Can we make it more meaningful ?
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
Review Comment:
Not sure if it is feasible, but check if we can add a loading spinner or skeleton to the UI to indicate that data is being fetched:
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on PR #7168:
URL: https://github.com/apache/ozone/pull/7168#issuecomment-2360509838
Thanks @devabhishekpal for the patch & @devmadhuu 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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1752084393
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
Review Comment:
Added a spin loader to indicate loading status in the latest commit
<img width="1723" alt="Screenshot 2024-09-10 at 19 47 57" src="https://github.com/user-attachments/assets/818ed9cf-1cf9-45d9-be9d-0278b920cb97">
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760687440
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
+ <Tooltip
+ title='The number of Ratis Pipelines in which the given datanode is elected as a leader.' >
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'leaderCount',
+ key: 'leaderCount',
+ sorter: (a: Datanode, b: Datanode) => a.leaderCount - b.leaderCount
+ },
+ {
+ title: 'Containers',
+ dataIndex: 'containers',
+ key: 'containers',
+ sorter: (a: Datanode, b: Datanode) => a.containers - b.containers
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles}>
+ Open Container
+ <Tooltip title='The number of open containers per pipeline.'>
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'openContainers',
+ key: 'openContainers',
+ sorter: (a: Datanode, b: Datanode) => a.openContainers - b.openContainers
+ },
+ {
+ title: 'Version',
+ dataIndex: 'version',
+ key: 'version',
+ sorter: (a: Datanode, b: Datanode) => a.version.localeCompare(b.version),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Setup Time',
+ dataIndex: 'setupTime',
+ key: 'setupTime',
+ sorter: (a: Datanode, b: Datanode) => a.setupTime - b.setupTime,
+ render: (uptime: number) => {
+ return uptime > 0 ? moment(uptime).format('ll LTS') : 'NA';
+ }
+ },
+ {
+ title: 'Revision',
+ dataIndex: 'revision',
+ key: 'revision',
+ sorter: (a: Datanode, b: Datanode) => a.revision.localeCompare(b.revision),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Build Date',
+ dataIndex: 'buildDate',
+ key: 'buildDate',
+ sorter: (a: Datanode, b: Datanode) => a.buildDate.localeCompare(b.buildDate),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Network Location',
+ dataIndex: 'networkLocation',
+ key: 'networkLocation',
+ sorter: (a: Datanode, b: Datanode) => a.networkLocation.localeCompare(b.networkLocation),
+ defaultSortOrder: 'ascend' as const
+ }
+];
+
+const DatanodesTable: React.FC<DatanodeTableProps> = ({
+ data,
+ handleSelectionChange,
+ decommissionUuids,
+ selectedColumns,
+ loading = false,
+ selectedRows = [],
+ searchColumn = 'hostname',
Review Comment:
This is a drawback of the current implementation.
If we are using a button to 'submit' the search result, we can perform operations on the input like trimming.
But since this is a debounced search input, where the user doesn't need to press any button to search, it will be picking up whatever the user types.
Adding a check for the input would slow down the process for longer inputs since the check would run on each input substring if the user stops typing within the timeout interval
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760666562
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
+ <Tooltip
+ title='The number of Ratis Pipelines in which the given datanode is elected as a leader.' >
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'leaderCount',
+ key: 'leaderCount',
+ sorter: (a: Datanode, b: Datanode) => a.leaderCount - b.leaderCount
+ },
+ {
+ title: 'Containers',
+ dataIndex: 'containers',
+ key: 'containers',
+ sorter: (a: Datanode, b: Datanode) => a.containers - b.containers
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles}>
+ Open Container
+ <Tooltip title='The number of open containers per pipeline.'>
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'openContainers',
+ key: 'openContainers',
+ sorter: (a: Datanode, b: Datanode) => a.openContainers - b.openContainers
+ },
+ {
+ title: 'Version',
Review Comment:
We will also need to add search functionality for the Version column in the new UI.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
Review Comment:
In the old UI, we had a searchable Leader Count column, but in the new UI, this search functionality is missing. The same applies to the Container ID column.
<img width="471" alt="image" src="https://github.com/user-attachments/assets/a999b5ce-d212-4763-a3b7-3334bf12b155">
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
+ <Tooltip
+ title='The number of Ratis Pipelines in which the given datanode is elected as a leader.' >
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'leaderCount',
+ key: 'leaderCount',
+ sorter: (a: Datanode, b: Datanode) => a.leaderCount - b.leaderCount
+ },
+ {
+ title: 'Containers',
+ dataIndex: 'containers',
+ key: 'containers',
+ sorter: (a: Datanode, b: Datanode) => a.containers - b.containers
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles}>
+ Open Container
+ <Tooltip title='The number of open containers per pipeline.'>
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'openContainers',
+ key: 'openContainers',
+ sorter: (a: Datanode, b: Datanode) => a.openContainers - b.openContainers
+ },
+ {
+ title: 'Version',
+ dataIndex: 'version',
+ key: 'version',
+ sorter: (a: Datanode, b: Datanode) => a.version.localeCompare(b.version),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Setup Time',
+ dataIndex: 'setupTime',
+ key: 'setupTime',
+ sorter: (a: Datanode, b: Datanode) => a.setupTime - b.setupTime,
+ render: (uptime: number) => {
+ return uptime > 0 ? moment(uptime).format('ll LTS') : 'NA';
+ }
+ },
+ {
+ title: 'Revision',
Review Comment:
I’m not sure if the searchable Revision field is useful in its current form.
<img width="1139" alt="image" src="https://github.com/user-attachments/assets/0dbb2c01-7e18-4f14-a4b6-588a3e743f14">
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
+ <Tooltip
+ title='The number of Ratis Pipelines in which the given datanode is elected as a leader.' >
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'leaderCount',
+ key: 'leaderCount',
+ sorter: (a: Datanode, b: Datanode) => a.leaderCount - b.leaderCount
+ },
+ {
+ title: 'Containers',
+ dataIndex: 'containers',
+ key: 'containers',
+ sorter: (a: Datanode, b: Datanode) => a.containers - b.containers
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles}>
+ Open Container
+ <Tooltip title='The number of open containers per pipeline.'>
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'openContainers',
+ key: 'openContainers',
+ sorter: (a: Datanode, b: Datanode) => a.openContainers - b.openContainers
+ },
+ {
+ title: 'Version',
+ dataIndex: 'version',
+ key: 'version',
+ sorter: (a: Datanode, b: Datanode) => a.version.localeCompare(b.version),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Setup Time',
+ dataIndex: 'setupTime',
+ key: 'setupTime',
+ sorter: (a: Datanode, b: Datanode) => a.setupTime - b.setupTime,
+ render: (uptime: number) => {
+ return uptime > 0 ? moment(uptime).format('ll LTS') : 'NA';
+ }
+ },
+ {
+ title: 'Revision',
Review Comment:
Let’s discuss offline whether these additional search functionalities are required for certain columns, or if we should limit it to only the use cases where it is really necessary and will assist users in debugging.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
Review Comment:
I don’t think adding a search feature for Leader Count is necessary, but I do believe having a search option for Container ID is important. While debugging, we need to be able to identify which node contains a problematic container. It turns out that the search feature for the Container ID column was faulty and didn’t work correctly in the old UI.
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
+ <Tooltip
+ title='The number of Ratis Pipelines in which the given datanode is elected as a leader.' >
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'leaderCount',
+ key: 'leaderCount',
+ sorter: (a: Datanode, b: Datanode) => a.leaderCount - b.leaderCount
+ },
+ {
+ title: 'Containers',
+ dataIndex: 'containers',
+ key: 'containers',
+ sorter: (a: Datanode, b: Datanode) => a.containers - b.containers
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles}>
+ Open Container
+ <Tooltip title='The number of open containers per pipeline.'>
+ <InfoCircleOutlined style={{ paddingLeft: '4px' }} />
+ </Tooltip>
+ </span>
+ ),
+ dataIndex: 'openContainers',
+ key: 'openContainers',
+ sorter: (a: Datanode, b: Datanode) => a.openContainers - b.openContainers
+ },
+ {
+ title: 'Version',
+ dataIndex: 'version',
+ key: 'version',
+ sorter: (a: Datanode, b: Datanode) => a.version.localeCompare(b.version),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Setup Time',
+ dataIndex: 'setupTime',
+ key: 'setupTime',
+ sorter: (a: Datanode, b: Datanode) => a.setupTime - b.setupTime,
+ render: (uptime: number) => {
+ return uptime > 0 ? moment(uptime).format('ll LTS') : 'NA';
+ }
+ },
+ {
+ title: 'Revision',
+ dataIndex: 'revision',
+ key: 'revision',
+ sorter: (a: Datanode, b: Datanode) => a.revision.localeCompare(b.revision),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Build Date',
+ dataIndex: 'buildDate',
+ key: 'buildDate',
+ sorter: (a: Datanode, b: Datanode) => a.buildDate.localeCompare(b.buildDate),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'Network Location',
+ dataIndex: 'networkLocation',
+ key: 'networkLocation',
+ sorter: (a: Datanode, b: Datanode) => a.networkLocation.localeCompare(b.networkLocation),
+ defaultSortOrder: 'ascend' as const
+ }
+];
+
+const DatanodesTable: React.FC<DatanodeTableProps> = ({
+ data,
+ handleSelectionChange,
+ decommissionUuids,
+ selectedColumns,
+ loading = false,
+ selectedRows = [],
+ searchColumn = 'hostname',
Review Comment:
This issue is present in both the old and new UI: if a user accidentally adds a space at the end of their search input, the search doesn’t work. While it’s not a critical issue, we could remove any unnecessary spaces from the search input automatically. It’s a small improvement, but I noticed it when I was testing the search functionality.
This issue is present in both the old and new UI: if a user accidentally adds a space at the end of their search input, the search doesn’t work. While it’s not a critical issue, we could remove any unnecessary spaces from the search input automatically. It’s a small improvement, but I noticed it when I was testing the search functionality.
This issue is present in both the old and new UI: if a user accidentally adds a space at the end of their search input, the search doesn’t work. While it’s not a critical issue, we could remove any unnecessary spaces from the search input automatically. It’s a small improvement, but I noticed it when I was testing the search functionality.
<img width="1016" alt="image" src="https://github.com/user-attachments/assets/9566f1bc-f1d6-466f-8e55-258420a200e2">
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/datanodes/datanodes.tsx:
##########
@@ -0,0 +1,312 @@
+/*
+ * 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,
+ useRef,
+ useState
+} from 'react';
+import moment from 'moment';
+import { AxiosError } from 'axios';
+import {
+ Button,
+ Modal
+} from 'antd';
+import {
+ DeleteOutlined,
+ WarningFilled,
+} from '@ant-design/icons';
+import { ValueType } from 'react-select';
+
+import Search from '@/v2/components/search/search';
+import MultiSelect, { Option } from '@/v2/components/select/multiSelect';
+import DatanodesTable, { COLUMNS } from '@/v2/components/tables/datanodesTable';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { showDataFetchError } from '@/utils/common';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import {
+ AxiosGetHelper,
+ AxiosPutHelper,
+ cancelRequests
+} from '@/utils/axiosRequestHelper';
+
+import { useDebounce } from '@/v2/hooks/debounce.hook';
+import {
+ Datanode,
+ DatanodeDecomissionInfo,
+ DatanodeResponse,
+ DatanodesResponse,
+ DatanodesState
+} from '@/v2/types/datanode.types';
+
+import './datanodes.less'
+
+
+const defaultColumns = COLUMNS.map(column => ({
+ label: (typeof column.title === 'string')
+ ? column.title
+ : (column.title as Function)().props.children[0],
+ value: column.key as string
+}));
+
+const SearchableColumnOpts = [{
+ label: 'Hostname',
+ value: 'hostname'
+}, {
+ label: 'UUID',
+ value: 'uuid'
+}, {
+ label: 'Version',
+ value: 'version'
+}, {
+ label: 'Revision',
+ value: 'revision'
+}];
+
+let decommissionUuids: string | string[] = [];
+const COLUMN_UPDATE_DECOMMISSIONING = 'DECOMMISSIONING';
+
+const Datanodes: React.FC<{}> = () => {
+
+ const cancelSignal = useRef<AbortController>();
+ const cancelDecommissionSignal = useRef<AbortController>();
+
+ const [state, setState] = useState<DatanodesState>({
+ lastUpdated: 0,
+ columnOptions: defaultColumns,
+ dataSource: []
+ });
+ const [loading, setLoading] = useState<boolean>(false);
+ const [selectedColumns, setSelectedColumns] = useState<Option[]>(defaultColumns);
+ const [selectedRows, setSelectedRows] = useState<React.Key[]>([]);
+ const [searchTerm, setSearchTerm] = useState<string>('');
+ const [searchColumn, setSearchColumn] = useState<'hostname' | 'uuid' | 'version' | 'revision'>('hostname');
+ const [modalOpen, setModalOpen] = useState<boolean>(false);
+
+ const debouncedSearch = useDebounce(searchTerm, 300);
+
+ function handleColumnChange(selected: ValueType<Option, true>) {
+ setSelectedColumns(selected as Option[]);
+ }
+
+ async function loadDecommisionAPI() {
+ decommissionUuids = [];
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes/decommission/info',
+ cancelDecommissionSignal.current
+ );
+ cancelDecommissionSignal.current = controller;
+ return request
+ };
+
+ async function loadDataNodeAPI() {
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes',
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ return request;
+ };
+
+ async function removeDatanode(selectedRowKeys: string[]) {
+ setLoading(true);
+ const { request, controller } = await AxiosPutHelper(
+ '/api/v1/datanodes/remove',
+ selectedRowKeys,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ request.then(() => {
+ loadData();
+ }).catch((error) => {
+ showDataFetchError(error.toString());
+ }).finally(() => {
+ setLoading(false);
+ setSelectedRows([]);
+ });
+ }
+
+ const loadData = async () => {
+ setLoading(true);
+ // Need to call decommission API on each interval to get updated status
+ // before datanode API call to compare UUID's
+ // update 'Operation State' column in table manually before rendering
+ try {
+ let decomissionResponse = await loadDecommisionAPI();
+ decommissionUuids = decomissionResponse.data?.DatanodesDecommissionInfo?.map(
+ (item: DatanodeDecomissionInfo) => item.datanodeDetails.uuid
+ );
+ } catch (error) {
+ decommissionUuids = [];
+ showDataFetchError((error as AxiosError).toString());
+ }
+
+ try {
+ const datanodesAPIResponse = await loadDataNodeAPI();
+ const datanodesResponse: DatanodesResponse = datanodesAPIResponse.data;
+ const datanodes: DatanodeResponse[] = datanodesResponse.datanodes;
+ const dataSource: Datanode[] = datanodes?.map(
+ (datanode) => ({
+ hostname: datanode.hostname,
+ uuid: datanode.uuid,
+ state: datanode.state,
+ opState: (decommissionUuids?.includes(datanode.uuid) && datanode.opState !== 'DECOMMISSIONED')
+ ? COLUMN_UPDATE_DECOMMISSIONING
+ : datanode.opState,
+ lastHeartbeat: datanode.lastHeartbeat,
+ storageUsed: datanode.storageReport.used,
+ storageTotal: datanode.storageReport.capacity,
+ storageCommitted: datanode.storageReport.committed,
+ storageRemaining: datanode.storageReport.remaining,
+ pipelines: datanode.pipelines,
+ containers: datanode.containers,
+ openContainers: datanode.openContainers,
+ leaderCount: datanode.leaderCount,
+ version: datanode.version,
+ setupTime: datanode.setupTime,
+ revision: datanode.revision,
+ buildDate: datanode.buildDate,
+ networkLocation: datanode.networkLocation
+ })
+ );
+ setLoading(false);
+ setState({
+ ...state,
+ dataSource: dataSource,
+ lastUpdated: Number(moment())
+ });
+ } catch (error) {
+ setLoading(false);
+ showDataFetchError((error as AxiosError).toString())
+ }
+ }
+
+ const autoReloadHelper: AutoReloadHelper = new AutoReloadHelper(loadData);
+
+ useEffect(() => {
+ autoReloadHelper.startPolling();
+ loadData();
+
+ return (() => {
+ autoReloadHelper.stopPolling();
+ cancelRequests([
+ cancelSignal.current!,
+ cancelDecommissionSignal.current!
+ ]);
+ });
+ }, []);
+
+ function handleSelectionChange(rows: React.Key[]) {
+ setSelectedRows(rows);
+ }
+
+ function handleModalOk() {
+ setModalOpen(false);
+ removeDatanode(selectedRows as string[])
+ };
+
+ function handleModalCancel() {
+ setModalOpen(false);
+ setSelectedRows([]);
+ };
+
+ const { dataSource, lastUpdated, columnOptions } = state;
+
+ return (
+ <>
+ <div className='page-header-v2'>
+ Datanodes
+ <AutoReloadPanel
+ isLoading={loading}
+ lastRefreshed={lastUpdated}
+ togglePolling={autoReloadHelper.handleAutoReloadToggle}
+ onReload={loadData} />
+ </div>
+ <div style={{ padding: '24px' }}>
+ <div className='content-div'>
+ <div className='table-header-section'>
+ <div className='table-filter-section'>
+ <MultiSelect
+ options={columnOptions}
+ defaultValue={selectedColumns}
+ selected={selectedColumns}
+ placeholder='Columns'
+ onChange={handleColumnChange}
+ onTagClose={() => { }}
+ fixedColumn='hostname'
+ columnLength={columnOptions.length} />
+ {selectedRows.length > 0 &&
+ <Button
+ type="primary"
+ icon={<DeleteOutlined />}
+ style={{
+ background: '#FF4D4E',
+ borderColor: '#FF4D4E'
+ }}
+ loading={loading}
+ onClick={() => { setModalOpen(true) }}> Remove
+ </Button>
+ }
+ </div>
+ <Search
+ disabled={dataSource?.length < 1}
+ searchOptions={SearchableColumnOpts}
+ searchInput={searchTerm}
+ searchColumn={searchColumn}
+ onSearchChange={
+ (e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)
+ }
+ onChange={(value) => {
+ setSearchTerm('');
+ setSearchColumn(value as 'hostname' | 'uuid' | 'version' | 'revision')
+ }} />
+ </div>
+ <DatanodesTable
+ loading={loading}
+ data={dataSource}
+ selectedColumns={selectedColumns}
+ selectedRows={selectedRows}
+ searchColumn={searchColumn}
+ searchTerm={debouncedSearch}
+ handleSelectionChange={handleSelectionChange}
+ decommissionUuids={decommissionUuids} />
+ </div>
+ </div>
+ <Modal
+ title=''
+ centered={true}
+ visible={modalOpen}
+ onOk={handleModalOk}
+ onCancel={handleModalCancel}
+ closable={false}
+ width={400} >
+ <div style={{
+ margin: '0px 0px 5px 0px',
+ fontSize: '16px',
+ fontWeight: 'bold'
+ }}>
+ <WarningFilled className='icon-warning' style={{paddingRight: '8px'}}/>
+ Stop Tracking Datanode
+ </div>
+ Are you sure, you want recon to stop tracking the selected <strong>{selectedRows.length}</strong> datanode(s)?
Review Comment:
Another issue I encountered is that when all datanodes are removed from the list (e.g., by shutting them down), the new UI crashes and displays an error. This behavior wasn’t present in the old UI, which handled this case by showing an empty list.
<img width="944" alt="image" src="https://github.com/user-attachments/assets/36d59162-b4a1-4cd5-97fe-6a8c68a843dc">
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760693043
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/tables/datanodesTable.tsx:
##########
@@ -0,0 +1,315 @@
+/*
+ * 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 { ReplicationIcon } from '@/utils/themeIcons';
+import DecommissionSummary from '@/v2/components/decommissioningSummary/decommissioningSummary';
+import StorageBar from '@/v2/components/storageBar/storageBar';
+import { Datanode, DatanodeOpState, DatanodeOpStateList, DatanodeState, DatanodeStateList, DatanodeTableProps } from '@/v2/types/datanode.types';
+import { Pipeline } from '@/v2/types/pipelines.types';
+import { CheckCircleFilled, CloseCircleFilled, HourglassFilled, InfoCircleOutlined, WarningFilled } from '@ant-design/icons';
+import { Popover, Tooltip } from 'antd'
+import Table, { ColumnsType, TablePaginationConfig } from 'antd/es/table';
+import { TableRowSelection } from 'antd/es/table/interface';
+import moment from 'moment';
+import React from 'react';
+
+moment.updateLocale('en', {
+ relativeTime: {
+ past: '%s ago',
+ s: '%ds',
+ m: '1min',
+ mm: '%dmins',
+ h: '1hr',
+ hh: '%dhrs',
+ d: '1d',
+ dd: '%dd',
+ M: '1m',
+ MM: '%dm',
+ y: '1y',
+ yy: '%dy'
+ }
+});
+
+let decommissioningUuids: string | string[] = [];
+
+const headerIconStyles: React.CSSProperties = {
+ display: 'flex',
+ alignItems: 'center'
+}
+
+const renderDatanodeState = (state: DatanodeState) => {
+ const stateIconMap = {
+ HEALTHY: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ STALE: <HourglassFilled className='icon-warning' />,
+ DEAD: <CloseCircleFilled className='icon-failure' />
+ };
+ const icon = state in stateIconMap ? stateIconMap[state] : '';
+ return <span>{icon} {state}</span>;
+};
+
+const renderDatanodeOpState = (opState: DatanodeOpState) => {
+ const opStateIconMap = {
+ IN_SERVICE: <CheckCircleFilled twoToneColor='#1da57a' className='icon-success' />,
+ DECOMMISSIONING: <HourglassFilled className='icon-warning' />,
+ DECOMMISSIONED: <WarningFilled className='icon-warning' />,
+ ENTERING_MAINTENANCE: <HourglassFilled className='icon-warning' />,
+ IN_MAINTENANCE: <WarningFilled className='icon-warning' />
+ };
+ const icon = opState in opStateIconMap ? opStateIconMap[opState] : '';
+ return <span>{icon} {opState}</span>;
+};
+
+const getTimeDiffFromTimestamp = (timestamp: number): string => {
+ const timestampDate = new Date(timestamp);
+ return moment(timestampDate).fromNow();
+}
+
+export const COLUMNS: ColumnsType<Datanode> = [
+ {
+ title: 'Hostname',
+ dataIndex: 'hostname',
+ key: 'hostname',
+ sorter: (a: Datanode, b: Datanode) => a.hostname.localeCompare(
+ b.hostname, undefined, { numeric: true }
+ ),
+ defaultSortOrder: 'ascend' as const
+ },
+ {
+ title: 'State',
+ dataIndex: 'state',
+ key: 'state',
+ filterMultiple: true,
+ filters: DatanodeStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.state === value,
+ render: (text: DatanodeState) => renderDatanodeState(text),
+ sorter: (a: Datanode, b: Datanode) => a.state.localeCompare(b.state)
+ },
+ {
+ title: 'Operational State',
+ dataIndex: 'opState',
+ key: 'opState',
+ filterMultiple: true,
+ filters: DatanodeOpStateList.map(state => ({ text: state, value: state })),
+ onFilter: (value, record: Datanode) => record.opState === value,
+ render: (text: DatanodeOpState) => renderDatanodeOpState(text),
+ sorter: (a: Datanode, b: Datanode) => a.opState.localeCompare(b.opState)
+ },
+ {
+ title: 'UUID',
+ dataIndex: 'uuid',
+ key: 'uuid',
+ sorter: (a: Datanode, b: Datanode) => a.uuid.localeCompare(b.uuid),
+ defaultSortOrder: 'ascend' as const,
+ render: (uuid: string, record: Datanode) => {
+ return (
+ //1. Compare Decommission Api's UUID with all UUID in table and show Decommission Summary
+ (decommissioningUuids && decommissioningUuids.includes(record.uuid) && record.opState !== 'DECOMMISSIONED') ?
+ <DecommissionSummary uuid={uuid} /> : <span>{uuid}</span>
+ );
+ }
+ },
+ {
+ title: 'Storage Capacity',
+ dataIndex: 'storageUsed',
+ key: 'storageUsed',
+ sorter: (a: Datanode, b: Datanode) => a.storageRemaining - b.storageRemaining,
+ render: (_: string, record: Datanode) => (
+ <StorageBar
+ strokeWidth={6}
+ capacity={record.storageTotal}
+ used={record.storageUsed}
+ remaining={record.storageRemaining}
+ committed={record.storageCommitted} />
+ )
+ },
+ {
+ title: 'Last Heartbeat',
+ dataIndex: 'lastHeartbeat',
+ key: 'lastHeartbeat',
+ sorter: (a: Datanode, b: Datanode) => moment(a.lastHeartbeat).unix() - moment(b.lastHeartbeat).unix(),
+ render: (heartbeat: number) => {
+ return heartbeat > 0 ? getTimeDiffFromTimestamp(heartbeat) : 'NA';
+ }
+ },
+ {
+ title: 'Pipeline ID(s)',
+ dataIndex: 'pipelines',
+ key: 'pipelines',
+ render: (pipelines: Pipeline[], record: Datanode) => {
+ const renderPipelineIds = (pipelineIds: Pipeline[]) => {
+ return pipelineIds?.map((pipeline: any, index: any) => (
+ <div key={index} className='pipeline-container-v2'>
+ <ReplicationIcon
+ replicationFactor={pipeline.replicationFactor}
+ replicationType={pipeline.replicationType}
+ leaderNode={pipeline.leaderNode}
+ isLeader={pipeline.leaderNode === record.hostname} />
+ {pipeline.pipelineID}
+ </div >
+ ))
+ }
+
+ return (
+ <Popover
+ content={
+ renderPipelineIds(pipelines)
+ }
+ title="Related Pipelines"
+ placement="bottomLeft"
+ trigger="hover">
+ <strong>{pipelines.length}</strong> pipelines
+ </Popover>
+ );
+ }
+ },
+ {
+ title: () => (
+ <span style={headerIconStyles} >
+ Leader Count
Review Comment:
So this was the containers count column and as discussed this won't benefit from a search feature.
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on PR #7168:
URL: https://github.com/apache/ozone/pull/7168#issuecomment-2352252847
> I noticed Devesh's comment about organizing different functionalities into separate files. Do we need something similar for this page as well, @devabhishekpal? [#7171 (comment)](https://github.com/apache/ozone/pull/7171#issuecomment-2342794750)
So I have separated out the table into it's own component. However for the others please refer to https://github.com/apache/ozone/pull/7171#issuecomment-2341729481 for reason
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "ArafatKhan2198 (via GitHub)" <gi...@apache.org>.
ArafatKhan2198 commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1760670635
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/datanodes/datanodes.tsx:
##########
@@ -0,0 +1,312 @@
+/*
+ * 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,
+ useRef,
+ useState
+} from 'react';
+import moment from 'moment';
+import { AxiosError } from 'axios';
+import {
+ Button,
+ Modal
+} from 'antd';
+import {
+ DeleteOutlined,
+ WarningFilled,
+} from '@ant-design/icons';
+import { ValueType } from 'react-select';
+
+import Search from '@/v2/components/search/search';
+import MultiSelect, { Option } from '@/v2/components/select/multiSelect';
+import DatanodesTable, { COLUMNS } from '@/v2/components/tables/datanodesTable';
+import AutoReloadPanel from '@/components/autoReloadPanel/autoReloadPanel';
+import { showDataFetchError } from '@/utils/common';
+import { AutoReloadHelper } from '@/utils/autoReloadHelper';
+import {
+ AxiosGetHelper,
+ AxiosPutHelper,
+ cancelRequests
+} from '@/utils/axiosRequestHelper';
+
+import { useDebounce } from '@/v2/hooks/debounce.hook';
+import {
+ Datanode,
+ DatanodeDecomissionInfo,
+ DatanodeResponse,
+ DatanodesResponse,
+ DatanodesState
+} from '@/v2/types/datanode.types';
+
+import './datanodes.less'
+
+
+const defaultColumns = COLUMNS.map(column => ({
+ label: (typeof column.title === 'string')
+ ? column.title
+ : (column.title as Function)().props.children[0],
+ value: column.key as string
+}));
+
+const SearchableColumnOpts = [{
+ label: 'Hostname',
+ value: 'hostname'
+}, {
+ label: 'UUID',
+ value: 'uuid'
+}, {
+ label: 'Version',
+ value: 'version'
+}, {
+ label: 'Revision',
+ value: 'revision'
+}];
+
+let decommissionUuids: string | string[] = [];
+const COLUMN_UPDATE_DECOMMISSIONING = 'DECOMMISSIONING';
+
+const Datanodes: React.FC<{}> = () => {
+
+ const cancelSignal = useRef<AbortController>();
+ const cancelDecommissionSignal = useRef<AbortController>();
+
+ const [state, setState] = useState<DatanodesState>({
+ lastUpdated: 0,
+ columnOptions: defaultColumns,
+ dataSource: []
+ });
+ const [loading, setLoading] = useState<boolean>(false);
+ const [selectedColumns, setSelectedColumns] = useState<Option[]>(defaultColumns);
+ const [selectedRows, setSelectedRows] = useState<React.Key[]>([]);
+ const [searchTerm, setSearchTerm] = useState<string>('');
+ const [searchColumn, setSearchColumn] = useState<'hostname' | 'uuid' | 'version' | 'revision'>('hostname');
+ const [modalOpen, setModalOpen] = useState<boolean>(false);
+
+ const debouncedSearch = useDebounce(searchTerm, 300);
+
+ function handleColumnChange(selected: ValueType<Option, true>) {
+ setSelectedColumns(selected as Option[]);
+ }
+
+ async function loadDecommisionAPI() {
+ decommissionUuids = [];
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes/decommission/info',
+ cancelDecommissionSignal.current
+ );
+ cancelDecommissionSignal.current = controller;
+ return request
+ };
+
+ async function loadDataNodeAPI() {
+ const { request, controller } = await AxiosGetHelper(
+ '/api/v1/datanodes',
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ return request;
+ };
+
+ async function removeDatanode(selectedRowKeys: string[]) {
+ setLoading(true);
+ const { request, controller } = await AxiosPutHelper(
+ '/api/v1/datanodes/remove',
+ selectedRowKeys,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ request.then(() => {
+ loadData();
+ }).catch((error) => {
+ showDataFetchError(error.toString());
+ }).finally(() => {
+ setLoading(false);
+ setSelectedRows([]);
+ });
+ }
+
+ const loadData = async () => {
+ setLoading(true);
+ // Need to call decommission API on each interval to get updated status
+ // before datanode API call to compare UUID's
+ // update 'Operation State' column in table manually before rendering
+ try {
+ let decomissionResponse = await loadDecommisionAPI();
+ decommissionUuids = decomissionResponse.data?.DatanodesDecommissionInfo?.map(
+ (item: DatanodeDecomissionInfo) => item.datanodeDetails.uuid
+ );
+ } catch (error) {
+ decommissionUuids = [];
+ showDataFetchError((error as AxiosError).toString());
+ }
+
+ try {
+ const datanodesAPIResponse = await loadDataNodeAPI();
+ const datanodesResponse: DatanodesResponse = datanodesAPIResponse.data;
+ const datanodes: DatanodeResponse[] = datanodesResponse.datanodes;
+ const dataSource: Datanode[] = datanodes?.map(
+ (datanode) => ({
+ hostname: datanode.hostname,
+ uuid: datanode.uuid,
+ state: datanode.state,
+ opState: (decommissionUuids?.includes(datanode.uuid) && datanode.opState !== 'DECOMMISSIONED')
+ ? COLUMN_UPDATE_DECOMMISSIONING
+ : datanode.opState,
+ lastHeartbeat: datanode.lastHeartbeat,
+ storageUsed: datanode.storageReport.used,
+ storageTotal: datanode.storageReport.capacity,
+ storageCommitted: datanode.storageReport.committed,
+ storageRemaining: datanode.storageReport.remaining,
+ pipelines: datanode.pipelines,
+ containers: datanode.containers,
+ openContainers: datanode.openContainers,
+ leaderCount: datanode.leaderCount,
+ version: datanode.version,
+ setupTime: datanode.setupTime,
+ revision: datanode.revision,
+ buildDate: datanode.buildDate,
+ networkLocation: datanode.networkLocation
+ })
+ );
+ setLoading(false);
+ setState({
+ ...state,
+ dataSource: dataSource,
+ lastUpdated: Number(moment())
+ });
+ } catch (error) {
+ setLoading(false);
+ showDataFetchError((error as AxiosError).toString())
+ }
+ }
+
+ const autoReloadHelper: AutoReloadHelper = new AutoReloadHelper(loadData);
+
+ useEffect(() => {
+ autoReloadHelper.startPolling();
+ loadData();
+
+ return (() => {
+ autoReloadHelper.stopPolling();
+ cancelRequests([
+ cancelSignal.current!,
+ cancelDecommissionSignal.current!
+ ]);
+ });
+ }, []);
+
+ function handleSelectionChange(rows: React.Key[]) {
+ setSelectedRows(rows);
+ }
+
+ function handleModalOk() {
+ setModalOpen(false);
+ removeDatanode(selectedRows as string[])
+ };
+
+ function handleModalCancel() {
+ setModalOpen(false);
+ setSelectedRows([]);
+ };
+
+ const { dataSource, lastUpdated, columnOptions } = state;
+
+ return (
+ <>
+ <div className='page-header-v2'>
+ Datanodes
+ <AutoReloadPanel
+ isLoading={loading}
+ lastRefreshed={lastUpdated}
+ togglePolling={autoReloadHelper.handleAutoReloadToggle}
+ onReload={loadData} />
+ </div>
+ <div style={{ padding: '24px' }}>
+ <div className='content-div'>
+ <div className='table-header-section'>
+ <div className='table-filter-section'>
+ <MultiSelect
+ options={columnOptions}
+ defaultValue={selectedColumns}
+ selected={selectedColumns}
+ placeholder='Columns'
+ onChange={handleColumnChange}
+ onTagClose={() => { }}
+ fixedColumn='hostname'
+ columnLength={columnOptions.length} />
+ {selectedRows.length > 0 &&
+ <Button
+ type="primary"
+ icon={<DeleteOutlined />}
+ style={{
+ background: '#FF4D4E',
+ borderColor: '#FF4D4E'
+ }}
+ loading={loading}
+ onClick={() => { setModalOpen(true) }}> Remove
+ </Button>
+ }
+ </div>
+ <Search
+ disabled={dataSource?.length < 1}
+ searchOptions={SearchableColumnOpts}
+ searchInput={searchTerm}
+ searchColumn={searchColumn}
+ onSearchChange={
+ (e: React.ChangeEvent<HTMLInputElement>) => setSearchTerm(e.target.value)
+ }
+ onChange={(value) => {
+ setSearchTerm('');
+ setSearchColumn(value as 'hostname' | 'uuid' | 'version' | 'revision')
+ }} />
+ </div>
+ <DatanodesTable
+ loading={loading}
+ data={dataSource}
+ selectedColumns={selectedColumns}
+ selectedRows={selectedRows}
+ searchColumn={searchColumn}
+ searchTerm={debouncedSearch}
+ handleSelectionChange={handleSelectionChange}
+ decommissionUuids={decommissionUuids} />
+ </div>
+ </div>
+ <Modal
+ title=''
+ centered={true}
+ visible={modalOpen}
+ onOk={handleModalOk}
+ onCancel={handleModalCancel}
+ closable={false}
+ width={400} >
+ <div style={{
+ margin: '0px 0px 5px 0px',
+ fontSize: '16px',
+ fontWeight: 'bold'
+ }}>
+ <WarningFilled className='icon-warning' style={{paddingRight: '8px'}}/>
+ Stop Tracking Datanode
+ </div>
+ Are you sure, you want recon to stop tracking the selected <strong>{selectedRows.length}</strong> datanode(s)?
Review Comment:
Another issue I encountered is that when I removed all datanodes from the list (e.g., by shutting them down), the new UI crashes and displays an error. This behavior wasn’t present in the old UI, which handled this case by showing an empty list.
<img width="944" alt="image" src="https://github.com/user-attachments/assets/36d59162-b4a1-4cd5-97fe-6a8c68a843dc">
--
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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1752086409
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
+ setState({
+ ...state,
+ loading: true
+ });
+ try {
+ const { request, controller } = AxiosGetHelper(
+ `/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ const datanodesInfoResponse = await request;
+ setState({
+ ...state,
+ loading: false,
+ summaryData: datanodesInfoResponse?.data?.DatanodesDecommissionInfo[0] ?? {}
+ });
+ } catch (error) {
+ setState({
+ ...state,
+ loading: false,
+ summaryData: {}
+ });
+ showDataFetchError((error as AxiosError).toString());
+ }
+ }
+
+ useEffect(() => {
+ fetchDecommissionSummary(uuid);
+ return (() => {
+ cancelRequests([cancelSignal.current!]);
+ })
+ }, []);
+
+ let content = (
+ <Result
+ status='error'
+ title='Unable to fetch Decommission Summary data'
+ className='decommission-summary-result'/>
+ );
+
+ const { summaryData } = state;
+ if (summaryData?.datanodeDetails && summaryData?.metrics && summaryData?.containers) {
+ const {
+ datanodeDetails: { uuid, networkLocation, ipAddress, hostName },
+ containers: { UnderReplicated, UnClosed },
+ metrics: { decommissionStartTime, numOfUnclosedPipelines, numOfUnclosedContainers, numOfUnderReplicatedContainers }
+ } = summaryData as SummaryData;
+ content = (
+ <Descriptions size="small" bordered column={1} title={`Decommission Status: DECOMMISSIONING`}>
+ <Descriptions.Item label="Datanode"> <b>{uuid}</b></Descriptions.Item>
+ <Descriptions.Item label="Location">({networkLocation}/{ipAddress}/{hostName})</Descriptions.Item>
+ <Descriptions.Item label="Decommissioning Started at">{decommissionStartTime}</Descriptions.Item>
+ <Descriptions.Item label="No. of Unclosed Pipelines">{numOfUnclosedPipelines}</Descriptions.Item>
+ <Descriptions.Item label="No. of Unclosed Containers">{numOfUnclosedContainers}</Descriptions.Item>
+ <Descriptions.Item label="No. of Under-Replicated Containers">{numOfUnderReplicatedContainers}</Descriptions.Item>
+ <Descriptions.Item label="Under-Replicated">{UnderReplicated}</Descriptions.Item>
+ <Descriptions.Item label="Unclosed">{UnClosed}</Descriptions.Item>
+ </Descriptions>
+ );
+ }
+ // Need to check summarydata is not empty
Review Comment:
Sorry, this was a previous comment which is not applicable after cleanup, removed in 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-11157. Improve Datanodes page UI [ozone]
Posted by "devabhishekpal (via GitHub)" <gi...@apache.org>.
devabhishekpal commented on code in PR #7168:
URL: https://github.com/apache/ozone/pull/7168#discussion_r1752085188
##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/decommissioningSummary/decommissioningSummary.tsx:
##########
@@ -0,0 +1,114 @@
+/*
+ * 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 } from 'react';
+import { AxiosError } from 'axios';
+import { Descriptions, Popover, Result } from 'antd';
+import { Datanode, SummaryData } from '@/v2/types/datanode.types';
+import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
+import { showDataFetchError } from '@/utils/common';
+
+type DecommisioningSummaryProps = {
+ uuid: string;
+}
+
+type DecommisioningSummaryState = {
+ loading: boolean;
+ summaryData: SummaryData | Record<string, unknown>;
+};
+
+const DecommissionSummary: React.FC<DecommisioningSummaryProps> = ({
+ uuid = ''
+}) => {
+ const [state, setState] = React.useState<DecommisioningSummaryState>({
+ summaryData: {},
+ loading: false
+ });
+ const cancelSignal = React.useRef<AbortController>();
+
+ async function fetchDecommissionSummary(selectedUuid: string) {
+ setState({
+ ...state,
+ loading: true
+ });
+ try {
+ const { request, controller } = AxiosGetHelper(
+ `/api/v1/datanodes/decommission/info/datanode?uuid=${selectedUuid}`,
+ cancelSignal.current
+ );
+ cancelSignal.current = controller;
+ const datanodesInfoResponse = await request;
+ setState({
+ ...state,
+ loading: false,
+ summaryData: datanodesInfoResponse?.data?.DatanodesDecommissionInfo[0] ?? {}
+ });
+ } catch (error) {
+ setState({
+ ...state,
+ loading: false,
+ summaryData: {}
+ });
+ showDataFetchError((error as AxiosError).toString());
+ }
+ }
+
+ useEffect(() => {
+ fetchDecommissionSummary(uuid);
+ return (() => {
+ cancelRequests([cancelSignal.current!]);
+ })
+ }, []);
+
+ let content = (
+ <Result
+ status='error'
+ title='Unable to fetch Decommission Summary data'
+ className='decommission-summary-result'/>
+ );
+
+ const { summaryData } = state;
+ if (summaryData?.datanodeDetails && summaryData?.metrics && summaryData?.containers) {
+ const {
+ datanodeDetails: { uuid, networkLocation, ipAddress, hostName },
+ containers: { UnderReplicated, UnClosed },
+ metrics: { decommissionStartTime, numOfUnclosedPipelines, numOfUnclosedContainers, numOfUnderReplicatedContainers }
+ } = summaryData as SummaryData;
+ content = (
+ <Descriptions size="small" bordered column={1} title={`Decommission Status: DECOMMISSIONING`}>
Review Comment:
Addressed in the latest commit [d9d12df](https://github.com/apache/ozone/pull/7168/commits/d9d12dfe4ef4378753d36c1e58f1c6238b85fdbd)
--
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