Skip to content

Commit

Permalink
feat(rhsmServices,redux): ent-4366 tally refactor for metric id
Browse files Browse the repository at this point in the history
* build, joi schema validation for rhsm
* dotenv, tally endpoint for metric id
* locale, string key updates, match rhsm casing
* toolbarFields, string key updates
* redux, actions, selector, reducer, helpers, rhsm tally refactor, string keys
* services, config, apply schema validation, plus caching
* services, rhsm, breakout schemas, constants, ajax calls
* rhsmApiTypes, move towards constants under rhsm services
  • Loading branch information
cdcabrera committed Nov 3, 2021
1 parent 2e2e994 commit 1c7ed03
Show file tree
Hide file tree
Showing 50 changed files with 3,073 additions and 410 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ REACT_APP_CONFIG_SERVICE_LOCALES_EXPIRE=604800000

REACT_APP_SERVICES_RHSM_VERSION=/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT=/api/rhsm-subscriptions/v1/tally/products/
REACT_APP_SERVICES_RHSM_TALLY=/api/rhsm-subscriptions/v1/tally/products/{0}/{1}
REACT_APP_SERVICES_RHSM_CAPACITY=/api/rhsm-subscriptions/v1/capacity/products/
REACT_APP_SERVICES_RHSM_INVENTORY=/api/rhsm-subscriptions/v1/hosts/products/
REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS=/api/rhsm-subscriptions/v1/hosts/{0}/guests
Expand Down
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ REACT_APP_ENV=development

REACT_APP_SERVICES_RHSM_VERSION=http://localhost:5000/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/
REACT_APP_SERVICES_RHSM_TALLY=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/{0}/{1}
REACT_APP_SERVICES_RHSM_CAPACITY=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/
REACT_APP_SERVICES_RHSM_INVENTORY=http://localhost:5000/api/rhsm-subscriptions/v1/hosts/products/
REACT_APP_SERVICES_RHSM_INVENTORY_GUESTS=//localhost:5000/api/rhsm-subscriptions/v1/hosts/{0}/guests
Expand Down
2 changes: 2 additions & 0 deletions config/cspell.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dismissable",
"fadein",
"flyout",
"gibibytes",
"generatedid",
"HHmmss",
"hoverable",
Expand Down Expand Up @@ -44,6 +45,7 @@
"redhat",
"reselect's",
"rhel",
"rhosak",
"rhsm",
"select's",
"spandx",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"test:local": "jest --roots=./src --watch"
},
"dependencies": {
"@joi/date": "^2.1.0",
"@patternfly/patternfly": "4.135.2",
"@patternfly/react-charts": "6.15.23",
"@patternfly/react-core": "4.157.3",
Expand All @@ -89,6 +90,7 @@
"classnames": "^2.3.1",
"i18next": "^20.4.0",
"i18next-xhr-backend": "^3.2.2",
"joi": "^17.4.2",
"js-cookie": "^3.0.1",
"locale-code": "^2.0.2",
"lodash": "^4.17.21",
Expand Down
14 changes: 7 additions & 7 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,16 @@
"placeholder_filter_sla": "Filter by SLA",
"placeholder_filter_uom": "Filter by unit",
"placeholder_filter_usage": "Filter by usage",
"granularity_daily": "Daily",
"granularity_weekly": "Weekly",
"granularity_monthly": "Monthly",
"granularity_quarterly": "Quarterly",
"granularity_Daily": "Daily",
"granularity_Weekly": "Weekly",
"granularity_Monthly": "Monthly",
"granularity_Quarterly": "Quarterly",
"granularityRangedMonthly": "{{context}}",
"granularityRangedMonthly_current": "This month",
"sla_none": "No SLA",
"sla_premium": "Premium",
"sla_self-support": "Self-Support",
"sla_standard": "Standard",
"sla_Premium": "Premium",
"sla_Self-Support": "Self-Support",
"sla_Standard": "Standard",
"uom_cores": "Cores",
"uom_sockets": "Sockets",
"usage_Development/Test": "Development/Test",
Expand Down
8 changes: 4 additions & 4 deletions src/common/__tests__/__snapshots__/dateHelpers.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -381,28 +381,28 @@ Object {
exports[`DateHelpers should return a predictable range based on granularity: granularity range of time 1`] = `
Array [
Object {
"granularity": "daily",
"granularity": "Daily",
"range": Object {
"endDate": 2019-07-20T23:59:59.999Z,
"startDate": 2019-06-20T00:00:00.000Z,
},
},
Object {
"granularity": "weekly",
"granularity": "Weekly",
"range": Object {
"endDate": 2019-07-14T23:59:59.999Z,
"startDate": 2019-04-21T00:00:00.000Z,
},
},
Object {
"granularity": "monthly",
"granularity": "Monthly",
"range": Object {
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2018-07-01T00:00:00.000Z,
},
},
Object {
"granularity": "quarterly",
"granularity": "Quarterly",
"range": Object {
"endDate": 2019-07-01T23:59:59.999Z,
"startDate": 2016-07-01T00:00:00.000Z,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ exports[`GraphCardChart Component should render a basic component: basic 1`] = `
chartLegend={[Function]}
chartTooltip={[Function]}
dataSets={Array []}
key="chart_{\\"granularity\\":\\"daily\\"}"
key="chart_{\\"granularity\\":\\"Daily\\"}"
padding={
Object {
"bottom": 75,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Object {
exports[`ProductViewContext should apply a hook for retrieving product context: product context, uom filtering cores 1`] = `
Object {
"graphTallyQuery": Object {
"granularity": "daily",
"granularity": "Daily",
},
"initialGraphFilters": Array [
Object {
Expand Down Expand Up @@ -147,7 +147,7 @@ Object {
exports[`ProductViewContext should apply a hook for retrieving product context: product context, uom filtering sockets 1`] = `
Object {
"graphTallyQuery": Object {
"granularity": "daily",
"granularity": "Daily",
},
"initialGraphFilters": Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Object {
"productConfig": Array [
Object {
"graphTallyQuery": Object {
"granularity": "daily",
"granularity": "Daily",
},
"initialGraphFilters": Array [
Object {
Expand Down Expand Up @@ -176,7 +176,7 @@ Object {
},
Object {
"graphTallyQuery": Object {
"granularity": "daily",
"granularity": "Daily",
},
"initialGraphFilters": Array [
Object {
Expand Down Expand Up @@ -258,7 +258,7 @@ exports[`Redirect Component should render a basic component: basic 1`] = `
"productConfig": Array [
Object {
"graphTallyQuery": Object {
"granularity": "daily",
"granularity": "Daily",
},
"initialGraphFilters": Array [
Object {
Expand Down
38 changes: 19 additions & 19 deletions src/components/toolbar/__tests__/__snapshots__/toolbar.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ exports[`Toolbar Component should handle updating toolbar chips: chips 1`] = `
categoryName="t(curiosity-toolbar.category, {\\"context\\":\\"sla\\"})"
chips={
Array [
"t(curiosity-toolbar.sla, {\\"context\\":\\"premium\\"})",
"t(curiosity-toolbar.sla, {\\"context\\":\\"Premium\\"})",
]
}
deleteChip={[Function]}
Expand All @@ -43,18 +43,18 @@ exports[`Toolbar Component should handle updating toolbar chips: chips 1`] = `
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"premium\\"})",
"value": "premium",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Premium\\"})",
"value": "Premium",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"standard\\"})",
"value": "standard",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Standard\\"})",
"value": "Standard",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"self-support\\"})",
"value": "self-support",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Self-Support\\"})",
"value": "Self-Support",
},
Object {
"selected": false,
Expand Down Expand Up @@ -113,18 +113,18 @@ exports[`Toolbar Component should hide categories when a single filter is availa
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"premium\\"})",
"value": "premium",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Premium\\"})",
"value": "Premium",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"standard\\"})",
"value": "standard",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Standard\\"})",
"value": "Standard",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"self-support\\"})",
"value": "self-support",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Self-Support\\"})",
"value": "Self-Support",
},
Object {
"selected": false,
Expand Down Expand Up @@ -190,18 +190,18 @@ exports[`Toolbar Component should render a basic component: basic 1`] = `
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"premium\\"})",
"value": "premium",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Premium\\"})",
"value": "Premium",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"standard\\"})",
"value": "standard",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Standard\\"})",
"value": "Standard",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"self-support\\"})",
"value": "self-support",
"title": "t(curiosity-toolbar.sla, {\\"context\\":\\"Self-Support\\"})",
"value": "Self-Support",
},
Object {
"selected": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ exports[`ToolbarFieldGranularity Component should export select options: toolbar
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Daily\\"})",
"value": "Daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Weekly\\"})",
"value": "Weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Monthly\\"})",
"value": "Monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Quarterly\\"})",
"value": "Quarterly",
},
]
`;
Expand All @@ -34,7 +34,7 @@ Array [
"viewId": undefined,
},
Object {
"granularity": "daily",
"granularity": "Daily",
"type": "SET_QUERY_RHSM_granularity",
"viewId": undefined,
},
Expand Down Expand Up @@ -98,29 +98,29 @@ exports[`ToolbarFieldGranularity Component should render a basic component: basi
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Daily\\"})",
"value": "Daily",
},
Object {
"selected": true,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Weekly\\"})",
"value": "Weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Monthly\\"})",
"value": "Monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"Quarterly\\"})",
"value": "Quarterly",
},
]
}
placeholder="t(curiosity-toolbar.placeholder, {\\"context\\":\\"granularity\\"})"
position="left"
selectedOptions="weekly"
selectedOptions="Weekly"
toggleIcon={null}
variant="single"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Array [
"viewId": undefined,
},
Object {
"granularity": "daily",
"granularity": "Daily",
"type": "SET_QUERY_RHSM_granularity",
"viewId": undefined,
},
Expand Down Expand Up @@ -283,7 +283,7 @@ Array [
"viewId": "loremIpsum",
},
Object {
"granularity": "daily",
"granularity": "Daily",
"type": "SET_QUERY_RHSM_granularity",
"viewId": "loremIpsum",
},
Expand Down
Loading

0 comments on commit 1c7ed03

Please sign in to comment.