UI: Fixed UI: Explore page showing Incorrect usage count #8937 (#8939)

This commit is contained in:
Shailesh Parmar 2022-11-22 18:21:49 +05:30 committed by GitHub
parent 3cef7ed4cc
commit 5fe741be9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -35,6 +35,7 @@ import {
getOwnerValue,
} from '../../../utils/CommonUtils';
import { serviceTypeLogo } from '../../../utils/ServiceUtils';
import { getUsagePercentile } from '../../../utils/TableUtils';
import { SearchedDataProps } from '../../searched-data/SearchedData.interface';
import '../table-data-card/TableDataCard.style.css';
import TableDataCardBody from '../table-data-card/TableDataCardBody';
@ -92,8 +93,10 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = ({
if ('usageSummary' in source) {
_otherDetails.push({
key: 'Usage',
value: source.usageSummary?.weeklyStats?.count,
value: getUsagePercentile(
source.usageSummary?.weeklyStats?.percentileRank || 0,
true
),
});
}

View File

@ -314,7 +314,8 @@
"clearAll": "Clear All",
"view-less": "View less",
"view-more": "View more",
"column-plural": "Columns"
"column-plural": "Columns",
"pctile-lowercase": "pctile"
},
"message": {
"service-email-required": "Service account Email is required",

View File

@ -12,6 +12,7 @@
*/
import classNames from 'classnames';
import i18n from 'i18next';
import { upperCase } from 'lodash';
import { EntityTags } from 'Models';
import React from 'react';
@ -73,8 +74,8 @@ export const getUsagePercentile = (pctRank: number, isLiteral = false) => {
const percentile = Math.round(pctRank * 10) / 10;
const ordinalPercentile = ordinalize(percentile);
const usagePercentile = `${
isLiteral ? 'Usage' : ''
} - ${ordinalPercentile} pctile`;
isLiteral ? i18n.t('label.usage') : ''
} - ${ordinalPercentile} ${i18n.t('label.pctile-lowercase')}`;
return usagePercentile;
};