From 9016c07d7d2735a458940a22171c481fe6cfc2c8 Mon Sep 17 00:00:00 2001 From: CD Cabrera Date: Thu, 19 Sep 2024 15:34:44 -0400 Subject: [PATCH] fix(config): sw-2932 ansible, on-demand graph displays (#1419) --- public/locales/en-US.json | 5 +-- .../__snapshots__/product.config.test.js.snap | 38 +++++++++++++++++-- src/config/product.ansible.js | 26 +++++++++++-- tests/__snapshots__/dist.test.js.snap | 11 ++++++ 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/public/locales/en-US.json b/public/locales/en-US.json index 21e24600a..ed29e516e 100644 --- a/public/locales/en-US.json +++ b/public/locales/en-US.json @@ -99,9 +99,8 @@ "label_Instance-hours": "Instance hours", "label_Instance-hours_on-demand": "$t(curiosity-graph.label_Cores_on-demand)", "label_Instance-hours_prepaid": "$t(curiosity-graph.label_Cores_prepaid)", - "label_Instance-hours_prepaid_ansible-aap-managed": "Infrastructure hours", - "label_Managed-nodes_on-demand": "Monthly On-Demand", - "label_Managed-nodes_prepaid": "Managed nodes", + "label_Managed-nodes_on-demand": "$t(curiosity-graph.label_Cores_on-demand)", + "label_Managed-nodes_prepaid": "$t(curiosity-graph.label_Cores_prepaid)", "label_Sockets": "Sockets", "label_Sockets_cloud": "Public cloud", "label_Sockets_hypervisor": "Hypervisor", diff --git a/src/config/__tests__/__snapshots__/product.config.test.js.snap b/src/config/__tests__/__snapshots__/product.config.test.js.snap index c3d3c45e5..22573b1b4 100644 --- a/src/config/__tests__/__snapshots__/product.config.test.js.snap +++ b/src/config/__tests__/__snapshots__/product.config.test.js.snap @@ -1808,7 +1808,6 @@ exports[`Product specific configurations should apply graph filters and settings "header": [Function], }, ], - "chartType": "line", "color": "#06c", "fill": "#8bc1f7", "groupMetric": [ @@ -1821,7 +1820,7 @@ exports[`Product specific configurations should apply graph filters and settings "metric": undefined, "metrics": [ { - "chartType": "line", + "chartType": "area", "color": "#06c", "fill": "#8bc1f7", "id": "Managed-nodes_prepaid_ansible-aap-managed", @@ -1836,6 +1835,22 @@ exports[`Product specific configurations should apply graph filters and settings "stroke": "#06c", "strokeWidth": 2, }, + { + "chartType": "area", + "color": "#f0ab00", + "fill": "#f0ab00", + "id": "Managed-nodes_on-demand_ansible-aap-managed", + "isCapacity": false, + "isStacked": true, + "isThreshold": false, + "isToolbarFilter": false, + "metric": "Managed-nodes", + "query": { + "billing_category": "on-demand", + }, + "stroke": "#f0ab00", + "strokeWidth": 2, + }, { "chartType": "threshold", "id": "threshold_Managed-nodes_ansible-aap-managed", @@ -1876,7 +1891,6 @@ exports[`Product specific configurations should apply graph filters and settings "header": [Function], }, ], - "chartType": "line", "color": "#06c", "fill": "#8bc1f7", "groupMetric": [ @@ -1889,7 +1903,7 @@ exports[`Product specific configurations should apply graph filters and settings "metric": undefined, "metrics": [ { - "chartType": "line", + "chartType": "area", "color": "#06c", "fill": "#8bc1f7", "id": "Instance-hours_prepaid_ansible-aap-managed", @@ -1904,6 +1918,22 @@ exports[`Product specific configurations should apply graph filters and settings "stroke": "#06c", "strokeWidth": 2, }, + { + "chartType": "area", + "color": "#f0ab00", + "fill": "#f0ab00", + "id": "Instance-hours_on-demand_ansible-aap-managed", + "isCapacity": false, + "isStacked": true, + "isThreshold": false, + "isToolbarFilter": false, + "metric": "Instance-hours", + "query": { + "billing_category": "on-demand", + }, + "stroke": "#f0ab00", + "strokeWidth": 2, + }, { "chartType": "threshold", "id": "threshold_Instance-hours_ansible-aap-managed", diff --git a/src/config/product.ansible.js b/src/config/product.ansible.js index bbd60fc1b..7221d4d4b 100644 --- a/src/config/product.ansible.js +++ b/src/config/product.ansible.js @@ -1,7 +1,9 @@ import React from 'react'; import { chart_color_blue_100 as chartColorBlueLight, - chart_color_blue_300 as chartColorBlueDark + chart_color_blue_300 as chartColorBlueDark, + chart_color_gold_400 as chartColorGoldDark, + chart_color_gold_400 as chartColorGoldLight } from '@patternfly/react-tokens'; import { Button } from '@patternfly/react-core'; import { DateFormat } from '@redhat-cloud-services/frontend-components/DateFormat'; @@ -63,7 +65,7 @@ const productLabel = RHSM_API_PATH_PRODUCT_TYPES.ANSIBLE; * initialInventoryFilters: Array}} */ const config = { - aliases: [], + aliases: ['ansible'], productGroup, productId, productLabel, @@ -102,11 +104,19 @@ const config = { fill: chartColorBlueLight.value, stroke: chartColorBlueDark.value, color: chartColorBlueDark.value, - chartType: ChartTypeVariant.line, query: { [RHSM_API_QUERY_SET_TYPES.BILLING_CATEGORY]: CATEGORY_TYPES.PREPAID } }, + { + metric: RHSM_API_PATH_METRIC_TYPES.MANAGED_NODES, + fill: chartColorGoldLight.value, + stroke: chartColorGoldDark.value, + color: chartColorGoldDark.value, + query: { + [RHSM_API_QUERY_SET_TYPES.BILLING_CATEGORY]: CATEGORY_TYPES.ON_DEMAND + } + }, { metric: RHSM_API_PATH_METRIC_TYPES.MANAGED_NODES, chartType: ChartTypeVariant.threshold @@ -120,11 +130,19 @@ const config = { fill: chartColorBlueLight.value, stroke: chartColorBlueDark.value, color: chartColorBlueDark.value, - chartType: ChartTypeVariant.line, query: { [RHSM_API_QUERY_SET_TYPES.BILLING_CATEGORY]: CATEGORY_TYPES.PREPAID } }, + { + metric: RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS, + fill: chartColorGoldLight.value, + stroke: chartColorGoldDark.value, + color: chartColorGoldDark.value, + query: { + [RHSM_API_QUERY_SET_TYPES.BILLING_CATEGORY]: CATEGORY_TYPES.ON_DEMAND + } + }, { metric: RHSM_API_PATH_METRIC_TYPES.INSTANCE_HOURS, chartType: ChartTypeVariant.threshold diff --git a/tests/__snapshots__/dist.test.js.snap b/tests/__snapshots__/dist.test.js.snap index 7f6010abc..18bd5fb5a 100644 --- a/tests/__snapshots__/dist.test.js.snap +++ b/tests/__snapshots__/dist.test.js.snap @@ -13,6 +13,17 @@ exports[`Build distribution should have a predictable ephemeral navigation based ], "productVariants": [], }, + { + "coverage": "FALSE", + "path": "/ansible", + "productGroup": [ + "ansible-aap-managed", + ], + "productId": [ + "ansible-aap-managed", + ], + "productVariants": [], + }, { "coverage": "TRUE", "path": "/openshift",