Skip to content

Commit

Permalink
feat(rhelGraphCard): issues/80 activate threshold api (#108)
Browse files Browse the repository at this point in the history
* build, dotenv add version and capacity endpoints
* types, api and reducer level types for api capacity
* chartArea, fix area chart default color
* graphHelpers, index plus date match check, threshold check
* rhelGraphCard testing updates
* rhelActions, rhelGraphReducer, naming updates, streamline
* reduxHelpers, fix error messaging
* graphCardSelectors, aggregate multiple api responses
* rhelServices, add capacity api get, rename towards RHEL
* userServices, add api version get
  • Loading branch information
cdcabrera committed Oct 8, 2019
1 parent 80f6ef5 commit 252afc1
Show file tree
Hide file tree
Showing 32 changed files with 1,710 additions and 730 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ REACT_APP_CONFIG_SERVICE_LOCALES_EXPIRE=604800000
REACT_APP_INCLUDE_CONTENT_HEADER=<esi:include src="${UI_DEPLOY_PATH_PREFIX}/apps/chrome/snippets/head.html" />
REACT_APP_INCLUDE_CONTENT_BODY=<esi:include src="${UI_DEPLOY_PATH_PREFIX}/apps/chrome/snippets/body.html" />

REACT_APP_SERVICES_RHSM_VERSION=/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT_RHEL=/api/rhsm-subscriptions/v1/tally/products/RHEL
REACT_APP_SERVICES_RHSM_CAPACITY_RHEL=/api/rhsm-subscriptions/v1/capacity/products/RHEL
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ REACT_APP_INCLUDE_CONTENT_BODY=<div id="root"></div>
REACT_APP_CONFIG_SERVICE_LOCALES=./locales/locales.json
REACT_APP_CONFIG_SERVICE_LOCALES_PATH=./locales/{{lng}}.json

REACT_APP_SERVICES_RHSM_VERSION=http://localhost:5000/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT_RHEL=http://localhost:5000/api/rhsm-subscriptions/v1/tally/products/RHEL
REACT_APP_SERVICES_RHSM_CAPACITY_RHEL=http://localhost:5000/api/rhsm-subscriptions/v1/capacity/products/RHEL
2 changes: 2 additions & 0 deletions .env.proxy
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ REACT_APP_INCLUDE_CONTENT_BODY='<esi:include src="${UI_DEPLOY_PATH_PREFIX}/apps/
REACT_APP_CONFIG_SERVICE_LOCALES=/locales/locales.json
REACT_APP_CONFIG_SERVICE_LOCALES_PATH=/locales/{{lng}}.json

REACT_APP_SERVICES_RHSM_VERSION=/api/rhsm-subscriptions/v1/version
REACT_APP_SERVICES_RHSM_REPORT_RHEL=/api/rhsm-subscriptions/v1/tally/products/RHEL
REACT_APP_SERVICES_RHSM_CAPACITY_RHEL=/api/rhsm-subscriptions/v1/capacity/products/RHEL
194 changes: 109 additions & 85 deletions src/common/__tests__/__snapshots__/graphHelpers.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,7 @@ Object {
"y": 0,
},
],
"chartDataThresholds": Array [
Object {
"tooltip": "ipsum threshhold label: 10",
"x": 0,
"y": 10,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"x": 1,
"y": 10,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"x": 2,
"y": 10,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"x": 3,
"y": 10,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"x": 4,
"y": 10,
},
],
"chartDataThresholds": Array [],
"chartXAxisLabelIncrement": 5,
}
`;
Expand Down Expand Up @@ -185,48 +159,49 @@ Object {
}
`;

exports[`GraphHelpers should handle cross quarter labels: quarter granularity 1`] = `
exports[`GraphHelpers should convert graph data and threshold data: threshold check 1`] = `
Object {
"chartData": Array [
Object {
"tooltip": "5 lorem tooltip label Apr",
"tooltip": "5 lorem tooltip label Jun 1",
"x": 0,
"xAxisLabel": "Apr",
"xAxisLabel": "Jun 1",
"y": 5,
},
Object {
"tooltip": "0 lorem tooltip label Jul
-5 t('curiosity-graph.tooltipPreviousLabelQuarterly')",
"tooltip": "7 lorem tooltip label Jun 2
+2 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 1,
"xAxisLabel": "Jul",
"y": 0,
"xAxisLabel": "Jun 2",
"y": 7,
},
Object {
"tooltip": "0 lorem tooltip label Oct",
"tooltip": "3 lorem tooltip label Jun 3
-4 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 2,
"xAxisLabel": "Oct",
"y": 0,
"xAxisLabel": "Jun 3",
"y": 3,
},
Object {
"tooltip": "0 lorem tooltip label Jan 2019",
"tooltip": "0 lorem tooltip label Jun 4
-3 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 3,
"xAxisLabel": "Jan
2019",
"xAxisLabel": "Jun 4",
"y": 0,
},
Object {
"tooltip": "7 lorem tooltip label Apr
+7 t('curiosity-graph.tooltipPreviousLabelQuarterly')",
"tooltip": "1 lorem tooltip label Jun 5
+1 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 4,
"xAxisLabel": "Apr",
"y": 7,
"xAxisLabel": "Jun 5",
"y": 1,
},
],
"chartDataThresholds": Array [
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "ipsum threshhold label: 100",
"x": 0,
"y": 10,
"y": 100,
},
Object {
"tooltip": "ipsum threshhold label: 0",
Expand All @@ -244,99 +219,148 @@ Object {
"y": 0,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "ipsum threshhold label: 0",
"x": 4,
"y": 10,
"y": 0,
},
],
"chartXAxisLabelIncrement": 1,
"chartXAxisLabelIncrement": 5,
}
`;

exports[`GraphHelpers should handle cross year labels: cross year 1`] = `
exports[`GraphHelpers should convert graph data and threshold data: threshold check date and index mismatch from data 1`] = `
Object {
"chartData": Array [
Object {
"tooltip": "5 lorem tooltip label Dec 31",
"tooltip": "5 lorem tooltip label Jun 1",
"x": 0,
"xAxisLabel": "Dec 31",
"xAxisLabel": "Jun 1",
"y": 5,
},
Object {
"tooltip": "7 lorem tooltip label Jan 1
"tooltip": "7 lorem tooltip label Jun 2
+2 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 1,
"xAxisLabel": "Jan 1",
"xAxisLabel": "Jun 2",
"y": 7,
},
Object {
"tooltip": "7 lorem tooltip label Jan 2",
"tooltip": "3 lorem tooltip label Jun 3
-4 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 2,
"xAxisLabel": "Jan 2",
"y": 7,
"xAxisLabel": "Jun 3",
"y": 3,
},
Object {
"tooltip": "7 lorem tooltip label Jan 3",
"tooltip": "0 lorem tooltip label Jun 4
-3 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 3,
"xAxisLabel": "Jan 3",
"y": 7,
"xAxisLabel": "Jun 4",
"y": 0,
},
Object {
"tooltip": "7 lorem tooltip label Jan 4",
"tooltip": "1 lorem tooltip label Jun 5
+1 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 4,
"xAxisLabel": "Jan 4",
"y": 7,
"xAxisLabel": "Jun 5",
"y": 1,
},
],
"chartDataThresholds": Array [],
"chartXAxisLabelIncrement": 5,
}
`;

exports[`GraphHelpers should handle cross quarter labels: quarter granularity 1`] = `
Object {
"chartData": Array [
Object {
"tooltip": "7 lorem tooltip label Jan 5 2019",
"x": 5,
"xAxisLabel": "Jan 5 2019",
"y": 7,
"tooltip": "5 lorem tooltip label Apr",
"x": 0,
"xAxisLabel": "Apr",
"y": 5,
},
Object {
"tooltip": "7 lorem tooltip label Jan 6",
"x": 6,
"xAxisLabel": "Jan 6",
"tooltip": "0 lorem tooltip label Jul
-5 t('curiosity-graph.tooltipPreviousLabelQuarterly')",
"x": 1,
"xAxisLabel": "Jul",
"y": 0,
},
Object {
"tooltip": "0 lorem tooltip label Oct",
"x": 2,
"xAxisLabel": "Oct",
"y": 0,
},
Object {
"tooltip": "0 lorem tooltip label Jan 2019",
"x": 3,
"xAxisLabel": "Jan
2019",
"y": 0,
},
Object {
"tooltip": "7 lorem tooltip label Apr
+7 t('curiosity-graph.tooltipPreviousLabelQuarterly')",
"x": 4,
"xAxisLabel": "Apr",
"y": 7,
},
],
"chartDataThresholds": Array [
"chartDataThresholds": Array [],
"chartXAxisLabelIncrement": 1,
}
`;

exports[`GraphHelpers should handle cross year labels: cross year 1`] = `
Object {
"chartData": Array [
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "5 lorem tooltip label Dec 31",
"x": 0,
"y": 10,
"xAxisLabel": "Dec 31",
"y": 5,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 1
+2 t('curiosity-graph.tooltipPreviousLabelDaily')",
"x": 1,
"y": 10,
"xAxisLabel": "Jan 1",
"y": 7,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 2",
"x": 2,
"y": 10,
"xAxisLabel": "Jan 2",
"y": 7,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 3",
"x": 3,
"y": 10,
"xAxisLabel": "Jan 3",
"y": 7,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 4",
"x": 4,
"y": 10,
"xAxisLabel": "Jan 4",
"y": 7,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 5 2019",
"x": 5,
"y": 10,
"xAxisLabel": "Jan 5 2019",
"y": 7,
},
Object {
"tooltip": "ipsum threshhold label: 10",
"tooltip": "7 lorem tooltip label Jan 6",
"x": 6,
"y": 10,
"xAxisLabel": "Jan 6",
"y": 7,
},
],
"chartDataThresholds": Array [],
"chartXAxisLabelIncrement": 5,
}
`;
Expand Down
Loading

0 comments on commit 252afc1

Please sign in to comment.