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

View File

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

View File

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