diff --git a/config/cspell.config.json b/config/cspell.config.json index fc66333db..bff1e367e 100644 --- a/config/cspell.config.json +++ b/config/cspell.config.json @@ -44,6 +44,7 @@ "optin", "ouia", "patternfly", + "payg", "pendo", "perpage", "qe's", diff --git a/public/locales/en-US.json b/public/locales/en-US.json index f3ce31f4f..d140de26b 100644 --- a/public/locales/en-US.json +++ b/public/locales/en-US.json @@ -325,6 +325,7 @@ "label_groupVariant_RHEL for IBM Power": "RHEL for IBM Power", "label_groupVariant_RHEL for IBM z": "RHEL for IBM z", "label_groupVariant_RHEL for x86": "RHEL for x86", + "label_groupVariant_rhel-for-x86-els-payg": "RHEL for x86 ELS On-Demand", "label_groupVariant_rhel-for-x86-eus": "RHEL for x86 EUS", "label_groupVariant_rhel-for-x86-ha": "RHEL for x86 HA", "label_groupVariant_rhel-for-sap-x86": "RHEL for SAP x86", @@ -416,8 +417,8 @@ "subtitle_rhel": "$t(curiosity-view.subtitle_RHEL)", "description_rhel": "$t(curiosity-view.description_RHEL)", "title_RHEL": "Red Hat Enterprise Linux", - "subtitle_RHEL": "Monitor your Red Hat Enterprise Linux usage by physical, virtual, and public cloud sockets. <0>Learn more about {{appName}} reporting", - "description_RHEL": "Monitor your Red Hat Enterprise Linux usage by physical, virtual, and public cloud sockets.", + "subtitle_RHEL": "Monitor your Red Hat Enterprise Linux usage for both Annual and On-Demand subscriptions. <0>Learn more about {{appName}} reporting", + "description_RHEL": "Monitor your Red Hat Enterprise Linux usage for both Annual and On-Demand subscriptions.", "title_RHEL for ARM": "$t(curiosity-view.title_RHEL)", "subtitle_RHEL for ARM": "$t(curiosity-view.subtitle_RHEL)", "description_RHEL for ARM": "$t(curiosity-view.description_RHEL)", @@ -430,6 +431,9 @@ "title_RHEL for x86": "$t(curiosity-view.title_RHEL)", "subtitle_RHEL for x86": "$t(curiosity-view.subtitle_RHEL)", "description_RHEL for x86": "$t(curiosity-view.description_RHEL)", + "title_rhel-for-x86-els-payg": "Red Hat Enterprise Linux for x86 ELS On-Demand", + "subtitle_rhel-for-x86-els-payg": "$t(curiosity-view.subtitle_rhacs)", + "description_rhel-for-x86-els-payg": "$t(curiosity-view.description_rhacs)", "title_rhel-for-x86-eus": "$t(curiosity-view.title_RHEL)", "subtitle_rhel-for-x86-eus": "$t(curiosity-view.subtitle_RHEL)", "description_rhel-for-x86-eus": "$t(curiosity-view.description_RHEL)", diff --git a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap index 8a7950e2f..0b7b2c13f 100644 --- a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap +++ b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap @@ -677,6 +677,79 @@ exports[`I18n Component should generate a predictable locale key output snapshot }, ], }, + { + "file": "src/config/product.rhelElsPayg.js", + "keys": [ + { + "key": "curiosity-graph.label_axisY", + "match": "translate('curiosity-graph.label_axisY', { context: id })", + }, + { + "key": "curiosity-graph.cardHeadingMetric", + "match": "translate('curiosity-graph.cardHeadingMetric', { context: ['dailyTotal', dataSets?.[0]?.display?.chartId], testId: 'graphDailyTotalCard-header' })", + }, + { + "key": "curiosity-graph.cardBodyMetric", + "match": "translate( 'curiosity-graph.cardBodyMetric', { context: ['total', dataSets?.[0]?.display?.dailyHasData && dataSets?.[0]?.display?.chartId], testId: 'graphDailyTotalCard-body', total: helpers .numberDisplay(dataSets?.[0]?.display?.dailyValue)", + }, + { + "key": "curiosity-graph.cardFooterMetric", + "match": "translate('curiosity-graph.cardFooterMetric', { date: moment .utc(dataSets?.[0]?.display?.dailyDate)", + }, + { + "key": "curiosity-graph.cardHeadingMetric", + "match": "translate('curiosity-graph.cardHeadingMetric', { context: ['monthlyTotal', dataSets?.[0]?.display?.chartId], testId: 'graphMonthlyTotalCard-header' })", + }, + { + "key": "curiosity-graph.cardBodyMetric", + "match": "translate( 'curiosity-graph.cardBodyMetric', { context: ['total', dataSets?.[0]?.display?.monthlyHasData && dataSets?.[0]?.display?.chartId], testId: 'graphMonthlyTotalCard-body', total: helpers .numberDisplay(dataSets?.[0]?.display?.monthlyValue)", + }, + { + "key": "curiosity-graph.cardFooterMetric", + "match": "translate('curiosity-graph.cardFooterMetric', { date: moment .utc(dataSets?.[0]?.display?.monthlyDate)", + }, + { + "key": "curiosity-graph.label_axisX", + "match": "translate('curiosity-graph.label_axisX', { context: GRANULARITY_TYPES.DAILY })", + }, + { + "key": "curiosity-inventory.label", + "match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests }, [ ])", + }, + { + "key": "curiosity-inventory.label", + "match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.BILLING_PROVIDER, provider || 'none'] })", + }, + { + "key": "curiosity-inventory.header", + "match": "translate('curiosity-inventory.header', { context: ['tooltip', RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES] })", + }, + { + "key": "curiosity-inventory.measurement", + "match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES, total: helpers.numberDisplay(total)", + }, + { + "key": "curiosity-inventory.header", + "match": "translate('curiosity-inventory.header', { context: ['tooltip', RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS] })", + }, + { + "key": "curiosity-inventory.measurement", + "match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS, total: helpers.numberDisplay(total)", + }, + { + "key": "curiosity-inventory.measurement", + "match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS, total: helpers.numberDisplay(total)", + }, + { + "key": "curiosity-inventory.label", + "match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, provider || 'none'] })", + }, + { + "key": "", + "match": "translate(\`curiosity-inventory.label_\${SUBSCRIPTIONS_INVENTORY_META_TYPES.SUBSCRIPTION_TYPE}\`, { context: subscriptionType || EMPTY_CONTEXT })", + }, + ], + }, { "file": "src/config/product.rhods.js", "keys": [ @@ -974,6 +1047,38 @@ exports[`I18n Component should have locale keys that exist in the default langua "file": "src/config/product.rhel.js", "key": "curiosity-inventory.label", }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-graph.label_axisY", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-graph.label_axisX", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.label", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.label", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.measurement", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.measurement", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.measurement", + }, + { + "file": "src/config/product.rhelElsPayg.js", + "key": "curiosity-inventory.label", + }, { "file": "src/config/product.rhods.js", "key": "curiosity-graph.label_axisY", diff --git a/src/config/README.md b/src/config/README.md index 91b21a253..eb76d2aab 100644 --- a/src/config/README.md +++ b/src/config/README.md @@ -16,6 +16,9 @@
RHEL

RHEL

+
RHEL-X86-ELS
+

RHEL X86 ELS

+
RHODS

RHODS

@@ -213,6 +216,42 @@ Product label. An identifier used for display strings. RHEL product config **Kind**: inner constant of [RHEL](#Products.module_RHEL) + + +## RHEL-X86-ELS +RHEL X86 ELS + + +* [RHEL-X86-ELS](#Products.module_RHEL-X86-ELS) + * [~productGroup](#Products.module_RHEL-X86-ELS..productGroup) : string + * [~productId](#Products.module_RHEL-X86-ELS..productId) : string + * [~productLabel](#Products.module_RHEL-X86-ELS..productLabel) : string + * [~config](#Products.module_RHEL-X86-ELS..config) : Object + + + +### RHEL-X86-ELS~productGroup : string +Product group. A variant and dissimilar product configuration grouping identifier. + +**Kind**: inner constant of [RHEL-X86-ELS](#Products.module_RHEL-X86-ELS) + + +### RHEL-X86-ELS~productId : string +Product ID. The identifier used when querying the API. + +**Kind**: inner constant of [RHEL-X86-ELS](#Products.module_RHEL-X86-ELS) + + +### RHEL-X86-ELS~productLabel : string +Product label. An identifier used for display strings. + +**Kind**: inner constant of [RHEL-X86-ELS](#Products.module_RHEL-X86-ELS) + + +### RHEL-X86-ELS~config : Object +Product configuration + +**Kind**: inner constant of [RHEL-X86-ELS](#Products.module_RHEL-X86-ELS) ## RHODS diff --git a/src/config/__tests__/__snapshots__/product.config.test.js.snap b/src/config/__tests__/__snapshots__/product.config.test.js.snap index 473f4a628..f1b9d4b76 100644 --- a/src/config/__tests__/__snapshots__/product.config.test.js.snap +++ b/src/config/__tests__/__snapshots__/product.config.test.js.snap @@ -728,6 +728,248 @@ exports[`Product specific configurations should apply graph filters and settings "yAxisTickFormatAvailable": true, }, }, + { + "rhel-for-x86-els-payg": { + "xAxisChartLabel": "t(curiosity-graph.label_axisX, {"context":"Daily"})", + "yAxisChartLabel": "t(curiosity-graph.label_axisY, {})", + "yAxisTickFormat": { + "0.00001345": "0.00001", + "0.0000269": "0.00003", + "0.00004035": "0.00004", + "0.0000538": "0.00005", + "0.00006725": "0.00007", + "0.0000807": "0.00008", + "0.00009415": "0.00009", + "0.0001076": "0.00011", + "0.00012105": "0.00012", + "0.0001345": "0.00013", + "0.00014795": "0.00015", + "0.0001614": "0.00016", + "0.00017485": "0.00017", + "0.0001883": "0.00019", + "0.00020175": "0.0002", + "0.0002152": "0.00022", + "0.00022865": "0.00023", + "0.0002421": "0.00024", + "0.00025555": "0.00026", + "0.000269": "0.00027", + "0.00028245": "0.00028", + "0.0002959": "0.0003", + "0.00030935": "0.00031", + "0.0003228": "0.00032", + "0.00033625": "0.00034", + "0.001": "0.001", + "0.002": "0.002", + "0.003": "0.003", + "0.004": "0.004", + "0.005": "0.005", + "0.006": "0.006", + "0.007": "0.007", + "0.008": "0.008", + "0.009000000000000001": "0.009", + "0.01": "0.01", + "0.011": "0.011", + "0.012": "0.012", + "0.013000000000000001": "0.013", + "0.014": "0.014", + "0.015": "0.015", + "0.016": "0.016", + "0.017": "0.017", + "0.018000000000000002": "0.018", + "0.019": "0.019", + "0.02": "0.02", + "0.021": "0.021", + "0.022": "0.022", + "0.023": "0.023", + "0.024": "0.024", + "0.025": "0.025", + "1": "1", + "10": "10", + "100": "100", + "1000": "1K", + "10000": "10K", + "100000": "100K", + "1000000": "1M", + "10000000": "10M", + "100000000": "100M", + "1000000000": "1B", + "10000000000": "10B", + "100000000000": "100B", + "1000000000000": "1T", + "10000000000000": "10T", + "11": "11", + "110": "110", + "1100": "1.1K", + "11000": "11K", + "110000": "110K", + "1100000": "1.1M", + "11000000": "11M", + "110000000": "110M", + "1100000000": "1.1B", + "11000000000": "11B", + "110000000000": "110B", + "1100000000000": "1.1T", + "11000000000000": "11T", + "12": "12", + "120": "120", + "1200": "1.2K", + "12000": "12K", + "120000": "120K", + "1200000": "1.2M", + "12000000": "12M", + "120000000": "120M", + "1200000000": "1.2B", + "12000000000": "12B", + "120000000000": "120B", + "1200000000000": "1.2T", + "12000000000000": "12T", + "13": "13", + "130": "130", + "1300": "1.3K", + "13000": "13K", + "130000": "130K", + "1300000": "1.3M", + "13000000": "13M", + "130000000": "130M", + "1300000000": "1.3B", + "13000000000": "13B", + "130000000000": "130B", + "1300000000000": "1.3T", + "13000000000000": "13T", + "14": "14", + "140": "140", + "1400": "1.4K", + "14000": "14K", + "140000": "140K", + "1400000": "1.4M", + "14000000": "14M", + "140000000": "140M", + "1400000000": "1.4B", + "14000000000": "14B", + "140000000000": "140B", + "1400000000000": "1.4T", + "14000000000000": "14T", + "15": "15", + "150": "150", + "1500": "1.5K", + "15000": "15K", + "150000": "150K", + "1500000": "1.5M", + "15000000": "15M", + "150000000": "150M", + "1500000000": "1.5B", + "15000000000": "15B", + "150000000000": "150B", + "1500000000000": "1.5T", + "15000000000000": "15T", + "2": "2", + "20": "20", + "200": "200", + "2000": "2K", + "20000": "20K", + "200000": "200K", + "2000000": "2M", + "20000000": "20M", + "200000000": "200M", + "2000000000": "2B", + "20000000000": "20B", + "200000000000": "200B", + "2000000000000": "2T", + "3": "3", + "30": "30", + "300": "300", + "3000": "3K", + "30000": "30K", + "300000": "300K", + "3000000": "3M", + "30000000": "30M", + "300000000": "300M", + "3000000000": "3B", + "30000000000": "30B", + "300000000000": "300B", + "3000000000000": "3T", + "4": "4", + "40": "40", + "400": "400", + "4000": "4K", + "40000": "40K", + "400000": "400K", + "4000000": "4M", + "40000000": "40M", + "400000000": "400M", + "4000000000": "4B", + "40000000000": "40B", + "400000000000": "400B", + "4000000000000": "4T", + "5": "5", + "50": "50", + "500": "500", + "5000": "5K", + "50000": "50K", + "500000": "500K", + "5000000": "5M", + "50000000": "50M", + "500000000": "500M", + "5000000000": "5B", + "50000000000": "50B", + "500000000000": "500B", + "5000000000000": "5T", + "6": "6", + "60": "60", + "600": "600", + "6000": "6K", + "60000": "60K", + "600000": "600K", + "6000000": "6M", + "60000000": "60M", + "600000000": "600M", + "6000000000": "6B", + "60000000000": "60B", + "600000000000": "600B", + "6000000000000": "6T", + "7": "7", + "70": "70", + "700": "700", + "7000": "7K", + "70000": "70K", + "700000": "700K", + "7000000": "7M", + "70000000": "70M", + "700000000": "700M", + "7000000000": "7B", + "70000000000": "70B", + "700000000000": "700B", + "7000000000000": "7T", + "8": "8", + "80": "80", + "800": "800", + "8000": "8K", + "80000": "80K", + "800000": "800K", + "8000000": "8M", + "80000000": "80M", + "800000000": "800M", + "8000000000": "8B", + "80000000000": "80B", + "800000000000": "800B", + "8000000000000": "8T", + "9": "9", + "90": "90", + "900": "900", + "9000": "9K", + "90000": "90K", + "900000": "900K", + "9000000": "9M", + "90000000": "90M", + "900000000": "900M", + "9000000000": "9B", + "90000000000": "90B", + "900000000000": "900B", + "9000000000000": "9T", + }, + "yAxisTickFormatAvailable": true, + }, + }, { "rhods": { "xAxisChartLabel": "t(curiosity-graph.label_axisX, {"context":"Daily"})", @@ -1260,6 +1502,20 @@ exports[`Product specific configurations should apply graph filters and settings }, ], }, + { + "rhel-for-x86-els-payg": [ + { + "body": "t(curiosity-graph.cardBodyMetric, {"context":"total","testId":"graphDailyTotalCard-body"}, [object Object])", + "footer": "t(curiosity-graph.cardFooterMetric, {"date":"09 Mar 2023 00:00 UTC","testId":"graphDailyTotalCard-footer"})", + "header": "t(curiosity-graph.cardHeadingMetric, {"context":"dailyTotal","testId":"graphDailyTotalCard-header"})", + }, + { + "body": "t(curiosity-graph.cardBodyMetric, {"context":"total","testId":"graphMonthlyTotalCard-body"}, [object Object])", + "footer": "t(curiosity-graph.cardFooterMetric, {"date":"09 Mar 2023 00:00 UTC","testId":"graphMonthlyTotalCard-footer"})", + "header": "t(curiosity-graph.cardHeadingMetric, {"context":"monthlyTotal","testId":"graphMonthlyTotalCard-header"})", + }, + ], + }, { "rhods": [ { @@ -1732,7 +1988,7 @@ exports[`Product specific configurations should apply graph filters and settings }, }, { - "rhods": { + "rhel-for-x86-els-payg": { "filtersSettings": [ { "settings": { @@ -1752,7 +2008,69 @@ exports[`Product specific configurations should apply graph filters and settings "color": "#06c", "fill": "#8bc1f7", "groupMetric": [ - "Cores", + "vCPUs", + ], + "isCardTitleDescription": true, + "isMetricDisplay": true, + "isMultiMetric": false, + "isStacked": false, + "isStandalone": undefined, + "metric": undefined, + "metrics": [ + { + "chartType": "line", + "color": "#06c", + "fill": "#8bc1f7", + "id": "vCPUs_rhel-for-x86-els-payg", + "isCapacity": false, + "isStacked": false, + "isThreshold": false, + "isToolbarFilter": false, + "metric": "vCPUs", + "stroke": "#06c", + "strokeWidth": 2, + "yAxisChartLabel": [Function], + }, + ], + "padding": { + "bottom": 75, + "left": 75, + "right": 45, + "top": 45, + }, + "productId": "rhel-for-x86-els-payg", + "stringId": "vCPUs_rhel-for-x86-els-payg", + "stroke": "#06c", + "xAxisChartLabel": [Function], + "yAxisChartLabel": [Function], + "yAxisTickFormat": [Function], + }, + }, + ], + }, + }, + { + "rhods": { + "filtersSettings": [ + { + "settings": { + "cards": [ + { + "body": [Function], + "footer": [Function], + "header": [Function], + }, + { + "body": [Function], + "footer": [Function], + "header": [Function], + }, + ], + "chartType": "line", + "color": "#06c", + "fill": "#8bc1f7", + "groupMetric": [ + "Cores", ], "isCardTitleDescription": true, "isMetricDisplay": true, @@ -2154,6 +2472,24 @@ exports[`Product specific configurations should apply query parameters: product }, }, }, + { + "rhel-for-x86-els-payg": { + "graphTallyQuery": { + "granularity": "Daily", + }, + "inventoryGuestsQuery": { + "limit": 100, + "offset": 0, + }, + "inventoryHostsQuery": { + "dir": "desc", + "limit": 100, + "offset": 0, + "sort": "last_seen", + }, + "inventorySubscriptionsQuery": undefined, + }, + }, { "rhods": { "graphTallyQuery": { @@ -3636,6 +3972,161 @@ exports[`Product specific configurations should apply variations in inventory fi "resultsPerPage": undefined, }, }, + { + "rhel-for-x86-els-payg": { + "dataSetColumnHeaders": [ + { + "cell": [Function], + "content": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "label": [Function], + "metric": "display_name", + "width": undefined, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": false, + "label": [Function], + "metric": "billing_provider", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Transfer-gibibytes,curiosity-inventory.guestsHeader_Transfer-gibibytes], {"context":"rhel-for-x86-els-payg"})", + "info": { + "tooltip": "t(curiosity-inventory.header_tooltip, {"context":"Transfer-gibibytes"})", + }, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Transfer-gibibytes", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Storage-gibibyte-months,curiosity-inventory.guestsHeader_Storage-gibibyte-months], {"context":"rhel-for-x86-els-payg"})", + "info": { + "tooltip": "t(curiosity-inventory.header_tooltip, {"context":"Storage-gibibyte-months"})", + }, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Storage-gibibyte-months", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Instance-hours,curiosity-inventory.guestsHeader_Instance-hours], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Instance-hours", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "last_seen", + "modifier": "wrap", + "width": 15, + }, + ], + "dataSetRows": [ + { + "cells": [ + { + "content": + lorem + + + , + "dataLabel": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "metric": "display_name", + "width": undefined, + }, + { + "content": "t(curiosity-inventory.label_billing_provider, {"context":"none"})", + "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": false, + "metric": "billing_provider", + "width": 15, + }, + { + "content": "t(curiosity-inventory.measurement, {"context":"Transfer-gibibytes","total":0})", + "dataLabel": "t([curiosity-inventory.header_Transfer-gibibytes,curiosity-inventory.guestsHeader_Transfer-gibibytes], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "info": { + "tooltip": [Function], + }, + "isSort": true, + "isWrap": true, + "metric": "Transfer-gibibytes", + "width": 15, + }, + { + "content": "t(curiosity-inventory.measurement, {"context":"Storage-gibibyte-months","total":0})", + "dataLabel": "t([curiosity-inventory.header_Storage-gibibyte-months,curiosity-inventory.guestsHeader_Storage-gibibyte-months], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "info": { + "tooltip": [Function], + }, + "isSort": true, + "isWrap": true, + "metric": "Storage-gibibyte-months", + "width": 15, + }, + { + "content": "t(curiosity-inventory.measurement, {"context":"Instance-hours","total":0})", + "dataLabel": "t([curiosity-inventory.header_Instance-hours,curiosity-inventory.guestsHeader_Instance-hours], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "Instance-hours", + "width": 15, + }, + { + "content": , + "dataLabel": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "last_seen", + "width": 15, + }, + ], + "expandedContent": undefined, + "row": { + "cloud_provider": "dolor sit", + "display_name": "lorem", + "instance_id": "XXXX-XXXX-XXXXX-XXXXX", + "last_seen": "2022-01-01T00:00:00.000Z", + "loremIpsum": "hello world", + }, + }, + ], + "resultsCount": undefined, + "resultsOffset": undefined, + "resultsPerPage": undefined, + }, + }, { "rhods": { "dataSetColumnHeaders": [ @@ -3984,6 +4475,7 @@ exports[`Product specific configurations should apply variations in inventory fi "OpenShift-metrics", "rhacs", "RHEL for x86", + "rhel-for-x86-els-payg", "rhods", "rosa", "Satellite Server", @@ -4500,42 +4992,67 @@ exports[`Product specific configurations should apply variations in inventory fi }, }, { - "rhods": { + "rhel-for-x86-els-payg": { "dataSetColumnHeaders": [ { "cell": [Function], - "content": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhods"})", + "content": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhel-for-x86-els-payg"})", "info": undefined, - "isSortable": true, + "isSort": true, "label": [Function], "metric": "display_name", "width": undefined, }, { "cell": [Function], - "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhods"})", + "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", "info": undefined, "isSort": true, - "isWrap": true, + "isWrap": false, "label": [Function], "metric": "billing_provider", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Transfer-gibibytes,curiosity-inventory.guestsHeader_Transfer-gibibytes], {"context":"rhel-for-x86-els-payg"})", + "info": { + "tooltip": "t(curiosity-inventory.header_tooltip, {"context":"Transfer-gibibytes"})", + }, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Transfer-gibibytes", "modifier": "wrap", "width": 15, }, { "cell": [Function], - "content": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"rhods"})", + "content": "t([curiosity-inventory.header_Storage-gibibyte-months,curiosity-inventory.guestsHeader_Storage-gibibyte-months], {"context":"rhel-for-x86-els-payg"})", + "info": { + "tooltip": "t(curiosity-inventory.header_tooltip, {"context":"Storage-gibibyte-months"})", + }, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Storage-gibibyte-months", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Instance-hours,curiosity-inventory.guestsHeader_Instance-hours], {"context":"rhel-for-x86-els-payg"})", "info": undefined, "isSort": true, "isWrap": true, "label": [Function], - "metric": "Cores", + "metric": "Instance-hours", "modifier": "wrap", "width": 15, }, { "cell": [Function], - "content": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhods"})", + "content": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhel-for-x86-els-payg"})", "info": undefined, "isSort": true, "isWrap": true, @@ -4549,46 +5066,176 @@ exports[`Product specific configurations should apply variations in inventory fi { "cells": [ { - "content": "lorem", - "dataLabel": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhods"})", + "content": + lorem + + + , + "dataLabel": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhel-for-x86-els-payg"})", "header": [Function], - "isSortable": true, + "isSort": true, "metric": "display_name", "width": undefined, }, { "content": "t(curiosity-inventory.label_billing_provider, {"context":"none"})", - "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhods"})", + "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", "header": [Function], "isSort": true, - "isWrap": true, + "isWrap": false, "metric": "billing_provider", "width": 15, }, { - "content": "t(curiosity-inventory.measurement, {"context":"Cores","total":0})", - "dataLabel": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"rhods"})", + "content": "t(curiosity-inventory.measurement, {"context":"Transfer-gibibytes","total":0})", + "dataLabel": "t([curiosity-inventory.header_Transfer-gibibytes,curiosity-inventory.guestsHeader_Transfer-gibibytes], {"context":"rhel-for-x86-els-payg"})", "header": [Function], + "info": { + "tooltip": [Function], + }, "isSort": true, "isWrap": true, - "metric": "Cores", + "metric": "Transfer-gibibytes", "width": 15, }, { - "content": , - "dataLabel": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhods"})", + "content": "t(curiosity-inventory.measurement, {"context":"Storage-gibibyte-months","total":0})", + "dataLabel": "t([curiosity-inventory.header_Storage-gibibyte-months,curiosity-inventory.guestsHeader_Storage-gibibyte-months], {"context":"rhel-for-x86-els-payg"})", "header": [Function], + "info": { + "tooltip": [Function], + }, "isSort": true, "isWrap": true, - "metric": "last_seen", + "metric": "Storage-gibibyte-months", "width": 15, }, - ], - "expandedContent": undefined, - "row": { - "cloud_provider": "dolor sit", + { + "content": "t(curiosity-inventory.measurement, {"context":"Instance-hours","total":0})", + "dataLabel": "t([curiosity-inventory.header_Instance-hours,curiosity-inventory.guestsHeader_Instance-hours], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "Instance-hours", + "width": 15, + }, + { + "content": , + "dataLabel": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "last_seen", + "width": 15, + }, + ], + "expandedContent": undefined, + "row": { + "cloud_provider": "dolor sit", + "display_name": "lorem", + "instance_id": "XXXX-XXXX-XXXXX-XXXXX", + "last_seen": "2022-01-01T00:00:00.000Z", + "loremIpsum": "hello world", + }, + }, + ], + "resultsCount": undefined, + "resultsOffset": undefined, + "resultsPerPage": undefined, + }, + }, + { + "rhods": { + "dataSetColumnHeaders": [ + { + "cell": [Function], + "content": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhods"})", + "info": undefined, + "isSortable": true, + "label": [Function], + "metric": "display_name", + "width": undefined, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhods"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "billing_provider", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"rhods"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "Cores", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhods"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "last_seen", + "modifier": "wrap", + "width": 15, + }, + ], + "dataSetRows": [ + { + "cells": [ + { + "content": "lorem", + "dataLabel": "t([curiosity-inventory.header_display_name,curiosity-inventory.guestsHeader_display_name], {"context":"rhods"})", + "header": [Function], + "isSortable": true, + "metric": "display_name", + "width": undefined, + }, + { + "content": "t(curiosity-inventory.label_billing_provider, {"context":"none"})", + "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhods"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "billing_provider", + "width": 15, + }, + { + "content": "t(curiosity-inventory.measurement, {"context":"Cores","total":0})", + "dataLabel": "t([curiosity-inventory.header_Cores,curiosity-inventory.guestsHeader_Cores], {"context":"rhods"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "Cores", + "width": 15, + }, + { + "content": , + "dataLabel": "t([curiosity-inventory.header_last_seen,curiosity-inventory.guestsHeader_last_seen], {"context":"rhods"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "last_seen", + "width": 15, + }, + ], + "expandedContent": undefined, + "row": { + "cloud_provider": "dolor sit", "display_name": "lorem", "instance_id": "XXXX-XXXX-XXXXX-XXXXX", "last_seen": "2022-01-01T00:00:00.000Z", @@ -5267,6 +5914,152 @@ exports[`Product specific configurations should apply variations in inventory fi "resultsPerPage": undefined, }, }, + { + "rhel-for-x86-els-payg": { + "dataSetColumnHeaders": [ + { + "cell": [Function], + "content": "t([curiosity-inventory.header_product_name,curiosity-inventory.guestsHeader_product_name], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "product_name", + "modifier": "wrap", + "width": undefined, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": false, + "isWrap": false, + "label": [Function], + "metric": "billing_provider", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_service_level,curiosity-inventory.guestsHeader_service_level], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "service_level", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_quantity,curiosity-inventory.guestsHeader_quantity], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "quantity", + "modifier": "wrap", + "width": 10, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_subscription_type,curiosity-inventory.guestsHeader_subscription_type], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": false, + "isWrap": true, + "label": [Function], + "metric": "subscription_type", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_next_event_date,curiosity-inventory.guestsHeader_next_event_date], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "next_event_date", + "modifier": "wrap", + "width": 15, + }, + ], + "dataSetRows": [ + { + "cells": [ + { + "content": "lorem", + "dataLabel": "t([curiosity-inventory.header_product_name,curiosity-inventory.guestsHeader_product_name], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "product_name", + "width": undefined, + }, + { + "content": "t(curiosity-inventory.label_billing_provider, {"context":"dolor sit"})", + "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": false, + "isWrap": false, + "metric": "billing_provider", + "width": 15, + }, + { + "content": "hello world", + "dataLabel": "t([curiosity-inventory.header_service_level,curiosity-inventory.guestsHeader_service_level], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "service_level", + "width": 15, + }, + { + "content": 1, + "dataLabel": "t([curiosity-inventory.header_quantity,curiosity-inventory.guestsHeader_quantity], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "quantity", + "width": 10, + }, + { + "content": "t(curiosity-inventory.label_subscription_type, {"context":" "})", + "dataLabel": "t([curiosity-inventory.header_subscription_type,curiosity-inventory.guestsHeader_subscription_type], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": false, + "isWrap": true, + "metric": "subscription_type", + "width": 15, + }, + { + "content": "", + "dataLabel": "t([curiosity-inventory.header_next_event_date,curiosity-inventory.guestsHeader_next_event_date], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "next_event_date", + "width": 15, + }, + ], + "expandedContent": undefined, + "row": { + "billing_provider": "dolor sit", + "has_infinite_quantity": true, + "loremIpsum": "hello world", + "next_event_date": "2022-01-01T00:00:00.000Z", + "product_name": "lorem", + "quantity": 1, + "service_level": "hello world", + "total_capacity": 2000, + "uom": "cores", + }, + }, + ], + "resultsCount": undefined, + "resultsOffset": undefined, + "resultsPerPage": undefined, + }, + }, { "rhods": { "dataSetColumnHeaders": [ @@ -5508,6 +6301,7 @@ exports[`Product specific configurations should apply variations in inventory fi "OpenShift Container Platform", "rhacs", "RHEL for x86", + "rhel-for-x86-els-payg", "rhods", "rosa", ] @@ -5947,6 +6741,152 @@ exports[`Product specific configurations should apply variations in inventory fi "resultsPerPage": undefined, }, }, + { + "rhel-for-x86-els-payg": { + "dataSetColumnHeaders": [ + { + "cell": [Function], + "content": "t([curiosity-inventory.header_product_name,curiosity-inventory.guestsHeader_product_name], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "product_name", + "modifier": "wrap", + "width": undefined, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": false, + "isWrap": false, + "label": [Function], + "metric": "billing_provider", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_service_level,curiosity-inventory.guestsHeader_service_level], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "service_level", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_quantity,curiosity-inventory.guestsHeader_quantity], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "quantity", + "modifier": "wrap", + "width": 10, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_subscription_type,curiosity-inventory.guestsHeader_subscription_type], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": false, + "isWrap": true, + "label": [Function], + "metric": "subscription_type", + "modifier": "wrap", + "width": 15, + }, + { + "cell": [Function], + "content": "t([curiosity-inventory.header_next_event_date,curiosity-inventory.guestsHeader_next_event_date], {"context":"rhel-for-x86-els-payg"})", + "info": undefined, + "isSort": true, + "isWrap": true, + "label": [Function], + "metric": "next_event_date", + "modifier": "wrap", + "width": 15, + }, + ], + "dataSetRows": [ + { + "cells": [ + { + "content": "lorem", + "dataLabel": "t([curiosity-inventory.header_product_name,curiosity-inventory.guestsHeader_product_name], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "product_name", + "width": undefined, + }, + { + "content": "t(curiosity-inventory.label_billing_provider, {"context":"dolor sit"})", + "dataLabel": "t([curiosity-inventory.header_billing_provider,curiosity-inventory.guestsHeader_billing_provider], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": false, + "isWrap": false, + "metric": "billing_provider", + "width": 15, + }, + { + "content": "hello world", + "dataLabel": "t([curiosity-inventory.header_service_level,curiosity-inventory.guestsHeader_service_level], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "service_level", + "width": 15, + }, + { + "content": 1, + "dataLabel": "t([curiosity-inventory.header_quantity,curiosity-inventory.guestsHeader_quantity], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "quantity", + "width": 10, + }, + { + "content": "t(curiosity-inventory.label_subscription_type, {"context":" "})", + "dataLabel": "t([curiosity-inventory.header_subscription_type,curiosity-inventory.guestsHeader_subscription_type], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": false, + "isWrap": true, + "metric": "subscription_type", + "width": 15, + }, + { + "content": "", + "dataLabel": "t([curiosity-inventory.header_next_event_date,curiosity-inventory.guestsHeader_next_event_date], {"context":"rhel-for-x86-els-payg"})", + "header": [Function], + "isSort": true, + "isWrap": true, + "metric": "next_event_date", + "width": 15, + }, + ], + "expandedContent": undefined, + "row": { + "billing_provider": "dolor sit", + "has_infinite_quantity": true, + "loremIpsum": "hello world", + "next_event_date": "2022-01-01T00:00:00.000Z", + "product_name": "lorem", + "quantity": 1, + "service_level": "hello world", + "total_capacity": 2000, + "uom": "cores", + }, + }, + ], + "resultsCount": undefined, + "resultsOffset": undefined, + "resultsPerPage": undefined, + }, + }, { "rhods": { "dataSetColumnHeaders": [ diff --git a/src/config/__tests__/__snapshots__/products.test.js.snap b/src/config/__tests__/__snapshots__/products.test.js.snap index 28a16a058..6618b3af4 100644 --- a/src/config/__tests__/__snapshots__/products.test.js.snap +++ b/src/config/__tests__/__snapshots__/products.test.js.snap @@ -391,6 +391,7 @@ exports[`Product configurations should return specific methods and properties: p "OpenShift-metrics", "rhacs", "RHEL for x86", + "rhel-for-x86-els-payg", "rhods", "rosa", "Satellite Server", diff --git a/src/config/product.rhelElsPayg.js b/src/config/product.rhelElsPayg.js new file mode 100644 index 000000000..3e70d09b0 --- /dev/null +++ b/src/config/product.rhelElsPayg.js @@ -0,0 +1,357 @@ +import React from 'react'; +import { + chart_color_blue_100 as chartColorBlueLight, + chart_color_blue_300 as chartColorBlueDark +} from '@patternfly/react-tokens'; +import { Button, Label as PfLabel } from '@patternfly/react-core'; +import { DateFormat } from '@redhat-cloud-services/frontend-components/DateFormat'; +import moment from 'moment'; +import { + RHSM_API_PATH_METRIC_TYPES, + RHSM_API_PATH_PRODUCT_TYPES, + RHSM_API_QUERY_GRANULARITY_TYPES as GRANULARITY_TYPES, + RHSM_API_QUERY_INVENTORY_SORT_DIRECTION_TYPES as SORT_DIRECTION_TYPES, + RHSM_API_QUERY_INVENTORY_SORT_TYPES as INVENTORY_SORT_TYPES, + RHSM_API_QUERY_SET_TYPES, + RHSM_API_RESPONSE_SUBSCRIPTIONS_DATA_TYPES as SUBSCRIPTIONS_INVENTORY_TYPES, + RHSM_API_RESPONSE_SUBSCRIPTIONS_META_TYPES as SUBSCRIPTIONS_INVENTORY_META_TYPES, + RHSM_API_RESPONSE_INSTANCES_DATA_TYPES as INVENTORY_TYPES, + RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES as DISPLAY_TYPES +} from '../services/rhsm/rhsmConstants'; +import { ChartTypeVariant } from '../components/chart/chart'; +import { dateHelpers, helpers } from '../common'; +import { SelectPosition } from '../components/form/select'; +import { translate, EMPTY_CONTEXT } from '../components/i18n/i18n'; + +/** + * RHEL X86 ELS + * + * @memberof Products + * @module RHEL-X86-ELS + */ + +/** + * Product group. A variant and dissimilar product configuration grouping identifier. + * + * @type {string} + */ +const productGroup = 'rhel'; + +/** + * Product ID. The identifier used when querying the API. + * + * @type {string} + */ +const productId = RHSM_API_PATH_PRODUCT_TYPES.RHEL_X86_ELS_PAYG; + +/** + * Product label. An identifier used for display strings. + * + * @type {string} + */ +const productLabel = RHSM_API_PATH_PRODUCT_TYPES.RHEL_X86_ELS_PAYG; + +/** + * Product configuration + * + * @type {{productLabel: string, productPath: string, aliases: string[], productId: string, query: object, + * initialSubscriptionsInventoryFilters: Array, initialInventorySettings: object, viewId: string, + * initialToolbarFilters: Array, productGroup: string, graphTallyQuery: object, inventoryHostsQuery: object, + * productDisplay: string, initialGraphFilters: Array, inventoryGuestsQuery: object, initialGraphSettings: object, + * initialInventoryFilters: Array}} + */ +const config = { + aliases: [], + productGroup, + productId, + productLabel, + productPath: productGroup.toLowerCase(), + productDisplay: DISPLAY_TYPES.HOURLY, + viewId: `view${productGroup}-${productId}`, + query: { + [RHSM_API_QUERY_SET_TYPES.START_DATE]: dateHelpers.getRangedMonthDateTime('current').value.startDate.toISOString(), + [RHSM_API_QUERY_SET_TYPES.END_DATE]: dateHelpers.getRangedMonthDateTime('current').value.endDate.toISOString() + }, + graphTallyQuery: { + [RHSM_API_QUERY_SET_TYPES.GRANULARITY]: GRANULARITY_TYPES.DAILY + }, + inventoryGuestsQuery: { + [RHSM_API_QUERY_SET_TYPES.LIMIT]: 100, + [RHSM_API_QUERY_SET_TYPES.OFFSET]: 0 + }, + inventoryHostsQuery: { + [RHSM_API_QUERY_SET_TYPES.SORT]: INVENTORY_SORT_TYPES.LAST_SEEN, + [RHSM_API_QUERY_SET_TYPES.DIRECTION]: SORT_DIRECTION_TYPES.DESCENDING, + [RHSM_API_QUERY_SET_TYPES.LIMIT]: 100, + [RHSM_API_QUERY_SET_TYPES.OFFSET]: 0 + }, + initialGraphFilters: [ + { + metric: RHSM_API_PATH_METRIC_TYPES.VCPUS, + fill: chartColorBlueLight.value, + stroke: chartColorBlueDark.value, + color: chartColorBlueDark.value, + chartType: ChartTypeVariant.line, + isStacked: false, + yAxisChartLabel: ({ id } = {}) => translate('curiosity-graph.label_axisY', { context: id }) + } + ], + initialGraphSettings: { + cards: [ + { + header: ({ dataSets = [] } = {}) => + translate('curiosity-graph.cardHeadingMetric', { + context: ['dailyTotal', dataSets?.[0]?.display?.chartId], + testId: 'graphDailyTotalCard-header' + }), + body: ({ dataSets = [] } = {}) => + translate( + 'curiosity-graph.cardBodyMetric', + { + context: ['total', dataSets?.[0]?.display?.dailyHasData && dataSets?.[0]?.display?.chartId], + testId: 'graphDailyTotalCard-body', + total: helpers + .numberDisplay(dataSets?.[0]?.display?.dailyValue) + ?.format({ + average: true, + mantissa: 2, + trimMantissa: true, + lowPrecision: false + }) + ?.toUpperCase() + }, + [] + ), + footer: ({ dataSets = [] } = {}) => + translate('curiosity-graph.cardFooterMetric', { + date: moment + .utc(dataSets?.[0]?.display?.dailyDate) + .format(dateHelpers.timestampUTCTimeFormats.yearTimeShort), + testId: 'graphDailyTotalCard-footer' + }) + }, + { + header: ({ dataSets = [] } = {}) => + translate('curiosity-graph.cardHeadingMetric', { + context: ['monthlyTotal', dataSets?.[0]?.display?.chartId], + testId: 'graphMonthlyTotalCard-header' + }), + body: ({ dataSets = [] } = {}) => + translate( + 'curiosity-graph.cardBodyMetric', + { + context: ['total', dataSets?.[0]?.display?.monthlyHasData && dataSets?.[0]?.display?.chartId], + testId: 'graphMonthlyTotalCard-body', + total: helpers + .numberDisplay(dataSets?.[0]?.display?.monthlyValue) + ?.format({ + average: true, + mantissa: 2, + trimMantissa: true, + lowPrecision: false + }) + ?.toUpperCase() + }, + [] + ), + footer: ({ dataSets = [] } = {}) => + translate('curiosity-graph.cardFooterMetric', { + date: moment + .utc(dataSets?.[0]?.display?.monthlyDate) + .format(dateHelpers.timestampUTCTimeFormats.yearTimeShort), + testId: 'graphMonthlyTotalCard-footer' + }) + } + ], + isCardTitleDescription: true, + xAxisChartLabel: () => translate('curiosity-graph.label_axisX', { context: GRANULARITY_TYPES.DAILY }), + yAxisTickFormat: ({ tick } = {}) => { + if (tick > 1) { + return helpers + .numberDisplay(tick) + ?.format({ average: true, mantissa: 1, trimMantissa: true, lowPrecision: false }) + ?.toUpperCase(); + } + return helpers + .numberDisplay(tick) + ?.format({ average: true, mantissa: 5, trimMantissa: true, lowPrecision: true }) + ?.toUpperCase(); + } + }, + initialInventoryFilters: [ + { + metric: INVENTORY_TYPES.DISPLAY_NAME, + cell: ({ + [INVENTORY_TYPES.DISPLAY_NAME]: displayName, + [INVENTORY_TYPES.INSTANCE_ID]: instanceId, + [INVENTORY_TYPES.NUMBER_OF_GUESTS]: numberOfGuests + } = {}) => { + // FixMe: Disabled, see SWATCH-1209 for resolution + const { inventory: authorized = false } = {}; + + if (!instanceId) { + return displayName; + } + + let updatedDisplayName = displayName || instanceId; + + if (authorized) { + updatedDisplayName = ( + + ); + } + + return ( + + {updatedDisplayName}{' '} + {(numberOfGuests && + translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests }, [ + + ])) || + ''} + + ); + }, + isSort: true + }, + { + metric: INVENTORY_TYPES.BILLING_PROVIDER, + cell: ({ [INVENTORY_TYPES.BILLING_PROVIDER]: provider }) => + translate('curiosity-inventory.label', { + context: [INVENTORY_TYPES.BILLING_PROVIDER, provider || 'none'] + }), + isSort: true, + isWrap: false, + width: 15 + }, + { + metric: RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES, + info: { + tooltip: () => + translate('curiosity-inventory.header', { + context: ['tooltip', RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES] + }) + }, + cell: ({ [RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES]: total }) => + translate('curiosity-inventory.measurement', { + context: RHSM_API_PATH_METRIC_TYPES.TRANSFER_GIBIBYTES, + total: helpers.numberDisplay(total)?.format({ mantissa: 5, trimMantissa: true }) || 0 + }), + isSort: true, + isWrap: true, + width: 15 + }, + { + metric: RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS, + info: { + tooltip: () => + translate('curiosity-inventory.header', { + context: ['tooltip', RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS] + }) + }, + cell: ({ [RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS]: total }) => + translate('curiosity-inventory.measurement', { + context: RHSM_API_PATH_METRIC_TYPES.STORAGE_GIBIBYTE_MONTHS, + total: helpers.numberDisplay(total)?.format({ mantissa: 5, trimMantissa: true }) || 0 + }), + isSort: true, + isWrap: true, + width: 15 + }, + { + metric: RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS, + cell: ({ [RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS]: total } = {}) => + translate('curiosity-inventory.measurement', { + context: RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS, + total: helpers.numberDisplay(total)?.format({ mantissa: 5, trimMantissa: true }) || 0 + }), + isSort: true, + isWrap: true, + width: 15 + }, + { + metric: INVENTORY_TYPES.LAST_SEEN, + cell: ({ [INVENTORY_TYPES.LAST_SEEN]: lastSeen } = {}) => (lastSeen && ) || '', + isSort: true, + isWrap: true, + width: 15 + } + ], + initialInventorySettings: { + actions: [ + { + id: RHSM_API_QUERY_SET_TYPES.DISPLAY_NAME + } + ], + guestContent: ({ + [INVENTORY_TYPES.NUMBER_OF_GUESTS]: numberOfGuests = {}, + [INVENTORY_TYPES.INSTANCE_ID]: id + } = {}) => (numberOfGuests > 0 && id && { id, numberOfGuests }) || undefined + }, + initialSubscriptionsInventoryFilters: [ + { + metric: SUBSCRIPTIONS_INVENTORY_TYPES.PRODUCT_NAME, + isSort: true, + isWrap: true + }, + { + metric: SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, + cell: ({ [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER]: provider } = {}) => + translate(`curiosity-inventory.label`, { + context: [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, provider || 'none'] + }), + isSort: false, + isWrap: false, + width: 15 + }, + { + metric: SUBSCRIPTIONS_INVENTORY_TYPES.SERVICE_LEVEL, + isSort: true, + isWrap: true, + width: 15 + }, + { + metric: SUBSCRIPTIONS_INVENTORY_TYPES.QUANTITY, + isSort: true, + isWrap: true, + width: 10 + }, + { + metric: SUBSCRIPTIONS_INVENTORY_META_TYPES.SUBSCRIPTION_TYPE, + cell: (data, session, { [SUBSCRIPTIONS_INVENTORY_META_TYPES.SUBSCRIPTION_TYPE]: subscriptionType } = {}) => + translate(`curiosity-inventory.label_${SUBSCRIPTIONS_INVENTORY_META_TYPES.SUBSCRIPTION_TYPE}`, { + context: subscriptionType || EMPTY_CONTEXT + }), + isSort: false, + isWrap: true, + width: 15 + }, + { + metric: SUBSCRIPTIONS_INVENTORY_TYPES.NEXT_EVENT_DATE, + cell: ({ [SUBSCRIPTIONS_INVENTORY_TYPES.NEXT_EVENT_DATE]: nextEventDate } = {}) => + (nextEventDate && helpers.isDate(nextEventDate) && moment.utc(nextEventDate).format('YYYY-MM-DD')) || '', + isSort: true, + isWrap: true, + width: 15 + } + ], + initialToolbarFilters: [ + { + id: RHSM_API_QUERY_SET_TYPES.BILLING_PROVIDER + }, + { + id: 'rangedMonthly', + isSecondary: true, + position: SelectPosition.right + } + ] +}; + +export { config as default, config, productGroup, productId }; diff --git a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap index 1b1f2e81f..b51a83ea9 100644 --- a/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap +++ b/src/services/rhsm/__tests__/__snapshots__/rhsmConstants.test.js.snap @@ -23,6 +23,7 @@ exports[`RHSM Constants should have specific properties: all exported constants "RHEL_IBM_Z": "RHEL for IBM z", "RHEL_WORKSTATION": "RHEL Workstation", "RHEL_X86": "RHEL for x86", + "RHEL_X86_ELS_PAYG": "rhel-for-x86-els-payg", "RHEL_X86_EUS": "rhel-for-x86-eus", "RHEL_X86_HA": "rhel-for-x86-ha", "RHEL_X86_SAP": "rhel-for-sap-x86", @@ -285,6 +286,7 @@ exports[`RHSM Constants should have specific properties: all exported constants "RHEL_IBM_Z": "RHEL for IBM z", "RHEL_WORKSTATION": "RHEL Workstation", "RHEL_X86": "RHEL for x86", + "RHEL_X86_ELS_PAYG": "rhel-for-x86-els-payg", "RHEL_X86_EUS": "rhel-for-x86-eus", "RHEL_X86_HA": "rhel-for-x86-ha", "RHEL_X86_SAP": "rhel-for-sap-x86", @@ -548,6 +550,7 @@ exports[`RHSM Constants should have specific properties: all exported constants "RHEL_IBM_Z": "RHEL for IBM z", "RHEL_WORKSTATION": "RHEL Workstation", "RHEL_X86": "RHEL for x86", + "RHEL_X86_ELS_PAYG": "rhel-for-x86-els-payg", "RHEL_X86_EUS": "rhel-for-x86-eus", "RHEL_X86_HA": "rhel-for-x86-ha", "RHEL_X86_SAP": "rhel-for-sap-x86", @@ -815,6 +818,7 @@ exports[`RHSM Constants should have specific properties: specific constants 1`] "RHEL_IBM_Z": "RHEL for IBM z", "RHEL_WORKSTATION": "RHEL Workstation", "RHEL_X86": "RHEL for x86", + "RHEL_X86_ELS_PAYG": "rhel-for-x86-els-payg", "RHEL_X86_EUS": "rhel-for-x86-eus", "RHEL_X86_HA": "rhel-for-x86-ha", "RHEL_X86_SAP": "rhel-for-sap-x86", diff --git a/src/services/rhsm/rhsmConstants.js b/src/services/rhsm/rhsmConstants.js index aff195035..071dc6814 100644 --- a/src/services/rhsm/rhsmConstants.js +++ b/src/services/rhsm/rhsmConstants.js @@ -39,16 +39,18 @@ const RHSM_API_PATH_PRODUCT_VARIANT_SATELLITE_TYPES = { * dissimilar graph and inventory displays. Force grouped product ids are grouped with the * [product configuration property "productGroup"]{@link ../config/}, i.e. OpenShift et all. * - * @type {{RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_WORKSTATION: string, RHODS: string, ROSA: string, - * RHEL_X86: string, RHEL_COMPUTE_NODE: string, OPENSHIFT: string, SATELLITE_SERVER: string, - * OPENSHIFT_DEDICATED_METRICS: string, SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, - * RHACS: string}} + * @type {{RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_X86_EUS: string, RHEL_WORKSTATION: string, + * RHEL_X86_SAP: string, RHODS: string, ROSA: string, RHEL_X86: string, RHEL_COMPUTE_NODE: string, + * RHEL_X86_ELS_PAYG: string, OPENSHIFT: string, SATELLITE_SERVER: string, OPENSHIFT_DEDICATED_METRICS: string, + * SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHACS: + * string}} */ const RHSM_API_PATH_PRODUCT_TYPES = { ...RHSM_API_PATH_PRODUCT_VARIANT_RHEL_TYPES, ...RHSM_API_PATH_PRODUCT_VARIANT_SATELLITE_TYPES, RHACS: 'rhacs', RHEL_COMPUTE_NODE: 'RHEL Compute Node', + RHEL_X86_ELS_PAYG: 'rhel-for-x86-els-payg', RHEL_WORKSTATION: 'RHEL Workstation', RHODS: 'rhods', ROSA: 'rosa', @@ -453,23 +455,23 @@ const RHSM_INTERNAL_PRODUCT_DISPLAY_TYPES = { * {CORES: string, SOCKETS: string, INSTANCE_HOURS: string, NUMBER_OF_GUESTS: string, CORE_SECONDS: string, NAME: * string, STORAGE_GIBIBYTES: string, CATEGORY: string, TRANSFER_GIBIBYTES: string, VCPUS: string, * BILLING_PROVIDER: string, STORAGE_GIBIBYTE_MONTHS: string, LAST_SEEN: string}, RHSM_API_PATH_PRODUCT_TYPES: - * {RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_WORKSTATION: string, RHODS: string, ROSA: string, RHEL_X86: - * string, RHEL_COMPUTE_NODE: string, OPENSHIFT: string, SATELLITE_SERVER: string, OPENSHIFT_DEDICATED_METRICS: - * string, SATELLITE_CAPSULE: string, RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHACS: string}, - * RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS: - * string, ORACLE: string}, RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string}, - * RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES: {DATE: string, HAS_DATA: string, VALUE: string, - * HAS_INFINITE_QUANTITY: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_META_TYPES: {TOTAL_MONTHLY: string, DATE: - * string, PRODUCT: string, HAS_CLOUDIGRADE_DATA: string, HAS_CLOUDIGRADE_MISMATCH: string, HAS_DATA: string, - * METRIC_ID: string, COUNT: string, VALUE: string}, RHSM_API_QUERY_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: - * string, RED_HAT: string, NONE: string, AWS: string, ORACLE: string}, RHSM_API_QUERY_CATEGORY_TYPES: {CLOUD: - * string, PHYSICAL: string, ON_DEMAND: string, HYPERVISOR: string, PREPAID: string, VIRTUAL: string}, - * RHSM_API_QUERY_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, DEVELOPMENT: string, PRODUCTION: string}, - * RHSM_API_QUERY_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: string, STANDARD: string}, - * RHSM_API_QUERY_SET_INVENTORY_TYPES: {BILLING_ACCOUNT_ID: string, DIRECTION: string, END_DATE: string, SLA: - * string, LIMIT: string, START_DATE: string, DISPLAY_NAME: string, UOM: string, USAGE: string, CATEGORY: string, - * SORT: string, OFFSET: string, BILLING_PROVIDER: string}, RHSM_API_RESPONSE_ERRORS: string, - * RHSM_API_QUERY_UOM_TYPES: {CORES: string, SOCKETS: string}, RHSM_API_RESPONSE_META: string, + * {RHEL_ARM: string, OPENSHIFT_METRICS: string, RHEL_X86_EUS: string, RHEL_WORKSTATION: string, RHEL_X86_SAP: + * string, RHODS: string, ROSA: string, RHEL_X86: string, RHEL_COMPUTE_NODE: string, RHEL_X86_ELS_PAYG: string, + * OPENSHIFT: string, SATELLITE_SERVER: string, OPENSHIFT_DEDICATED_METRICS: string, SATELLITE_CAPSULE: string, + * RHEL_IBM_Z: string, RHEL_IBM_POWER: string, RHACS: string}, RHSM_API_RESPONSE_BILLING_PROVIDER_TYPES: {AZURE: + * string, GCP: string, RED_HAT: string, NONE: string, AWS: string, ORACLE: string}, + * RHSM_API_RESPONSE_ERRORS_TYPES: {CODE: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_DATA_TYPES: {DATE: string, + * HAS_DATA: string, VALUE: string, HAS_INFINITE_QUANTITY: string}, RHSM_API_RESPONSE_TALLY_CAPACITY_META_TYPES: + * {TOTAL_MONTHLY: string, DATE: string, PRODUCT: string, HAS_CLOUDIGRADE_DATA: string, HAS_CLOUDIGRADE_MISMATCH: + * string, HAS_DATA: string, METRIC_ID: string, COUNT: string, VALUE: string}, + * RHSM_API_QUERY_BILLING_PROVIDER_TYPES: {AZURE: string, GCP: string, RED_HAT: string, NONE: string, AWS: string, + * ORACLE: string}, RHSM_API_QUERY_CATEGORY_TYPES: {CLOUD: string, PHYSICAL: string, ON_DEMAND: string, HYPERVISOR: + * string, PREPAID: string, VIRTUAL: string}, RHSM_API_QUERY_USAGE_TYPES: {UNSPECIFIED: string, DISASTER: string, + * DEVELOPMENT: string, PRODUCTION: string}, RHSM_API_QUERY_SLA_TYPES: {PREMIUM: string, SELF: string, NONE: + * string, STANDARD: string}, RHSM_API_QUERY_SET_INVENTORY_TYPES: {BILLING_ACCOUNT_ID: string, DIRECTION: string, + * END_DATE: string, SLA: string, LIMIT: string, START_DATE: string, DISPLAY_NAME: string, UOM: string, USAGE: + * string, CATEGORY: string, SORT: string, OFFSET: string, BILLING_PROVIDER: string}, RHSM_API_RESPONSE_ERRORS: + * string, RHSM_API_QUERY_UOM_TYPES: {CORES: string, SOCKETS: string}, RHSM_API_RESPONSE_META: string, * RHSM_API_RESPONSE_GRANULARITY_TYPES: {WEEKLY: string, QUARTERLY: string, DAILY: string, MONTHLY: string}, * RHSM_API_QUERY_SET_TYPES: {GRANULARITY: string, BILLING_ACCOUNT_ID: string, DIRECTION: string, END_DATE: string, * SLA: string, LIMIT: string, START_DATE: string, DISPLAY_NAME: string, USE_RUNNING_TOTALS_FORMAT: string, diff --git a/src/services/rhsm/rhsmServices.js b/src/services/rhsm/rhsmServices.js index 658c3f06e..7b8716945 100644 --- a/src/services/rhsm/rhsmServices.js +++ b/src/services/rhsm/rhsmServices.js @@ -992,7 +992,7 @@ const getApiVersion = (options = {}) => { /** * @apiMock {DelayResponse} 250 * @apiMock {RandomSuccess} - * @api {get} /api/rhsm-subscriptions/v1/tally/products/:product_id/Instance-hours Get RHSM graph data + * @api {get} /api/rhsm-subscriptions/v1/tally/products/:product_id/:metric_id Get RHSM graph data * @apiDescription Retrieve graph data. * * @apiSuccessExample {json} DAILY, Success-Response: diff --git a/tests/__snapshots__/dist.test.js.snap b/tests/__snapshots__/dist.test.js.snap index b2793dc30..70e3f7454 100644 --- a/tests/__snapshots__/dist.test.js.snap +++ b/tests/__snapshots__/dist.test.js.snap @@ -206,6 +206,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -228,6 +229,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -250,6 +252,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -272,6 +275,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -294,6 +298,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -316,6 +321,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -338,6 +344,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -360,6 +367,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -382,6 +390,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -404,6 +413,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -426,6 +436,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -519,6 +530,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [ @@ -576,6 +588,7 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productId": [ "RHEL for x86", + "rhel-for-x86-els-payg", "Satellite Server", ], "productVariants": [