Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"/utilization/fileCount": "/fileSizeCounts",
"/utilization/containerCount": "/containerCount",
"/namespace/du?path=/&files=true&sortSubpaths=true": "/root",
Comment thread
smitajoshi12 marked this conversation as resolved.
"/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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,25 @@ 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 = '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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,165 +314,175 @@ export class DiskUsage extends React.Component<Record<string, object>, 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
});
}).catch(error => {
this.setState({
isLoading: false,
showPanel: false
});
showDataFetchError(error.toString());
});
// 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`);
Comment thread
smitajoshi12 marked this conversation as resolved.
return;
}

if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') {
showDataFetchError(`Invalid Path: ${path}`);
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`;
Comment thread
smitajoshi12 marked this conversation as resolved.
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());
});
return;
}

if (summaryResponse.countStats.numVolume !== -1) {
keys.push('Volumes');
values.push(summaryResponse.countStats.numVolume);
}
if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') {
showDataFetchError(`Invalid Path: ${path}`);
return;
}

if (summaryResponse.countStats.numBucket !== -1) {
keys.push('Buckets');
values.push(summaryResponse.countStats.numBucket);
}
if (summaryResponse.countStats.numVolume !== -1) {
keys.push('Volumes');
values.push(summaryResponse.countStats.numVolume);
}

if (summaryResponse.countStats.numDir !== -1) {
keys.push('Total Directories');
values.push(summaryResponse.countStats.numDir);
}
if (summaryResponse.countStats.numBucket !== -1) {
keys.push('Buckets');
values.push(summaryResponse.countStats.numBucket);
}

if (summaryResponse.countStats.numKey !== -1) {
keys.push('Total Keys');
values.push(summaryResponse.countStats.numKey);
}
if (summaryResponse.countStats.numDir !== -1) {
keys.push('Total Directories');
values.push(summaryResponse.countStats.numDir);
}

if (summaryResponse.objectInfo.bucketName && summaryResponse.objectInfo.bucketName !== -1) {
keys.push('Bucket Name');
values.push(summaryResponse.objectInfo.bucketName);
}
if (summaryResponse.countStats.numKey !== -1) {
keys.push('Total Keys');
values.push(summaryResponse.countStats.numKey);
}

if (summaryResponse.objectInfo.bucketLayout && summaryResponse.objectInfo.bucketLayout !== -1) {
keys.push('Bucket Layout');
values.push(summaryResponse.objectInfo.bucketLayout);
}
if (summaryResponse.objectInfo?.bucketName !== -1) {
keys.push('Bucket Name');
values.push(summaryResponse.objectInfo.bucketName);
}

if (summaryResponse.objectInfo.creationTime && summaryResponse.objectInfo.creationTime !== -1) {
keys.push('Creation Time');
values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS'));
}
if (summaryResponse.objectInfo?.bucketLayout !== -1) {
keys.push('Bucket Layout');
values.push(summaryResponse.objectInfo.bucketLayout);
}

if (summaryResponse.objectInfo.dataSize && summaryResponse.objectInfo.dataSize !== -1) {
keys.push('Data Size');
values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
}
if (summaryResponse.objectInfo?.creationTime !== -1) {
keys.push('Creation Time');
values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS'));
}

if (summaryResponse.objectInfo.encInfo && summaryResponse.objectInfo.encInfo !== -1) {
keys.push('ENC Info');
values.push(summaryResponse.objectInfo.encInfo);
}
if (summaryResponse.objectInfo?.dataSize !== -1) {
keys.push('Data Size');
values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
}

if (summaryResponse.objectInfo.fileName && summaryResponse.objectInfo.fileName !== -1) {
keys.push('File Name');
values.push(summaryResponse.objectInfo.fileName);
}
if (summaryResponse.objectInfo?.encInfo !== -1) {
keys.push('ENC Info');
values.push(summaryResponse.objectInfo.encInfo);
}

if (summaryResponse.objectInfo.keyName && summaryResponse.objectInfo.keyName !== -1) {
keys.push('Key Name');
values.push(summaryResponse.objectInfo.keyName);
}
if (summaryResponse.objectInfo?.fileName !== -1) {
keys.push('File Name');
values.push(summaryResponse.objectInfo.fileName);
}

if (summaryResponse.objectInfo.modificationTime && summaryResponse.objectInfo.modificationTime !== -1) {
keys.push('Modification Time');
values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS'));
}
if (summaryResponse.objectInfo?.keyName !== -1) {
keys.push('Key Name');
values.push(summaryResponse.objectInfo.keyName);
}

if (summaryResponse.objectInfo.name && summaryResponse.objectInfo.name !== -1) {
keys.push('Name');
values.push(summaryResponse.objectInfo.name);
}
if (summaryResponse.objectInfo?.modificationTime !== -1) {
keys.push('Modification Time');
values.push(moment(summaryResponse.objectInfo.modificationTime).format('ll LTS'));
}

if (summaryResponse.objectInfo.owner && summaryResponse.objectInfo.owner !== -1) {
keys.push('Owner');
values.push(summaryResponse.objectInfo.owner);
}
if (summaryResponse.objectInfo?.name !== -1) {
keys.push('Name');
values.push(summaryResponse.objectInfo.name);
}

if (summaryResponse.objectInfo.quotaInBytes && summaryResponse.objectInfo.quotaInBytes !== -1) {
keys.push('Quota In Bytes');
values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 3));
}
if (summaryResponse.objectInfo?.owner !== -1) {
keys.push('Owner');
values.push(summaryResponse.objectInfo.owner);
}

if (summaryResponse.objectInfo.quotaInNamespace && summaryResponse.objectInfo.quotaInNamespace !== -1) {
keys.push('Quota In Namespace');
values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3));
}
if (summaryResponse.objectInfo?.quotaInBytes !== -1) {
keys.push('Quota In Bytes');
values.push(byteToSize(summaryResponse.objectInfo.quotaInBytes, 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?.quotaInNamespace !== -1) {
keys.push('Quota In Namespace');
values.push(byteToSize(summaryResponse.objectInfo.quotaInNamespace, 3));
}

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?.replicationFactor !== -1) {
keys.push('Replication Factor');
values.push(summaryResponse.objectInfo.replicationConfig.replicationFactor);
}

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?.replicationType !== -1) {
keys.push('Replication Type');
values.push(summaryResponse.objectInfo.replicationConfig.replicationType);
}

if (summaryResponse.objectInfo.sourceBucket && summaryResponse.objectInfo.sourceBucket !== -1) {
keys.push('Source Bucket');
values.push(summaryResponse.objectInfo.sourceBucket);
}
if (summaryResponse.objectInfo?.replicationConfig?.requiredNodes !== -1) {
keys.push('Replication Required Nodes');
values.push(summaryResponse.objectInfo.replicationConfig.requiredNodes);
}

if (summaryResponse.objectInfo.sourceVolume && summaryResponse.objectInfo.sourceVolume !== -1) {
keys.push('Source Volume');
values.push(summaryResponse.objectInfo.sourceVolume);
}
if (summaryResponse.objectInfo?.sourceBucket !== -1) {
keys.push('Source Bucket');
values.push(summaryResponse.objectInfo.sourceBucket);
}

if (summaryResponse.objectInfo.storageType && summaryResponse.objectInfo.storageType !== -1) {
keys.push('Storage Type');
values.push(summaryResponse.objectInfo.storageType);
}
if (summaryResponse.objectInfo?.sourceVolume !== -1) {
keys.push('Source Volume');
values.push(summaryResponse.objectInfo.sourceVolume);
}

if (summaryResponse.objectInfo.usedBytes && summaryResponse.objectInfo.usedBytes !== -1) {
keys.push('Used Bytes');
values.push(summaryResponse.objectInfo.usedBytes);
}
if (summaryResponse.objectInfo?.storageType !== -1) {
keys.push('Storage Type');
values.push(summaryResponse.objectInfo.storageType);
}

if (summaryResponse.objectInfo.usedNamespace && summaryResponse.objectInfo.usedNamespace !== -1) {
keys.push('Used NameSpaces');
values.push(summaryResponse.objectInfo.usedNamespace);
}
if (summaryResponse.objectInfo?.usedBytes !== -1) {
keys.push('Used Bytes');
values.push(summaryResponse.objectInfo.usedBytes);
}

if (summaryResponse.objectInfo.volumeName && summaryResponse.objectInfo.volumeName !== -1) {
keys.push('Volume Name');
values.push(summaryResponse.objectInfo.volumeName);
}
if (summaryResponse.objectInfo?.usedNamespace !== -1) {
keys.push('Used NameSpaces');
values.push(summaryResponse.objectInfo.usedNamespace);
}

if (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 !== -1) {
keys.push('Volume');
values.push(summaryResponse.objectInfo.volume);
}
}

// Show the right drawer
Expand Down Expand Up @@ -505,6 +515,11 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
return;
}

// If Quota status is INITIALIZING then do not append entities to metadata to avoid null
if (quotaResponse.status === 'INITIALIZING') {
return;
}

// Append quota information
// In case the object's quota isn't set
if (quotaResponse.allowed !== -1) {
Expand Down Expand Up @@ -556,12 +571,6 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
</Menu>
)

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)})`,
Expand Down