Skip to content

Commit

Permalink
Merge pull request #4123 from dlabrecq/virt-i18n
Browse files Browse the repository at this point in the history
Virtualization memory column is missing units
  • Loading branch information
dlabrecq authored Nov 19, 2024
2 parents fa19a2d + 27141b2 commit 0e9c82b
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 15 deletions.
28 changes: 28 additions & 0 deletions locales/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7938,6 +7938,14 @@
}
]
},
"vm_name": {
"value": [
{
"type": 0,
"value": "Filter by virtual machine"
}
]
},
"workload": {
"value": [
{
Expand Down Expand Up @@ -13530,6 +13538,18 @@
}
]
},
"gib": {
"value": [
{
"type": 1,
"value": "value"
},
{
"type": 0,
"value": " GiB"
}
]
},
"gib_hours": {
"value": [
{
Expand Down Expand Up @@ -13714,6 +13734,14 @@
}
]
},
"gib": {
"value": [
{
"type": 0,
"value": "GiB"
}
]
},
"gib_hours": {
"value": [
{
Expand Down
6 changes: 3 additions & 3 deletions locales/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
"filterByInputAriaLabel": "{value, select, account {Input for account name} aws_category {Input for cost category name} cluster {Input for cluster name} gcp_project {Input for GCP project name} name {Input for name} node {Input for node name} org_unit_id {Input for organizational unit name} payer_tenant_id {Input for account name} product_service {Input for service_name} project {Input for project name} region {Input for region name} resource_location {Input for region name} service {Input for service name} service_name {Input for service_name} subscription_guid {Input for account name} status {Input for status value} tag {Input for tag name} tag_key {Input for tag key} tag_key_child {Input for child tag key} tag_key_parent {Input for parent tag key} other {}}",
"filterByOrgUnitAriaLabel": "Organizational units",
"filterByOrgUnitPlaceholder": "Choose unit",
"filterByPlaceholder": "{value, select, account {Filter by account} aws_category {Filter by cost category} cluster {Filter by cluster} container {Filter by container} description {Filter by description} gcp_project {Filter by GCP project} group {Filter by group} instance {Filter by instance} name {Filter by name} node {Filter by node} operating_system {Filter by operating system} org_unit_id {Filter by organizational unit} payer_tenant_id {Filter by account} persistent_volume_claim {Filter by persistent volume claim} product_service {Filter by service} project {Filter by project} region {Filter by region} resource_location {Filter by region} service {Filter by service} service_name {Filter by service} source_type {Filter by integration} status {Filter by status} storage_class {Filter by StorageClass} subscription_guid {Filter by account} workload {Filter by workload name} workload_type {Filter by workload type} tag {Filter by tag} tag_key {Filter by tag key} tag_key_child {Filter by child tag key} tag_key_parent {Filter by parent tag key} other {}}",
"filterByPlaceholder": "{value, select, account {Filter by account} aws_category {Filter by cost category} cluster {Filter by cluster} container {Filter by container} description {Filter by description} gcp_project {Filter by GCP project} group {Filter by group} instance {Filter by instance} name {Filter by name} node {Filter by node} operating_system {Filter by operating system} org_unit_id {Filter by organizational unit} payer_tenant_id {Filter by account} persistent_volume_claim {Filter by persistent volume claim} product_service {Filter by service} project {Filter by project} region {Filter by region} resource_location {Filter by region} service {Filter by service} service_name {Filter by service} source_type {Filter by integration} status {Filter by status} storage_class {Filter by StorageClass} subscription_guid {Filter by account} workload {Filter by workload name} workload_type {Filter by workload type} tag {Filter by tag} tag_key {Filter by tag key} tag_key_child {Filter by child tag key} tag_key_parent {Filter by parent tag key} vm_name {Filter by virtual machine} other {}}",
"filterByTagKeyAriaLabel": "Tag keys",
"filterByTagValueAriaLabel": "Tag values",
"filterByValuePlaceholder": "Filter by value",
Expand Down Expand Up @@ -670,8 +670,8 @@
"toolBarPriceListMeasurementPlaceHolder": "Filter by measurements",
"toolBarPriceListMetricPlaceHolder": "Filter by metrics",
"typeaheadAriaClear": "Clear button and input",
"unitTooltips": "{units, select, byte_ms {{value} Byte-ms} cluster_month {cluster-month} core_hours {{value} core-hours} gb {{value} GB} gb_hours {{value} GB-hours} gb_month {{value} GB-month} gb_ms {{value} GB-ms} gib_hours {{value} GiB-hours} gib_month {{value} GiB-month} gibibyte_month {{value} GiB-month} hour {{value} hours} hrs {{value} hours} ms {{value} milliseconds} pvc_month {PVC-month} tag_month {{value} tag-month} vm_hours {{value} VM-hours} other {{value}}}",
"units": "{units, select, byte_ms {Byte-ms} cluster_month {cluster-month} core {core} core_hours {core-hours} gb {GB} gb_hours {GB-hours} gb_month {GB-month} gb_ms {GB-ms} gib_hours {GiB-hours} gib_month {GiB-month} gibibyte_month {GiB-month} hour {hours} hrs {hours} ms {milliseconds} pvc_month {PVC-month} tag_month {tag-month} vm_hours {VM-hours} other {}}",
"unitTooltips": "{units, select, byte_ms {{value} Byte-ms} cluster_month {cluster-month} core_hours {{value} core-hours} gb {{value} GB} gb_hours {{value} GB-hours} gb_month {{value} GB-month} gb_ms {{value} GB-ms} gib {{value} GiB} gib_hours {{value} GiB-hours} gib_month {{value} GiB-month} gibibyte_month {{value} GiB-month} hour {{value} hours} hrs {{value} hours} ms {{value} milliseconds} pvc_month {PVC-month} tag_month {{value} tag-month} vm_hours {{value} VM-hours} other {{value}}}",
"units": "{units, select, byte_ms {Byte-ms} cluster_month {cluster-month} core {core} core_hours {core-hours} gb {GB} gb_hours {GB-hours} gb_month {GB-month} gb_ms {GB-ms} gib {GiB} gib_hours {GiB-hours} gib_month {GiB-month} gibibyte_month {GiB-month} hour {hours} hrs {hours} ms {milliseconds} pvc_month {PVC-month} tag_month {tag-month} vm_hours {VM-hours} other {}}",
"updateAvailable": "Update available",
"usage": "Usage",
"usageCostDesc": "The portion of cost calculated by applying hourly and/or monthly price list rates to metrics.",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2124,6 +2124,7 @@ export default defineMessages({
'tag_key {Filter by tag key} ' +
'tag_key_child {Filter by child tag key} ' +
'tag_key_parent {Filter by parent tag key} ' +
'vm_name {Filter by virtual machine} ' +
'other {}}',
description: 'Filter by "value"',
id: 'filterByPlaceholder',
Expand Down Expand Up @@ -4044,6 +4045,7 @@ export default defineMessages({
'gb_hours {{value} GB-hours} ' +
'gb_month {{value} GB-month} ' +
'gb_ms {{value} GB-ms} ' +
'gib {{value} GiB} ' +
'gib_hours {{value} GiB-hours} ' +
'gib_month {{value} GiB-month} ' +
'gibibyte_month {{value} GiB-month} ' +
Expand All @@ -4068,6 +4070,7 @@ export default defineMessages({
'gb_hours {GB-hours} ' +
'gb_month {GB-month} ' +
'gb_ms {GB-ms} ' +
'gib {GiB} ' +
'gib_hours {GiB-hours} ' +
'gib_month {GiB-month} ' +
'gibibyte_month {GiB-month} ' +
Expand Down
12 changes: 10 additions & 2 deletions src/routes/components/dataTable/dataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ interface DataTableOwnProps {
ariaLabel?: string;
columns?: any[];
emptyState?: React.ReactNode;
filterBy: any;
exclude?: any;
filterBy?: any;
isActionsCell?: boolean;
isLoading?: boolean;
isSelectable?: boolean;
Expand All @@ -42,7 +43,7 @@ type DataTableProps = DataTableOwnProps & RouterComponentProps & WrappedComponen

class DataTable extends React.Component<DataTableProps, any> {
private getEmptyState = () => {
const { emptyState, filterBy, intl } = this.props;
const { emptyState, exclude, filterBy, intl } = this.props;

if (filterBy) {
for (const val of Object.values(filterBy)) {
Expand All @@ -51,6 +52,13 @@ class DataTable extends React.Component<DataTableProps, any> {
}
}
}
if (exclude) {
for (const val of Object.values(exclude)) {
if (val !== '*') {
return <EmptyFilterState filter={val as string} showMargin={false} />;
}
}
}
return emptyState ? (
emptyState
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('formats value', () => {
expect(screen.getByText(/label/i)).not.toBeNull();
expect(
screen.getByText(
'{value} {units} ({percent} %){"percent":"10","units":"{units, select, byte_ms {Byte-ms} cluster_month {cluster-month} core {core} core_hours {core-hours} gb {GB} gb_hours {GB-hours} gb_month {GB-month} gb_ms {GB-ms} gib_hours {GiB-hours} gib_month {GiB-month} gibibyte_month {GiB-month} hour {hours} hrs {hours} ms {milliseconds} pvc_month {PVC-month} tag_month {tag-month} vm_hours {VM-hours} other {}}{}","value":100}'
'{value} {units} ({percent} %){"percent":"10","units":"{units, select, byte_ms {Byte-ms} cluster_month {cluster-month} core {core} core_hours {core-hours} gb {GB} gb_hours {GB-hours} gb_month {GB-month} gb_ms {GB-ms} gib {GiB} gib_hours {GiB-hours} gib_month {GiB-month} gibibyte_month {GiB-month} hour {hours} hrs {hours} ms {milliseconds} pvc_month {PVC-month} tag_month {tag-month} vm_hours {VM-hours} other {}}{}","value":100}'
)
).not.toBeNull();
expect(screen.getByRole('progressbar').getAttribute('aria-valuenow')).toBe('10');
Expand Down
3 changes: 2 additions & 1 deletion src/routes/details/awsBreakdown/instances/instances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const Instances: React.FC<InstancesProps> = ({ costType, currency }) => {
const getTable = () => {
return (
<InstancesTable
exclude={query.exclude}
filterBy={query.filter_by}
hiddenColumns={hiddenColumns}
isAllSelected={isAllSelected}
Expand Down Expand Up @@ -318,7 +319,7 @@ const Instances: React.FC<InstancesProps> = ({ costType, currency }) => {
if (reportError) {
return <NotAvailable />;
}
if (!query.filter_by && !hasInstances && reportFetchStatus === FetchStatus.complete) {
if (!query.filter_by && !query.exclude && !hasInstances && reportFetchStatus === FetchStatus.complete) {
return <NoInstances />;
}

Expand Down
3 changes: 3 additions & 0 deletions src/routes/details/awsBreakdown/instances/instancesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getUnsortedComputedReportItems } from 'routes/utils/computedReport/getC
import { formatCurrency, formatUnits, unitsLookupKey } from 'utils/format';

interface InstancesTableOwnProps {
exclude?: any;
filterBy?: any;
hiddenColumns?: Set<string>;
isAllSelected?: boolean;
Expand All @@ -40,6 +41,7 @@ export const InstanceTableColumnIds = {
};

const InstancesTable: React.FC<InstancesTableProps> = ({
exclude,
filterBy,
hiddenColumns,
isAllSelected,
Expand Down Expand Up @@ -228,6 +230,7 @@ const InstancesTable: React.FC<InstancesTableProps> = ({
<DataTable
columns={columns}
emptyState={<NoInstancesState />}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/awsDetails/awsDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class AwsDetails extends React.Component<AwsDetailsProps, AwsDetailsState> {
<DetailsTable
basePath={formatPath(routes.awsBreakdown.path)}
breadcrumbPath={formatPath(`${routes.awsDetails.path}${location.search}`)}
exclude={query.exclude}
filterBy={query.filter_by}
groupBy={
groupByCostCategory
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/awsDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { withRouter } from 'utils/router';

interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentProps {
breadcrumbPath?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByCostCategory?: string;
Expand Down Expand Up @@ -313,12 +314,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/azureDetails/azureDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class AzureDetails extends React.Component<AzureDetailsProps, AzureDetailsState>
<DetailsTable
basePath={formatPath(routes.azureBreakdown.path)}
breadcrumbPath={formatPath(`${routes.azureDetails.path}${location.search}`)}
exclude={query.exclude}
filterBy={query.filter_by}
groupBy={groupByTagKey ? `${tagPrefix}${groupByTagKey}` : groupById}
groupByTagKey={groupByTagKey}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/azureDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { withRouter } from 'utils/router';

interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentProps {
breadcrumbPath?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByTagKey?: string;
Expand Down Expand Up @@ -285,12 +286,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/gcpDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { withRouter } from 'utils/router';

interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentProps {
breadcrumbPath?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByTagKey?: string;
Expand Down Expand Up @@ -283,12 +284,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/gcpDetails/gcpDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ class GcpDetails extends React.Component<GcpDetailsProps, GcpDetailsState> {
<DetailsTable
basePath={formatPath(routes.gcpBreakdown.path)}
breadcrumbPath={formatPath(`${routes.gcpDetails.path}${location.search}`)}
exclude={query.exclude}
filterBy={query.filter_by}
groupBy={groupByTagKey ? `${tagPrefix}${groupByTagKey}` : groupById}
groupByTagKey={groupByTagKey}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/ibmDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { withRouter } from 'utils/router';

interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentProps {
breadcrumbPath?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByTagKey?: string;
Expand Down Expand Up @@ -283,12 +284,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/ibmDetails/ibmDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class IbmDetails extends React.Component<IbmDetailsProps, IbmDetailsState> {
<DetailsTable
basePath={formatPath(routes.ibmBreakdown.path)}
breadcrumbPath={formatPath(`${routes.ibmDetails.path}${location.search}`)}
exclude={query.exclude}
filterBy={query.filter_by}
groupBy={groupByTagKey ? `${tagPrefix}${groupByTagKey}` : groupById}
groupByTagKey={groupByTagKey}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/ociDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { withRouter } from 'utils/router';

interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentProps {
breadcrumbPath?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByTagKey?: string;
Expand Down Expand Up @@ -283,12 +284,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
1 change: 1 addition & 0 deletions src/routes/details/ociDetails/ociDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class OciDetails extends React.Component<OciDetailsProps, OciDetailsState> {
<DetailsTable
basePath={formatPath(routes.ociBreakdown.path)}
breadcrumbPath={formatPath(`${routes.ociDetails.path}${location.search}`)}
exclude={query.exclude}
filterBy={query.filter_by}
groupBy={groupByTagKey ? `${tagPrefix}${groupByTagKey}` : groupById}
groupByTagKey={groupByTagKey}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const Virtualization: React.FC<VirtualizationProps> = ({ costType, currency }) =
const getTable = () => {
return (
<VirtualizationTable
exclude={query.exclude}
filterBy={query.filter_by}
hideCluster={hasClusterFilter}
hideNode={hasNodeFilter}
Expand Down Expand Up @@ -326,7 +327,7 @@ const Virtualization: React.FC<VirtualizationProps> = ({ costType, currency }) =
if (reportError) {
return <NotAvailable />;
}
if (!query.filter_by && !hasVirtualization && reportFetchStatus === FetchStatus.complete) {
if (!query.filter_by && !query.exclude && !hasVirtualization && reportFetchStatus === FetchStatus.complete) {
return <NoVirtualization />;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getUnsortedComputedReportItems } from 'routes/utils/computedReport/getC
import { formatCurrency, formatUnits, unitsLookupKey } from 'utils/format';

interface VirtualizationTableOwnProps {
exclude?: any;
filterBy?: any;
hideCluster?: boolean;
hideNode?: boolean;
Expand All @@ -42,6 +43,7 @@ export const VirtualizationTableColumnIds = {
};

const VirtualizationTable: React.FC<VirtualizationTableProps> = ({
exclude,
filterBy,
hideCluster,
hideNode,
Expand Down Expand Up @@ -228,6 +230,7 @@ const VirtualizationTable: React.FC<VirtualizationTableProps> = ({
<DataTable
columns={columns}
emptyState={<NoVirtualizationState />}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
4 changes: 3 additions & 1 deletion src/routes/details/ocpDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ interface DetailsTableOwnProps extends RouterComponentProps, WrappedComponentPro
basePath?: string;
breadcrumbPath?: string;
costDistribution?: string;
exclude?: any;
filterBy?: any;
groupBy: string;
groupByTagKey: string;
Expand Down Expand Up @@ -496,12 +497,13 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
};

public render() {
const { filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { exclude, filterBy, isLoading, onSelect, onSort, orderBy, selectedItems } = this.props;
const { columns, rows } = this.state;

return (
<DataTable
columns={columns}
exclude={exclude}
filterBy={filterBy}
isActionsCell
isLoading={isLoading}
Expand Down
Loading

0 comments on commit 0e9c82b

Please sign in to comment.