Skip to content

Commit

Permalink
refactor(config): sw-690 rhel, satellite, openshift metric graph (#1002)
Browse files Browse the repository at this point in the history
* config, rhel, satellite, openshift move to metric graph
* toolbar, allow anything secondary fields
* graphCardChart, cardHelpers, adjust callback data
* productView, hosts, updated table condition
* productViewContext, metric vs id uom filter
  • Loading branch information
cdcabrera committed Nov 17, 2022
1 parent a7a73a3 commit 071f72e
Show file tree
Hide file tree
Showing 41 changed files with 788 additions and 1,536 deletions.
29 changes: 28 additions & 1 deletion public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"curiosity-graph": {
"cardActionTotal": "{{total}} used",
"cardActionTotal_Cores": "{{total}} core hours used",
"cardActionTotal_coreHours": "{{total}} core hours used",
"cardHeading": "CPU usage",
"cardHeading_cores": "CPU core usage",
Expand Down Expand Up @@ -75,10 +76,20 @@
"label_cores_OpenShift-metrics": "Cores",
"label_cores_OpenShift-dedicated-metrics": "Cores",
"label_Cores": "vCPU hours",
"label_Cores_OpenShift Container Platform": "Cores",
"label_Cores_OpenShift-metrics": "Core hours",
"label_Cores_OpenShift-dedicated-metrics": "Core hours",
"label_Cores_cloud": "Public cloud",
"label_Cores_hypervisor": "Virtualized {{product}}",
"label_Cores_physical": "Physical cores",
"label_coreHours": "Core hours",
"label_instanceHours": "Instance hours",
"label_Instance-hours": "Instance hours",
"label_sockets": "Sockets",
"label_Sockets": "Sockets",
"label_Sockets_cloud": "Public cloud",
"label_Sockets_hypervisor": "Virtualized {{product}}",
"label_Sockets_physical": "Physical {{product}}",
"label_cloudSockets": "Public cloud",
"label_hypervisorCores": "Virtualized cores",
"label_hypervisorSockets": "Virtualized {{product}}",
Expand All @@ -91,6 +102,8 @@
"label_Storage-gibibyte-months": "Data storage",
"label_threshold": "Subscription threshold",
"label_threshold_infinite": "<0>unlimited</0>",
"label_threshold_Cores": "Subscription threshold",
"label_threshold_Sockets": "Subscription threshold",
"label_thresholdCores": "Subscription threshold",
"label_thresholdSockets": "Subscription threshold",
"label_Transfer-gibibytes": "Data transfer",
Expand All @@ -100,9 +113,13 @@
"legendTooltip_cores_OpenShift-metrics": "{{product}} CPU usage, per CPU core.",
"legendTooltip_cores_OpenShift-dedicated-metrics": "{{product}} CPU usage, per CPU core.",
"legendTooltip_Cores": "vCPU hours usage",
"legendTooltip_Cores_OpenShift Container Platform": "{{product}} CPU usage, per CPU core.",
"legendTooltip_Cores_OpenShift-metrics": "OpenShift Container Platform <0>On-Demand</0> core hour usage.",
"legendTooltip_Cores_OpenShift-dedicated-metrics": "OpenShift Dedicated <0>On-Demand</0> core hour usage.",
"legendTooltip_coreHours": "{{product}} core hours usage.",
"legendTooltip_coreHours_OpenShift-dedicated-metrics": "OpenShift Dedicated <0>On-Demand</0> core hour usage.",
"legendTooltip_Instance-hours": "Instance hours usage",
"legendTooltip_Instance-hours_OpenShift-dedicated-metrics": "OpenShift Dedicated <0>On-Demand</0> instance hour usage.",
"legendTooltip_instanceHours_OpenShift-dedicated-metrics": "OpenShift Dedicated <0>On-Demand</0> instance hour usage.",
"legendTooltip_coreHours_OpenShift-metrics": "OpenShift Container Platform <0>On-Demand</0> core hour usage.",
"legendTooltip_cloudSockets": "Public cloud {{product}} CPU usage, 1 CPU socket per instance.",
Expand All @@ -112,12 +129,22 @@
"legendTooltip_physicalCores": "{{product}} CPU usage, per CPU core.",
"legendTooltip_physicalSockets": "{{product}} CPU socket usage, per socket pair.",
"legendTooltip_physicalSockets_RHEL": "Physical {{product}} CPU usage, per socket pair. Each system's socket count is rounded upwards to the next even number.",
"legendTooltip_Sockets": "{{product}} CPU usage, per CPU socket pair.",
"legendTooltip_Sockets_cloud": "Public cloud {{product}} CPU usage, 1 CPU socket per instance.",
"legendTooltip_Sockets_hypervisor": "{{product}} CPU socket usage, per socket pair.",
"legendTooltip_Sockets_hypervisor_RHEL": "Virtualized {{product}} CPU usage, per socket. Hypervisor guest usage with known host-guest mappings (such as multi-guest VDC subscriptions), per socket pair of the hypervisor host, using the same method as physical {{product}}.",
"legendTooltip_Sockets_physical": "{{product}} CPU socket usage, per socket pair.",
"legendTooltip_Sockets_physical_RHEL": "Physical {{product}} CPU usage, per socket pair. Each system's socket count is rounded upwards to the next even number.",
"legendTooltip_sockets": "{{product}} CPU usage, per CPU socket pair.",
"legendTooltip_Storage-gibibytes": "Data storage usage",
"legendTooltip_Storage-gibibyte-months": "Data storage usage",
"legendTooltip_threshold_Cores_OpenShift Container Platform": "Maximum capacity, as CPU cores, based on total {{product}} Annual subscriptions in this account.",
"legendTooltip_threshold_Sockets": "Maximum capacity, based on total {{product}} subscriptions in this account.",
"legendTooltip_threshold_Sockets_OpenShift Container Platform": "Maximum capacity, as CPU sockets, based on total {{product}} Annual subscriptions in this account.",
"legendTooltip_threshold_Sockets_RHEL": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
"legendTooltip_thresholdCores_OpenShift Container Platform": "Maximum capacity, as CPU cores, based on total {{product}} Annual subscriptions in this account.",
"legendTooltip_thresholdSockets": "Maximum capacity, based on total {{product}} subscriptions in this account.",
"legendTooltip_thresholdSockets_RHEL": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
"legendTooltip_thresholdCores_OpenShift Container Platform": "Maximum capacity, as CPU cores, based on total {{product}} Annual subscriptions in this account.",
"legendTooltip_thresholdSockets_OpenShift Container Platform": "Maximum capacity, as CPU sockets, based on total {{product}} Annual subscriptions in this account.",
"legendTooltip_threshold_thresholdSockets": "Maximum capacity, based on total {{product}} subscriptions in this account.",
"legendTooltip_threshold_thresholdSockets_RHEL": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ exports[`Authentication Component should return a redirect on 418 error: 418 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftContainer",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-container",
Expand All @@ -378,7 +378,7 @@ exports[`Authentication Component should return a redirect on 418 error: 418 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftDedicated",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-dedicated",
Expand Down Expand Up @@ -528,7 +528,7 @@ exports[`Authentication Component should return a redirect on a specific 403 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftContainer",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-container",
Expand All @@ -537,7 +537,7 @@ exports[`Authentication Component should return a redirect on a specific 403 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftDedicated",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-dedicated",
Expand Down Expand Up @@ -687,7 +687,7 @@ exports[`Authentication Component should return a redirect on a specific 403 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftContainer",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-container",
Expand All @@ -696,7 +696,7 @@ exports[`Authentication Component should return a redirect on a specific 403 err
},
{
"activateOnError": false,
"component": "productView/productViewOpenShiftDedicated",
"component": "productView/productView",
"disabled": false,
"exact": true,
"id": "openshift-dedicated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports[`GraphCard Component should render a basic component: basic 1`] = `
"metric": undefined,
"metrics": [
{
"chartType": "area",
"id": "Core-seconds",
"isCapacity": false,
"isStacked": true,
Expand Down Expand Up @@ -46,6 +47,7 @@ exports[`GraphCard Component should setup basic settings: settings 1`] = `
"metric": undefined,
"metrics": [
{
"chartType": "area",
"id": "Core-seconds",
"isCapacity": false,
"isStacked": true,
Expand Down Expand Up @@ -74,6 +76,7 @@ exports[`GraphCard Component should setup basic settings: settings 1`] = `
"settings": {
"isStandalone": true,
"metric": {
"chartType": "area",
"id": "Sockets",
"isCapacity": false,
"isStacked": true,
Expand All @@ -84,6 +87,7 @@ exports[`GraphCard Component should setup basic settings: settings 1`] = `
},
"metrics": [
{
"chartType": "area",
"id": "Sockets",
"isCapacity": false,
"isStacked": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`GraphCardHelpers generateChartSettings should return base graph setting
"metric": undefined,
"metrics": [
{
"chartType": "area",
"dolor": "sit",
"id": "dolorSit",
"isCapacity": false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/graphCard/graphCardChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ const GraphCardChart = ({
const { actionDisplay, isStandalone, metric } = settings;

const { [RHSM_API_QUERY_SET_TYPES.GRANULARITY]: granularity } = useAliasProductGraphTallyQuery();
const { pending, error, data = {}, dataSets = [] } = useAliasGetMetrics();
const { pending, error, dataSets = [] } = useAliasGetMetrics();

let updatedActionDisplay = null;

if (typeof actionDisplay === 'function') {
updatedActionDisplay = actionDisplay({ data: { ...data } });
updatedActionDisplay = actionDisplay({ data: dataSets });
}

return (
Expand Down
3 changes: 2 additions & 1 deletion src/components/graphCard/graphCardHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ const generateChartSettings = ({ filters = [], settings: graphCardSettings = {},
if (!metric) {
return;
}

const updatedChartType = filterSettings?.chartType || ChartTypeVariant.area;
const isThreshold = filterSettings?.chartType === ChartTypeVariant.threshold;
const baseFilterSettings = {
chartType: updatedChartType,
id: generateChartIds({ isCapacity: isThreshold, metric, productId, query: filterSettings?.query }),
isStacked: !isThreshold,
isStandalone,
Expand Down
29 changes: 2 additions & 27 deletions src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -319,31 +319,6 @@ exports[`I18n Component should generate a predictable locale key output snapshot
},
],
},
{
"file": "./src/components/productView/productViewOpenShiftContainer.js",
"keys": [
{
"key": "curiosity-graph.cardHeading",
"match": "t('curiosity-graph.cardHeading', { context: productId })",
},
{
"key": "curiosity-graph.cardHeadingDescription",
"match": "t('curiosity-graph.cardHeadingDescription', { context: productId })",
},
{
"key": "curiosity-inventory.tabHosts",
"match": "t('curiosity-inventory.tabHosts', { context: [productId] })",
},
{
"key": "curiosity-inventory.tabSubscriptions",
"match": "t('curiosity-inventory.tabSubscriptions', { context: productId })",
},
{
"key": "curiosity-view.title",
"match": "t(\`curiosity-view.title\`, { appName: helpers.UI_DISPLAY_NAME, context: viewProductLabel })",
},
],
},
{
"file": "./src/components/table/table.js",
"keys": [
Expand Down Expand Up @@ -565,7 +540,7 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"keys": [
{
"key": "curiosity-graph.cardActionTotal",
"match": "translate('curiosity-graph.cardActionTotal', { context: 'coreHours', total: helpers .numberDisplay(totalCoreHours)",
"match": "translate('curiosity-graph.cardActionTotal', { context: id, total: helpers .numberDisplay(totalMonthlyValue)",
},
{
"key": "curiosity-inventory.label",
Expand All @@ -578,7 +553,7 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"keys": [
{
"key": "curiosity-graph.cardActionTotal",
"match": "translate('curiosity-graph.cardActionTotal', { context: 'coreHours', total: helpers .numberDisplay(totalCoreHours)",
"match": "translate('curiosity-graph.cardActionTotal', { context: id, total: helpers .numberDisplay(totalMonthlyValue)",
},
{
"key": "curiosity-inventory.label",
Expand Down
Loading

0 comments on commit 071f72e

Please sign in to comment.