From a52b62c2592c95df522a664f88db4cfd2f986678 Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Mon, 1 Jul 2024 15:53:26 +0530 Subject: [PATCH 01/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response --- .../src/views/diskUsage/diskUsage.tsx | 270 +++++++++--------- 1 file changed, 138 insertions(+), 132 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index df280fe9fe90..19184755401d 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -295,165 +295,167 @@ export class DiskUsage extends React.Component, IDUState> keys.push('Entity Type'); values.push(summaryResponse.type); - if (summaryResponse.countStats.type === 'KEY') { - const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; - const { request: metadataRequest, controller: metadataNewController } = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal); - cancelKeyMetadataSignal = metadataNewController; - metadataRequest.then(response => { - keys.push('File Size'); - values.push(byteToSize(response.data.size, 3)); - keys.push('File Size With Replication'); - values.push(byteToSize(response.data.sizeWithReplica, 3)); - console.log(values); - - this.setState({ - showPanel: true, - panelKeys: keys, - panelValues: values + if (summaryResponse.status !== 'INITIALIZING') { + if (summaryResponse.countStats.type === 'KEY') { + const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; + const { request: metadataRequest, controller: metadataNewController } = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal); + cancelKeyMetadataSignal = metadataNewController; + metadataRequest.then(response => { + keys.push('File Size'); + values.push(byteToSize(response.data.size, 3)); + keys.push('File Size With Replication'); + values.push(byteToSize(response.data.sizeWithReplica, 3)); + console.log(values); + + this.setState({ + showPanel: true, + panelKeys: keys, + panelValues: values + }); + }).catch(error => { + this.setState({ + isLoading: false, + showPanel: false + }); + showDataFetchError(error.toString()); }); - }).catch(error => { - this.setState({ - isLoading: false, - showPanel: false - }); - showDataFetchError(error.toString()); - }); - return; - } + return; + } - if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') { - showDataFetchError(`Invalid Path: ${path}`); - return; - } + if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') { + showDataFetchError(`Invalid Path: ${path}`); + return; + } - if (summaryResponse.countStats.numVolume !== -1) { - keys.push('Volumes'); - values.push(summaryResponse.countStats.numVolume); - } + if (summaryResponse.countStats.numVolume !== -1) { + keys.push('Volumes'); + values.push(summaryResponse.countStats.numVolume); + } - if (summaryResponse.countStats.numBucket !== -1) { - keys.push('Buckets'); - values.push(summaryResponse.countStats.numBucket); - } + if (summaryResponse.countStats.numBucket !== -1) { + keys.push('Buckets'); + values.push(summaryResponse.countStats.numBucket); + } - if (summaryResponse.countStats.numDir !== -1) { - keys.push('Total Directories'); - values.push(summaryResponse.countStats.numDir); - } + if (summaryResponse.countStats.numDir !== -1) { + keys.push('Total Directories'); + values.push(summaryResponse.countStats.numDir); + } - if (summaryResponse.countStats.numKey !== -1) { - keys.push('Total Keys'); - values.push(summaryResponse.countStats.numKey); - } + if (summaryResponse.countStats.numKey !== -1) { + keys.push('Total Keys'); + values.push(summaryResponse.countStats.numKey); + } - if (summaryResponse.objectInfo.bucketName && summaryResponse.objectInfo.bucketName !== -1) { - keys.push('Bucket Name'); - values.push(summaryResponse.objectInfo.bucketName); - } + if (summaryResponse.objectInfo.bucketName && summaryResponse.objectInfo.bucketName !== -1) { + keys.push('Bucket Name'); + values.push(summaryResponse.objectInfo.bucketName); + } - if (summaryResponse.objectInfo.bucketLayout && summaryResponse.objectInfo.bucketLayout !== -1) { - keys.push('Bucket Layout'); - values.push(summaryResponse.objectInfo.bucketLayout); - } + if (summaryResponse.objectInfo.bucketLayout && summaryResponse.objectInfo.bucketLayout !== -1) { + keys.push('Bucket Layout'); + values.push(summaryResponse.objectInfo.bucketLayout); + } - if (summaryResponse.objectInfo.creationTime && summaryResponse.objectInfo.creationTime !== -1) { - keys.push('Creation Time'); - values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS')); - } + if (summaryResponse.objectInfo.creationTime && summaryResponse.objectInfo.creationTime !== -1) { + keys.push('Creation Time'); + values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS')); + } - if (summaryResponse.objectInfo.dataSize && summaryResponse.objectInfo.dataSize !== -1) { - keys.push('Data Size'); - values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3)); - } + if (summaryResponse.objectInfo.dataSize && summaryResponse.objectInfo.dataSize !== -1) { + keys.push('Data Size'); + values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3)); + } - if (summaryResponse.objectInfo.encInfo && summaryResponse.objectInfo.encInfo !== -1) { - keys.push('ENC Info'); - values.push(summaryResponse.objectInfo.encInfo); - } + if (summaryResponse.objectInfo.encInfo && summaryResponse.objectInfo.encInfo !== -1) { + keys.push('ENC Info'); + values.push(summaryResponse.objectInfo.encInfo); + } - if (summaryResponse.objectInfo.fileName && summaryResponse.objectInfo.fileName !== -1) { - keys.push('File Name'); - values.push(summaryResponse.objectInfo.fileName); - } + if (summaryResponse.objectInfo.fileName && summaryResponse.objectInfo.fileName !== -1) { + keys.push('File Name'); + values.push(summaryResponse.objectInfo.fileName); + } - if (summaryResponse.objectInfo.keyName && summaryResponse.objectInfo.keyName !== -1) { - keys.push('Key Name'); - values.push(summaryResponse.objectInfo.keyName); - } + if (summaryResponse.objectInfo.keyName && summaryResponse.objectInfo.keyName !== -1) { + keys.push('Key Name'); + values.push(summaryResponse.objectInfo.keyName); + } - if (summaryResponse.objectInfo.modificationTime && summaryResponse.objectInfo.modificationTime !== -1) { - keys.push('Modification Time'); - values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS')); - } + if (summaryResponse.objectInfo.modificationTime && summaryResponse.objectInfo.modificationTime !== -1) { + keys.push('Modification Time'); + values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS')); + } - if (summaryResponse.objectInfo.name && summaryResponse.objectInfo.name !== -1) { - keys.push('Name'); - values.push(summaryResponse.objectInfo.name); - } + if (summaryResponse.objectInfo.name && summaryResponse.objectInfo.name !== -1) { + keys.push('Name'); + values.push(summaryResponse.objectInfo.name); + } - if (summaryResponse.objectInfo.owner && summaryResponse.objectInfo.owner !== -1) { - keys.push('Owner'); - values.push(summaryResponse.objectInfo.owner); - } + if (summaryResponse.objectInfo.owner && summaryResponse.objectInfo.owner !== -1) { + keys.push('Owner'); + values.push(summaryResponse.objectInfo.owner); + } - if (summaryResponse.objectInfo.quotaInBytes && summaryResponse.objectInfo.quotaInBytes !== -1) { - keys.push('Quota In Bytes'); - values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3)); - } + if (summaryResponse.objectInfo.quotaInBytes && summaryResponse.objectInfo.quotaInBytes !== -1) { + keys.push('Quota In Bytes'); + values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3)); + } - if (summaryResponse.objectInfo.quotaInNamespace && summaryResponse.objectInfo.quotaInNamespace !== -1) { - keys.push('Quota In Namespace'); - values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3)); - } + if (summaryResponse.objectInfo.quotaInNamespace && summaryResponse.objectInfo.quotaInNamespace !== -1) { + keys.push('Quota In Namespace'); + values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3)); + } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationFactor && summaryResponse.objectInfo.replicationConfig.replicationFactor !== -1) { - keys.push('Replication Factor'); - values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor); - } + if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationFactor && summaryResponse.objectInfo.replicationConfig.replicationFactor !== -1) { + keys.push('Replication Factor'); + values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor); + } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationType && summaryResponse.objectInfo.replicationConfig.replicationType !== -1) { - keys.push('Replication Type'); - values.push(summaryResponse.objectInfo.replicationConfig.replicationType); - } + if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationType && summaryResponse.objectInfo.replicationConfig.replicationType !== -1) { + keys.push('Replication Type'); + values.push(summaryResponse.objectInfo.replicationConfig.replicationType); + } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.requiredNodes && summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) { - keys.push('Replication Required Nodes'); - values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); - } - - if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) { - keys.push('Source Bucket'); - values.push(summaryResponse.objectInfo.sourceBucket); - } + if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.requiredNodes && summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) { + keys.push('Replication Required Nodes'); + values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); + } + + if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) { + keys.push('Source Bucket'); + values.push(summaryResponse.objectInfo.sourceBucket); + } - if (summaryResponse.objectInfo.sourceVolume && summaryResponse.objectInfo.sourceVolume !== -1) { - keys.push('Source Volume'); - values.push(summaryResponse.objectInfo.sourceVolume); - } + if (summaryResponse.objectInfo.sourceVolume && summaryResponse.objectInfo.sourceVolume !== -1) { + keys.push('Source Volume'); + values.push(summaryResponse.objectInfo.sourceVolume); + } - if (summaryResponse.objectInfo.storageType && summaryResponse.objectInfo.storageType !== -1) { - keys.push('Storage Type'); - values.push(summaryResponse.objectInfo.storageType); - } + if (summaryResponse.objectInfo.storageType && summaryResponse.objectInfo.storageType !== -1) { + keys.push('Storage Type'); + values.push(summaryResponse.objectInfo.storageType); + } - if (summaryResponse.objectInfo.usedBytes && summaryResponse.objectInfo.usedBytes !== -1) { - keys.push('Used Bytes'); - values.push(summaryResponse.objectInfo.usedBytes); - } + if (summaryResponse.objectInfo.usedBytes && summaryResponse.objectInfo.usedBytes !== -1) { + keys.push('Used Bytes'); + values.push(summaryResponse.objectInfo.usedBytes); + } - if (summaryResponse.objectInfo.usedNamespace && summaryResponse.objectInfo.usedNamespace !== -1) { - keys.push('Used NameSpaces'); - values.push(summaryResponse.objectInfo.usedNamespace); - } + if (summaryResponse.objectInfo.usedNamespace && summaryResponse.objectInfo.usedNamespace !== -1) { + keys.push('Used NameSpaces'); + values.push(summaryResponse.objectInfo.usedNamespace); + } - if (summaryResponse.objectInfo.volumeName && summaryResponse.objectInfo.volumeName !== -1) { - keys.push('Volume Name'); - values.push(summaryResponse.objectInfo.volumeName); - } + if (summaryResponse.objectInfo.volumeName && summaryResponse.objectInfo.volumeName !== -1) { + keys.push('Volume Name'); + values.push(summaryResponse.objectInfo.volumeName); + } - if (summaryResponse.objectInfo.volume && summaryResponse.objectInfo.volume !== -1) { - keys.push('Volume'); - values.push(summaryResponse.objectInfo.volume); + if (summaryResponse.objectInfo.volume && summaryResponse.objectInfo.volume !== -1) { + keys.push('Volume'); + values.push(summaryResponse.objectInfo.volume); + } } // Show the right drawer @@ -486,6 +488,10 @@ export class DiskUsage extends React.Component, IDUState> return; } + if (quotaResponse.status === 'INITIALIZING') { + return; + } + // Append quota information // In case the object's quota isn't set if (quotaResponse.allowed !== -1) { From 8b268709451b647d34280440097d220fff5ddada Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Tue, 9 Jul 2024 13:59:03 +0530 Subject: [PATCH 02/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for comment add --- .../recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 19184755401d..b6863311fe95 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -295,6 +295,7 @@ export class DiskUsage extends React.Component, IDUState> keys.push('Entity Type'); values.push(summaryResponse.type); + // If status is not INITIALIZING then adding Entities for metadata to avoid null failures on UI. if (summaryResponse.status !== 'INITIALIZING') { if (summaryResponse.countStats.type === 'KEY') { const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; @@ -488,6 +489,7 @@ export class DiskUsage extends React.Component, IDUState> return; } + // If Quota status is INITIALIZING then do not append entities to metadata to avoid null if (quotaResponse.status === 'INITIALIZING') { return; } From c93eb78b57f2451f8dda9c737efe8e05fcecc50e Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Thu, 11 Jul 2024 19:11:55 +0530 Subject: [PATCH 03/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response --- .../src/views/diskUsage/diskUsage.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 4f89a82043a4..58eb285451dd 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -437,15 +437,15 @@ export class DiskUsage extends React.Component, IDUState> values.push(summaryResponse.objectInfo.replicationConfig.replicationType); } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.requiredNodes && summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) { - keys.push('Replication Required Nodes'); - values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); - } + if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.requiredNodes && summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) { + keys.push('Replication Required Nodes'); + values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); + } - if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) { - keys.push('Source Bucket'); - values.push(summaryResponse.objectInfo.sourceBucket); - } + if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) { + keys.push('Source Bucket'); + values.push(summaryResponse.objectInfo.sourceBucket); + } if (summaryResponse.objectInfo.sourceVolume && summaryResponse.objectInfo.sourceVolume !== -1) { keys.push('Source Volume'); From 23ede0494cd9566ccc676fa3348b3343a6b52462 Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Thu, 11 Jul 2024 22:37:21 +0530 Subject: [PATCH 04/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response --- .../recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 58eb285451dd..549af68e11c9 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -314,7 +314,8 @@ export class DiskUsage extends React.Component, IDUState> keys.push('Entity Type'); values.push(summaryResponse.type); - // If status is not INITIALIZING then adding Entities for metadata to avoid null failures on UI. + // If status is INITIALIZING, we cannot add entities for metadata as it will cause null failures + // Hence we only add Entities if the status is not INITIALIZING if (summaryResponse.status !== 'INITIALIZING') { if (summaryResponse.countStats.type === 'KEY') { const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; From f05387d3ef2ae094427a4800c5b550b850461f8c Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Fri, 12 Jul 2024 16:41:48 +0530 Subject: [PATCH 05/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response --- .../recon/ozone-recon-web/api/routes.json | 2 +- .../ozone-recon-web/src/utils/common.tsx | 17 +++++++++++++++- .../src/views/diskUsage/diskUsage.tsx | 20 +++++++++---------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json index b2136d074b07..5fd2c34dd9e2 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json @@ -4,7 +4,7 @@ "/utilization/fileCount": "/fileSizeCounts", "/utilization/containerCount": "/containerCount", "/namespace/du?path=/&files=true&sortSubpaths=true": "/root", - "/namespace/du?path=/vol:id&files=true&sortSubpaths=true": "/volume", + "/namespace/du?path=/vol:id&files=true&sortSubPaths=true": "/volume", "/namespace/du?path=/vol:id/&files=true&sortSubPaths=true": "/volume", "/namespace/du?path=/dummyVolume&files=true&sortSubPaths=true": "/volume", "/namespace/du?path=/vol:id/bucket:id&files=true&sortSubPaths=true": "/bucket", diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx index d68db094fdca..6cb62e3acd28 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx @@ -33,11 +33,26 @@ const showErrorNotification = (title: string, description: string) => { notification.error(args); }; +const showInfoNotification = (title: string, description: string) => { + const args = { + message: title, + description, + duration: 15 + }; + notification.info(args); +}; + export const showDataFetchError = (error: string) => { - const title = 'Error while fetching data'; + let title = ''; + title = 'Error while fetching data'; if (error.includes('CanceledError')) { error = 'Previous request cancelled because context changed' } + if (error.includes('metadata')) { + title = 'Metadata Initialization:'; + showInfoNotification(title, error); + return; + } showErrorNotification(title, error); }; diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 549af68e11c9..9f37a8ff2b7b 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -37,7 +37,7 @@ import { import { DetailPanel } from '@/components/rightDrawer/rightDrawer'; import { EChart } from '@/components/eChart/eChart'; -import { byteToSize, showDataFetchError } from '@/utils/common'; +import { byteToSize, showDataFetchError, showDatInfoWarning } from '@/utils/common'; import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper'; import './diskUsage.less'; @@ -314,9 +314,15 @@ export class DiskUsage extends React.Component, IDUState> keys.push('Entity Type'); values.push(summaryResponse.type); - // If status is INITIALIZING, we cannot add entities for metadata as it will cause null failures - // Hence we only add Entities if the status is not INITIALIZING - if (summaryResponse.status !== 'INITIALIZING') { + // If status is INITIALIZING, we cannot add entities for metadata as it will cause null failures and showing Warning message + // Hence we only add Entities if the status is not INITIALIZING + if (summaryResponse.status === 'INITIALIZING') + { + showDataFetchError(`The metadata is currently initializing. Please wait a moment and try again later`); + return; + } + + if (summaryResponse.status !== 'INITIALIZING' && summaryResponse.status !== 'PATH_NOT_FOUND') { if (summaryResponse.countStats.type === 'KEY') { const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; const { request: metadataRequest, controller: metadataNewController } = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal); @@ -565,12 +571,6 @@ export class DiskUsage extends React.Component, IDUState> ) - console.log(plotData); - console.log(plotData.map((value) => { - return { - name: value.name - } - })) const eChartsOptions = { title: { text: `Disk Usage for ${returnPath} (Total Size: ${byteToSize(duResponse.size, 1)})`, From 2b1a5eeb2595fb990be2e57c367ce0db3f85366e Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Mon, 22 Jul 2024 18:53:47 +0530 Subject: [PATCH 06/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response Review Comment for Optional Chain --- .../ozone-recon-web/src/utils/common.tsx | 3 +- .../src/views/diskUsage/diskUsage.tsx | 46 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx index 6cb62e3acd28..ce8e4491627b 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx @@ -43,8 +43,7 @@ const showInfoNotification = (title: string, description: string) => { }; export const showDataFetchError = (error: string) => { - let title = ''; - title = 'Error while fetching data'; + let title = 'Error while fetching data'; if (error.includes('CanceledError')) { error = 'Previous request cancelled because context changed' } diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 9f37a8ff2b7b..2b0c6c7b9bb5 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -37,7 +37,7 @@ import { import { DetailPanel } from '@/components/rightDrawer/rightDrawer'; import { EChart } from '@/components/eChart/eChart'; -import { byteToSize, showDataFetchError, showDatInfoWarning } from '@/utils/common'; +import { byteToSize, showDataFetchError } from '@/utils/common'; import { AxiosGetHelper, cancelRequests } from '@/utils/axiosRequestHelper'; import './diskUsage.less'; @@ -374,112 +374,112 @@ export class DiskUsage extends React.Component, IDUState> values.push(summaryResponse.countStats.numKey); } - if (summaryResponse.objectInfo.bucketName && summaryResponse.objectInfo.bucketName !== -1) { + if (summaryResponse.objectInfo?.bucketName !== -1) { keys.push('Bucket Name'); values.push(summaryResponse.objectInfo.bucketName); } - if (summaryResponse.objectInfo.bucketLayout && summaryResponse.objectInfo.bucketLayout !== -1) { + if (summaryResponse.objectInfo?.bucketLayout !== -1) { keys.push('Bucket Layout'); values.push(summaryResponse.objectInfo.bucketLayout); } - if (summaryResponse.objectInfo.creationTime && summaryResponse.objectInfo.creationTime !== -1) { + if (summaryResponse.objectInfo?.creationTime !== -1) { keys.push('Creation Time'); values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS')); } - if (summaryResponse.objectInfo.dataSize && summaryResponse.objectInfo.dataSize !== -1) { + if (summaryResponse.objectInfo?.dataSize !== -1) { keys.push('Data Size'); values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3)); } - if (summaryResponse.objectInfo.encInfo && summaryResponse.objectInfo.encInfo !== -1) { + if (summaryResponse.objectInfo?.encInfo !== -1) { keys.push('ENC Info'); values.push(summaryResponse.objectInfo.encInfo); } - if (summaryResponse.objectInfo.fileName && summaryResponse.objectInfo.fileName !== -1) { + if (summaryResponse.objectInfo?.fileName !== -1) { keys.push('File Name'); values.push(summaryResponse.objectInfo.fileName); } - if (summaryResponse.objectInfo.keyName && summaryResponse.objectInfo.keyName !== -1) { + if (summaryResponse.objectInfo?.keyName !== -1) { keys.push('Key Name'); values.push(summaryResponse.objectInfo.keyName); } - if (summaryResponse.objectInfo.modificationTime && summaryResponse.objectInfo.modificationTime !== -1) { + if (summaryResponse.objectInfo?.modificationTime !== -1) { keys.push('Modification Time'); values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS')); } - if (summaryResponse.objectInfo.name && summaryResponse.objectInfo.name !== -1) { + if (summaryResponse.objectInfo?.name !== -1) { keys.push('Name'); values.push(summaryResponse.objectInfo.name); } - if (summaryResponse.objectInfo.owner && summaryResponse.objectInfo.owner !== -1) { + if (summaryResponse.objectInfo?.owner !== -1) { keys.push('Owner'); values.push(summaryResponse.objectInfo.owner); } - if (summaryResponse.objectInfo.quotaInBytes && summaryResponse.objectInfo.quotaInBytes !== -1) { + if (summaryResponse.objectInfo?.quotaInBytes !== -1) { keys.push('Quota In Bytes'); values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3)); } - if (summaryResponse.objectInfo.quotaInNamespace && summaryResponse.objectInfo.quotaInNamespace !== -1) { + if (summaryResponse.objectInfo?.quotaInNamespace !== -1) { keys.push('Quota In Namespace'); values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3)); } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationFactor && summaryResponse.objectInfo.replicationConfig.replicationFactor !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.replicationFactor !== -1) { keys.push('Replication Factor'); values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor); } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.replicationType && summaryResponse.objectInfo.replicationConfig.replicationType !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.replicationType !== -1) { keys.push('Replication Type'); values.push(summaryResponse.objectInfo.replicationConfig.replicationType); } - if (summaryResponse.objectInfo.replicationConfig && summaryResponse.objectInfo.replicationConfig.requiredNodes && summaryResponse.objectInfo.replicationConfig.requiredNodes !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.requiredNodes !== -1) { keys.push('Replication Required Nodes'); values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); } - if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) { + if (summaryResponse.objectInfo?.sourceBucket !== -1) { keys.push('Source Bucket'); values.push(summaryResponse.objectInfo.sourceBucket); } - if (summaryResponse.objectInfo.sourceVolume && summaryResponse.objectInfo.sourceVolume !== -1) { + if (summaryResponse.objectInfo?.sourceVolume !== -1) { keys.push('Source Volume'); values.push(summaryResponse.objectInfo.sourceVolume); } - if (summaryResponse.objectInfo.storageType && summaryResponse.objectInfo.storageType !== -1) { + if (summaryResponse.objectInfo?.storageType !== -1) { keys.push('Storage Type'); values.push(summaryResponse.objectInfo.storageType); } - if (summaryResponse.objectInfo.usedBytes && summaryResponse.objectInfo.usedBytes !== -1) { + if (summaryResponse.objectInfo?.usedBytes !== -1) { keys.push('Used Bytes'); values.push(summaryResponse.objectInfo.usedBytes); } - if (summaryResponse.objectInfo.usedNamespace && summaryResponse.objectInfo.usedNamespace !== -1) { + if (summaryResponse.objectInfo?.usedNamespace !== -1) { keys.push('Used NameSpaces'); values.push(summaryResponse.objectInfo.usedNamespace); } - if (summaryResponse.objectInfo.volumeName && summaryResponse.objectInfo.volumeName !== -1) { + if (summaryResponse.objectInfo?.volumeName !== -1) { keys.push('Volume Name'); values.push(summaryResponse.objectInfo.volumeName); } - if (summaryResponse.objectInfo.volume && summaryResponse.objectInfo.volume !== -1) { + if (summaryResponse.objectInfo?.volume !== -1) { keys.push('Volume'); values.push(summaryResponse.objectInfo.volume); } From 9f676e38d2be5834eb16fd82cde087c5e2a72ba1 Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Thu, 25 Jul 2024 12:06:34 +0530 Subject: [PATCH 07/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response --- .../webapps/recon/ozone-recon-web/api/routes.json | 8 ++++---- .../webapps/recon/ozone-recon-web/src/utils/common.tsx | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json index 5fd2c34dd9e2..cb5ba2da3300 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/api/routes.json @@ -15,10 +15,10 @@ "/namespace/du?path=/dummyVolume/dummyBucket/dir:id&files=true&sortSubPaths=true": "/dir", "/namespace/du?path=/dummyVolume/dummyBucket/dir:id/&files=true&sortSubPaths=true": "/dir", "/namespace/du?path=/dummyVolume/dummyBucket/dummyDir&files=true&sortSubPaths=true": "/dir", - "/namespace/du?path=/vol:id/bucket:id/dir:id/key:id*": "/key", - "/namespace/du?path=/dummyVolume/dummyBucket/dummyDir/key:id*": "/key", - "/namespace/du?path=/vol:id/bucket:id/key:id*": "/key", - "/namespace/du?path=/dummyVolume/dummyBucket/key:id*": "/key", + "/namespace/du?path=/vol:id/bucket:id/dir:id/key:id*&sortSubPaths=true": "/key", + "/namespace/du?path=/dummyVolume/dummyBucket/dummyDir/key:id*&sortSubPaths=true": "/key", + "/namespace/du?path=/vol:id/bucket:id/key:id*&sortSubPaths=true": "/key", + "/namespace/du?path=/dummyVolume/dummyBucket/key:id*&sortSubPaths=true": "/key", "/namespace/du?path=/vol1/bucket1/empty&files=true&sortSubPaths=true": "/empty", "/namespace/du?path=/clunky&files=true&sortSubpaths=true": "/clunky", "/namespace/summary?path=*": "/metadata", diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx index ce8e4491627b..6886fd189f6c 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/utils/common.tsx @@ -39,7 +39,7 @@ const showInfoNotification = (title: string, description: string) => { description, duration: 15 }; - notification.info(args); + notification.warn(args); }; export const showDataFetchError = (error: string) => { From a4d50e28b489be3e11e01db790222dc18b626ca2 Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Thu, 25 Jul 2024 22:11:42 +0530 Subject: [PATCH 08/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response space issue --- .../recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 1c69b86838d5..f3fe60164680 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -322,7 +322,7 @@ export class DiskUsage extends React.Component, IDUState> return; } - if (summaryResponse.status !== 'INITIALIZING' && summaryResponse.status !== 'PATH_NOT_FOUND') { + if (summaryResponse.status !== 'INITIALIZING' && summaryResponse.status !== 'PATH_NOT_FOUND') { if (summaryResponse.type === 'KEY') { const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`; const { request: metadataRequest, controller: metadataNewController } = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal); From f19dcc07aace36eaf587fc43023b667b45399f55 Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Thu, 25 Jul 2024 22:16:11 +0530 Subject: [PATCH 09/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response space issue --- .../recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index f3fe60164680..8d52d58bb6cf 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -316,8 +316,7 @@ export class DiskUsage extends React.Component, IDUState> // If status is INITIALIZING, we cannot add entities for metadata as it will cause null failures and showing Warning message // Hence we only add Entities if the status is not INITIALIZING - if (summaryResponse.status === 'INITIALIZING') - { + if (summaryResponse.status === 'INITIALIZING') { showDataFetchError(`The metadata is currently initializing. Please wait a moment and try again later`); return; } From 910c42f11d7bb78d2ba4b1548d030cd67561cc3c Mon Sep 17 00:00:00 2001 From: smitajoshi12 Date: Fri, 26 Jul 2024 15:55:53 +0530 Subject: [PATCH 10/10] HDDS-11023. Recon Disk Usage null conditions not handled properly for null response Undefined handled --- .../src/views/diskUsage/diskUsage.tsx | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx index 8d52d58bb6cf..3f1176525027 100644 --- a/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx +++ b/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx @@ -346,137 +346,137 @@ export class DiskUsage extends React.Component, IDUState> return; } - if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') { + if (summaryResponse.countStats?.status === 'PATH_NOT_FOUND') { showDataFetchError(`Invalid Path: ${path}`); return; } - if (summaryResponse.countStats.numVolume !== -1) { + if (summaryResponse.countStats?.numVolume !== undefined && summaryResponse.countStats?.numVolume !== -1) { keys.push('Volumes'); values.push(summaryResponse.countStats.numVolume); } - if (summaryResponse.countStats.numBucket !== -1) { + if (summaryResponse.countStats?.numBucket !== undefined && summaryResponse.countStats?.numBucket !== -1) { keys.push('Buckets'); values.push(summaryResponse.countStats.numBucket); } - if (summaryResponse.countStats.numDir !== -1) { + if (summaryResponse.countStats?.numDir !== undefined && summaryResponse.countStats?.numDir !== -1) { keys.push('Total Directories'); values.push(summaryResponse.countStats.numDir); } - if (summaryResponse.countStats.numKey !== -1) { + if (summaryResponse.countStats?.numKey !== undefined && summaryResponse.countStats?.numKey !== -1) { keys.push('Total Keys'); values.push(summaryResponse.countStats.numKey); } - if (summaryResponse.objectInfo?.bucketName !== -1) { + if (summaryResponse.objectInfo?.bucketName !== undefined && summaryResponse.objectInfo?.bucketName !== -1) { keys.push('Bucket Name'); values.push(summaryResponse.objectInfo.bucketName); } - if (summaryResponse.objectInfo?.bucketLayout !== -1) { + if (summaryResponse.objectInfo?.bucketLayout !== undefined && summaryResponse.objectInfo?.bucketLayout !== -1) { keys.push('Bucket Layout'); values.push(summaryResponse.objectInfo.bucketLayout); } - if (summaryResponse.objectInfo?.creationTime !== -1) { + if (summaryResponse.objectInfo?.creationTime !== undefined && summaryResponse.objectInfo?.creationTime !== -1) { keys.push('Creation Time'); values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS')); } - if (summaryResponse.objectInfo?.dataSize !== -1) { + if (summaryResponse.objectInfo?.dataSize !== undefined && summaryResponse.objectInfo?.dataSize !== -1) { keys.push('Data Size'); values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3)); } - if (summaryResponse.objectInfo?.encInfo !== -1) { + if (summaryResponse.objectInfo?.encInfo !== undefined && summaryResponse.objectInfo?.encInfo !== -1) { keys.push('ENC Info'); values.push(summaryResponse.objectInfo.encInfo); } - if (summaryResponse.objectInfo?.fileName !== -1) { + if (summaryResponse.objectInfo?.fileName !== undefined && summaryResponse.objectInfo?.fileName !== -1) { keys.push('File Name'); values.push(summaryResponse.objectInfo.fileName); } - if (summaryResponse.objectInfo?.keyName !== -1) { + if (summaryResponse.objectInfo?.keyName !== undefined && summaryResponse.objectInfo?.keyName !== -1) { keys.push('Key Name'); values.push(summaryResponse.objectInfo.keyName); } - if (summaryResponse.objectInfo?.modificationTime !== -1) { + if (summaryResponse.objectInfo?.modificationTime !== undefined && summaryResponse.objectInfo?.modificationTime !== -1) { keys.push('Modification Time'); values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS')); } - if (summaryResponse.objectInfo?.name !== -1) { + if (summaryResponse.objectInfo?.name !== undefined && summaryResponse.objectInfo?.name !== -1) { keys.push('Name'); values.push(summaryResponse.objectInfo.name); } - if (summaryResponse.objectInfo?.owner !== -1) { + if (summaryResponse.objectInfo?.owner !== undefined && summaryResponse.objectInfo?.owner !== -1) { keys.push('Owner'); values.push(summaryResponse.objectInfo.owner); } - if (summaryResponse.objectInfo?.quotaInBytes !== -1) { + if (summaryResponse.objectInfo?.quotaInBytes !== undefined && summaryResponse.objectInfo?.quotaInBytes !== -1) { keys.push('Quota In Bytes'); values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3)); } - if (summaryResponse.objectInfo?.quotaInNamespace !== -1) { + if (summaryResponse.objectInfo?.quotaInNamespace !== undefined && summaryResponse.objectInfo?.quotaInNamespace !== -1) { keys.push('Quota In Namespace'); values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3)); } - if (summaryResponse.objectInfo?.replicationConfig?.replicationFactor !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.replicationFactor !== undefined && summaryResponse.objectInfo?.replicationConfig?.replicationFactor !== -1) { keys.push('Replication Factor'); values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor); } - if (summaryResponse.objectInfo?.replicationConfig?.replicationType !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.replicationType !== undefined && summaryResponse.objectInfo?.replicationConfig?.replicationType !== -1) { keys.push('Replication Type'); values.push(summaryResponse.objectInfo.replicationConfig.replicationType); } - if (summaryResponse.objectInfo?.replicationConfig?.requiredNodes !== -1) { + if (summaryResponse.objectInfo?.replicationConfig?.requiredNodes !== undefined && summaryResponse.objectInfo?.replicationConfig?.requiredNodes !== -1) { keys.push('Replication Required Nodes'); values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes); } - if (summaryResponse.objectInfo?.sourceBucket !== -1) { + if (summaryResponse.objectInfo?.sourceBucket !== undefined && summaryResponse.objectInfo?.sourceBucket !== -1) { keys.push('Source Bucket'); values.push(summaryResponse.objectInfo.sourceBucket); } - if (summaryResponse.objectInfo?.sourceVolume !== -1) { + if (summaryResponse.objectInfo?.sourceVolume !== undefined && summaryResponse.objectInfo?.sourceVolume !== -1) { keys.push('Source Volume'); values.push(summaryResponse.objectInfo.sourceVolume); } - if (summaryResponse.objectInfo?.storageType !== -1) { + if (summaryResponse.objectInfo?.storageType !== undefined && summaryResponse.objectInfo?.storageType !== -1) { keys.push('Storage Type'); values.push(summaryResponse.objectInfo.storageType); } - if (summaryResponse.objectInfo?.usedBytes !== -1) { + if (summaryResponse.objectInfo?.usedBytes !== undefined && summaryResponse.objectInfo?.usedBytes !== -1) { keys.push('Used Bytes'); values.push(summaryResponse.objectInfo.usedBytes); } - if (summaryResponse.objectInfo?.usedNamespace !== -1) { + if (summaryResponse.objectInfo?.usedNamespace !== undefined && summaryResponse.objectInfo?.usedNamespace !== -1) { keys.push('Used NameSpaces'); values.push(summaryResponse.objectInfo.usedNamespace); } - if (summaryResponse.objectInfo?.volumeName !== -1) { + if (summaryResponse.objectInfo?.volumeName !== undefined && summaryResponse.objectInfo?.volumeName !== -1) { keys.push('Volume Name'); values.push(summaryResponse.objectInfo.volumeName); } - if (summaryResponse.objectInfo?.volume !== -1) { + if (summaryResponse.objectInfo?.volume !== undefined && summaryResponse.objectInfo?.volume !== -1) { keys.push('Volume'); values.push(summaryResponse.objectInfo.volume); } @@ -519,13 +519,15 @@ export class DiskUsage extends React.Component, IDUState> // Append quota information // In case the object's quota isn't set - if (quotaResponse.allowed !== -1) { + if (quotaResponse.allowed !== undefined && quotaResponse.allowed !== -1) { keys.push('Quota Allowed'); values.push(byteToSize(quotaResponse.allowed, 3)); } - keys.push('Quota Used'); - values.push(byteToSize(quotaResponse.used, 3)); + if (quotaResponse.used !== undefined && quotaResponse.used !== -1) { + keys.push('Quota Used'); + values.push(byteToSize(quotaResponse.used, 3)); + } this.setState({ showPanel: true, panelKeys: keys,