Skip to content

Commit 3537795

Browse files
HDDS-13528. Handle null paths when the NSSummary is initializing
1 parent a5cb560 commit 3537795

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const showErrorNotification = (title: string, description: string) => {
3434
notification.error(args);
3535
};
3636

37-
const showInfoNotification = (title: string, description: string) => {
37+
export const showInfoNotification = (title: string, description: string) => {
3838
const args = {
3939
message: title,
4040
description,

hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/navBar/navBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ const NavBar: React.FC<NavBarProps> = ({
132132
</Menu.Item>
133133
</Menu.SubMenu>
134134
), (
135-
<Menu.Item key='/DiskUsage'
135+
<Menu.Item key='/NamespaceUsage'
136136
icon={<PieChartOutlined />}>
137137
<span>Namespace Usage</span>
138-
<Link to='/DiskUsage' />
138+
<Link to='/NamespaceUsage' />
139139
</Menu.Item>
140140
), (
141141
isHeatmapEnabled &&

hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/components/plots/duPieChart.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { DUSubpath } from '@/v2/types/diskUsage.types';
2424

2525
//-------Types--------//
2626
type PieChartProps = {
27-
path: string;
27+
path: string | null;
2828
limit: number;
2929
size: number;
3030
subPaths: DUSubpath[];
@@ -48,7 +48,6 @@ const DUPieChart: React.FC<PieChartProps> = ({
4848
sizeWithReplica,
4949
loading
5050
}) => {
51-
5251
const [subpathSize, setSubpathSize] = React.useState<number>(0);
5352

5453
function getSubpathSize(subpaths: DUSubpath[]): number {
@@ -96,7 +95,7 @@ const DUPieChart: React.FC<PieChartProps> = ({
9695

9796
if (subPathCount === 0 || subpaths.length === 0) {
9897
// No more subpaths available
99-
pathLabels = [path.split('/').pop() ?? ''];
98+
pathLabels = [(path ?? '/').split('/').pop() ?? ''];
10099
valuesWithMinBlockSize = [0.1];
101100
percentage = ['100.00'];
102101
sizeStr = [byteToSize(size, 1)];

hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/diskUsage/diskUsage.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
* limitations under the License.
1717
*/
1818

19-
import React, {useRef, useState} from 'react';
20-
import {AxiosError} from 'axios';
21-
import {Alert, Button, Tooltip} from 'antd';
22-
import {InfoCircleFilled, ReloadOutlined,} from '@ant-design/icons';
23-
import {ValueType} from 'react-select';
19+
import React, { useRef, useState } from 'react';
20+
import { AxiosError } from 'axios';
21+
import { Alert, Button, Tooltip } from 'antd';
22+
import { InfoCircleFilled, ReloadOutlined, } from '@ant-design/icons';
23+
import { ValueType } from 'react-select';
2424

2525
import DUMetadata from '@/v2/components/duMetadata/duMetadata';
2626
import DUPieChart from '@/v2/components/plots/duPieChart';
27-
import SingleSelect, {Option} from '@/v2/components/select/singleSelect';
27+
import SingleSelect, { Option } from '@/v2/components/select/singleSelect';
2828
import DUBreadcrumbNav from '@/v2/components/duBreadcrumbNav/duBreadcrumbNav';
29-
import {showDataFetchError} from '@/utils/common';
30-
import {AxiosGetHelper, cancelRequests} from '@/utils/axiosRequestHelper';
29+
import { showDataFetchError, showInfoNotification } from '@/utils/common';
30+
import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper';
3131

32-
import {DUResponse} from '@/v2/types/diskUsage.types';
32+
import { DUResponse } from '@/v2/types/diskUsage.types';
3333

3434
import './diskUsage.less';
3535

@@ -57,6 +57,7 @@ const DiskUsage: React.FC<{}> = () => {
5757
const cancelPieSignal = useRef<AbortController>();
5858

5959
function loadData(path: string) {
60+
console.log("Loading data at: ", path);
6061
setLoading(true);
6162
const { request, controller } = AxiosGetHelper(
6263
`/api/v1/namespace/usage?path=${path}&files=true&sortSubPaths=true`,
@@ -66,13 +67,19 @@ const DiskUsage: React.FC<{}> = () => {
6667

6768
request.then(response => {
6869
const duResponse: DUResponse = response.data;
70+
console.log(duResponse);
6971
const status = duResponse.status;
7072
if (status === 'PATH_NOT_FOUND') {
7173
setLoading(false);
7274
showDataFetchError(`Invalid Path: ${path}`);
7375
return;
7476
}
7577

78+
if (status === 'INITIALIZING') {
79+
showInfoNotification("Information being initialized", "Namespace Summary is being initialized, please wait.")
80+
return;
81+
}
82+
7683
setDUResponse(duResponse);
7784
setLoading(false);
7885
}).catch(error => {
@@ -115,7 +122,7 @@ const DiskUsage: React.FC<{}> = () => {
115122
justifyContent: 'space-between',
116123
}}>
117124
<DUBreadcrumbNav
118-
path={duResponse.path}
125+
path={duResponse.path ?? '/'}
119126
subPaths={duResponse.subPaths}
120127
updateHandler={loadData} />
121128
<Tooltip
@@ -137,7 +144,7 @@ const DiskUsage: React.FC<{}> = () => {
137144
<DUPieChart
138145
loading={loading}
139146
limit={Number.parseInt(limit.value)}
140-
path={duResponse.path}
147+
path={duResponse.path ?? '/'}
141148
subPathCount={duResponse.subPathCount}
142149
subPaths={duResponse.subPaths}
143150
sizeWithReplica={duResponse.sizeWithReplica}

hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/routes-v2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const routesV2 = [
5151
component: Pipelines
5252
},
5353
{
54-
path: '/DiskUsage',
54+
path: '/NamespaceUsage',
5555
component: DiskUsage
5656
},
5757
{

0 commit comments

Comments
 (0)