Skip to content

Commit

Permalink
refactor(table): sw-1537 migrate to pf composable table (#1168)
Browse files Browse the repository at this point in the history
* config, product inventory formats
* inventoryCard, convert towards standalone
* inventoryCardInstances, instances context
* inventoryCardSubscriptions, subs context
* inventoryGuests, API transformer for infinite scroll
* locale, string key formatting
* productView, flip to inventoryCardInstances
* table, refactor towards pf composable
* useReactRedux, shallow to deep equality
* rhsmServices, use guests, subs transformers
  • Loading branch information
cdcabrera committed Sep 19, 2023
1 parent 07de4a2 commit 1ed4e7b
Show file tree
Hide file tree
Showing 58 changed files with 8,256 additions and 5,877 deletions.
19 changes: 5 additions & 14 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,41 +221,32 @@
"header_Cores_OpenShift Container Platform": "Cores",
"header_Cores_OpenShift-metrics": "$t(curiosity-inventory.header_Cores_OpenShift Container Platform)",
"header_Cores_OpenShift-dedicated-metrics": "Core hours",
"header_core_hours": "Core hours",
"header_coreHours": "Core hours",
"header_displayName": "Name",
"header_display_name": "Name",
"header_display_name_rosa": "Name (control plane)",
"header_guests_display_name": "Guest name",
"header_hardwareType": "Type",
"header_instanceHours": "Instance hours",
"header_instance_hours": "Instance hours",
"header_Instance-hours": "Instance hours",
"header_Instance-hours_rosa": "Control plane hours",
"header_measurementType": "Type",
"header_measurement_type": "Type",
"header_number_of_guests": "Guests",
"header_inventory_id": "UUID",
"header_Sockets": "Sockets",
"header_Sockets_RHEL": "Capacity (sockets)",
"header_sockets": "Subscribed sockets",
"header_lastSeen": "Usage updated",
"header_last_seen": "Last seen",
"header_last_seen_RHEL": "Usage updated",
"header_next_event_date": "Next renewal",
"header_product_name": "Product",
"header_quantity": "Quantity",
"header_service_level": "Service level",
"header_Storage-gibibytes": "Data storage",
"header_Storage-gibibyte-months": "Data storage",
"header_subscriptions": "Sockets",
"header_subscriptions_cores": "Cores",
"header_subscriptions_sockets": "Sockets",
"header_subscriptions_Cores": "Cores",
"header_subscriptions_Sockets": "Sockets",
"header_subscription_type": "Subscription type",
"header_Transfer-gibibytes": "Data transfer",
"header_tooltip_Storage-gibibytes": "Measurements in binary gigabyte hours",
"header_tooltip_Storage-gibibyte-months": "Measurements in binary gigabyte months",
"header_tooltip_Transfer-gibibytes": "Measurements in binary gigabytes",
"guestsHeader_display_name": "Guest name",
"guestsHeader_inventory_id": "UUID",
"guestsHeader_last_seen": "Last seen",
"measurement_Cores": "{{total}} hours",
"measurement_Instance-hours": "{{total}} hours",
"measurement_Storage-gibibytes": "{{total}} GB hours",
Expand Down
947 changes: 623 additions & 324 deletions src/components/README.md

Large diffs are not rendered by default.

128 changes: 78 additions & 50 deletions src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"keys": [
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: [id, productId] })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: [key, productId] })",
"match": "translate([\`curiosity-inventory.header\`, \`curiosity-inventory.guestsHeader\`], { context: [metric, productId] })",
},
],
},
Expand Down Expand Up @@ -262,23 +258,15 @@ exports[`I18n Component should generate a predictable locale key output snapshot
],
},
{
"file": "src/components/table/table.js",
"file": "src/components/table/tableEmpty.js",
"keys": [
{
"key": "curiosity-inventory.tableEmptyInventoryTitle",
"match": "t('curiosity-inventory.tableEmptyInventoryTitle')",
},
{
"key": "curiosity-inventory.tableEmptyInventoryMessage",
"match": "t('curiosity-inventory.tableEmptyInventoryMessage')",
},
{
"key": "curiosity-inventory.tableAriaLabel",
"match": "t('curiosity-inventory.tableAriaLabel', { appName: helpers.UI_DISPLAY_NAME })",
"key": "table.empty-state_title",
"match": "t('table.empty-state_title', 'No results found')",
},
{
"key": "curiosity-inventory.tableSummary",
"match": "t('curiosity-inventory.tableSummary')",
"key": "table.empty-state_description",
"match": "t('table.empty-state_description', 'Clear all filters and try again.')",
},
],
},
Expand Down Expand Up @@ -523,24 +511,24 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"file": "src/config/product.openshiftContainer.js",
"keys": [
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests?.value }, [ <PfLabel color="blue" /> ])",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests }, [ <PfLabel color="blue" /> ])",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: [uom, productId] })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['subscriptions', uom?.value] })",
"match": "translate('curiosity-inventory.header', { context: ['subscriptions', uom] })",
},
{
"key": "",
"match": "translate( \`curiosity-inventory.label_\${SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY}\`, { context: uom?.value } )",
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY, uom] })",
},
],
},
Expand Down Expand Up @@ -584,12 +572,12 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"match": "translate('curiosity-graph.label_axisX', { context: GRANULARITY_TYPES.DAILY })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests?.value }, [ <PfLabel color="blue" /> ])",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests }, [ <PfLabel color="blue" /> ])",
},
],
},
Expand Down Expand Up @@ -629,12 +617,12 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"match": "translate('curiosity-graph.label_axisX', { context: GRANULARITY_TYPES.DAILY })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests?.value }, [ <PfLabel color="blue" /> ])",
"match": "translate('curiosity-inventory.label', { context: 'numberOfGuests', count: numberOfGuests }, [ <PfLabel color="blue" /> ])",
},
],
},
Expand Down Expand Up @@ -675,44 +663,44 @@ exports[`I18n Component should generate a predictable locale key output snapshot
},
{
"key": "",
"match": "translate(\`curiosity-inventory.label_\${INVENTORY_TYPES.BILLING_PROVIDER}\`, { context: provider?.value || 'none' })",
"match": "translate(\`curiosity-inventory.label_\${INVENTORY_TYPES.BILLING_PROVIDER}\`, { context: provider || 'none' })",
},
{
"key": "curiosity-inventory.measurement",
"match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.CORES, total: helpers.numberDisplay(total?.value)",
"match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.CORES, total: helpers.numberDisplay(total)",
},
{
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, provider?.value || 'none'] })",
"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 })",
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_META_TYPES.SUBSCRIPTION_TYPE, subscriptionType || EMPTY_CONTEXT] })",
},
],
},
{
"file": "src/config/product.rhel.js",
"keys": [
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CATEGORY, category?.value] })",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CATEGORY, category] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CLOUD_PROVIDER, cloudProvider?.value] })",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CLOUD_PROVIDER, cloudProvider] })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['subscriptions', uom?.value] })",
"match": "translate('curiosity-inventory.header', { context: ['subscriptions', uom] })",
},
{
"key": "",
"match": "translate( \`curiosity-inventory.label_\${SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY}\`, { context: uom?.value } )",
"match": "translate( \`curiosity-inventory.label_\${SUBSCRIPTIONS_INVENTORY_TYPES.HAS_INFINITE_QUANTITY}\`, { context: uom } )",
},
],
},
Expand Down Expand Up @@ -753,15 +741,15 @@ exports[`I18n Component should generate a predictable locale key output snapshot
},
{
"key": "",
"match": "translate(\`curiosity-inventory.label_\${INVENTORY_TYPES.BILLING_PROVIDER}\`, { context: provider?.value || 'none' })",
"match": "translate(\`curiosity-inventory.label_\${INVENTORY_TYPES.BILLING_PROVIDER}\`, { context: provider || 'none' })",
},
{
"key": "curiosity-inventory.measurement",
"match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.CORES, total: helpers.numberDisplay(total?.value)",
"match": "translate('curiosity-inventory.measurement', { context: RHSM_API_PATH_METRIC_TYPES.CORES, total: helpers.numberDisplay(total)",
},
{
"key": "curiosity-inventory.label",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, provider?.value || 'none'] })",
"match": "translate(\`curiosity-inventory.label\`, { context: [SUBSCRIPTIONS_INVENTORY_TYPES.BILLING_PROVIDER, provider || 'none'] })",
},
{
"key": "",
Expand Down Expand Up @@ -789,25 +777,25 @@ exports[`I18n Component should generate a predictable locale key output snapshot
"match": "translate('curiosity-graph.label_axisX', { context: GRANULARITY_TYPES.DAILY })",
},
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
],
},
{
"file": "src/config/product.satellite.js",
"keys": [
{
"key": "curiosity-inventory.header",
"match": "translate('curiosity-inventory.header', { context: ['guests', INVENTORY_TYPES.DISPLAY_NAME] })",
"key": "curiosity-inventory.guestsHeader",
"match": "translate('curiosity-inventory.guestsHeader', { context: [INVENTORY_TYPES.DISPLAY_NAME] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CATEGORY, category?.value] })",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CATEGORY, category] })",
},
{
"key": "curiosity-inventory.label",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CLOUD_PROVIDER, cloudProvider?.value] })",
"match": "translate('curiosity-inventory.label', { context: [INVENTORY_TYPES.CLOUD_PROVIDER, cloudProvider] })",
},
],
},
Expand Down Expand Up @@ -849,6 +837,14 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/components/inventoryCard/inventoryCard.js",
"key": "curiosity-inventory.tab",
},
{
"file": "src/components/table/tableEmpty.js",
"key": "table.empty-state_title",
},
{
"file": "src/components/table/tableEmpty.js",
"key": "table.empty-state_description",
},
{
"file": "src/components/toolbar/toolbar.js",
"key": "curiosity-toolbar.label",
Expand Down Expand Up @@ -925,6 +921,14 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/components/toolbar/toolbarFieldVariant.js",
"key": "curiosity-toolbar.label",
},
{
"file": "src/config/product.openshiftContainer.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.openshiftContainer.js",
"key": "curiosity-inventory.label",
},
{
"file": "src/config/product.openshiftContainer.js",
"key": "curiosity-inventory.label",
Expand All @@ -941,6 +945,10 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/config/product.openshiftDedicated.js",
"key": "curiosity-graph.label_axisX",
},
{
"file": "src/config/product.openshiftDedicated.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.openshiftDedicated.js",
"key": "curiosity-inventory.label",
Expand All @@ -953,6 +961,10 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/config/product.openshiftMetrics.js",
"key": "curiosity-graph.label_axisX",
},
{
"file": "src/config/product.openshiftMetrics.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.openshiftMetrics.js",
"key": "curiosity-inventory.label",
Expand All @@ -973,6 +985,14 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/config/product.rhacs.js",
"key": "curiosity-inventory.label",
},
{
"file": "src/config/product.rhacs.js",
"key": "curiosity-inventory.label",
},
{
"file": "src/config/product.rhel.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.rhel.js",
"key": "curiosity-inventory.label",
Expand Down Expand Up @@ -1001,6 +1021,14 @@ exports[`I18n Component should have locale keys that exist in the default langua
"file": "src/config/product.rosa.js",
"key": "curiosity-graph.label_axisX",
},
{
"file": "src/config/product.rosa.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.satellite.js",
"key": "curiosity-inventory.guestsHeader",
},
{
"file": "src/config/product.satellite.js",
"key": "curiosity-inventory.label",
Expand Down
Loading

0 comments on commit 1ed4e7b

Please sign in to comment.