Skip to content

Commit

Permalink
fix(rhsmApiTypes): issues/161 expand rhsm types
Browse files Browse the repository at this point in the history
* rhsmApiTypes, expanded rhsm response types
* routerTypes, update product ids
* rhelGraphCard, update default product id, rhsm types
* rhelGraphCardHelpers, expanded rhsm types for tooltips
* graphCardSelectors, expand towards additional rhsm types
  • Loading branch information
cdcabrera committed Dec 16, 2019
1 parent 26110ca commit e4430bb
Show file tree
Hide file tree
Showing 11 changed files with 366 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports[`RhelGraphCard Component should render a non-connected component: non-co
},
"data": Array [],
"fill": "#8bc1f7",
"id": "sockets",
"id": "physicalSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productSocketsLabel, [object Object])",
"stroke": "#06c",
Expand All @@ -73,7 +73,7 @@ exports[`RhelGraphCard Component should render a non-connected component: non-co
},
"data": Array [],
"fill": "#a2d9d9",
"id": "hypervisor",
"id": "hypervisorSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productHypervisorLabel, [object Object])",
"stroke": "#009596",
Expand Down Expand Up @@ -143,7 +143,7 @@ Object {
},
],
"fill": "#8bc1f7",
"id": "sockets",
"id": "physicalSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productSocketsLabel, [object Object])",
"stroke": "#06c",
Expand All @@ -157,7 +157,7 @@ Object {
},
"data": undefined,
"fill": "#a2d9d9",
"id": "hypervisor",
"id": "hypervisorSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productHypervisorLabel, [object Object])",
"stroke": "#009596",
Expand Down Expand Up @@ -266,7 +266,7 @@ exports[`RhelGraphCard Component should render multiple states: fulfilled 1`] =
},
],
"fill": "#8bc1f7",
"id": "sockets",
"id": "physicalSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productSocketsLabel, [object Object])",
"stroke": "#06c",
Expand All @@ -280,7 +280,7 @@ exports[`RhelGraphCard Component should render multiple states: fulfilled 1`] =
},
"data": undefined,
"fill": "#a2d9d9",
"id": "hypervisor",
"id": "hypervisorSockets",
"isStacked": true,
"legendLabel": "t(curiosity-graph.productHypervisorLabel, [object Object])",
"stroke": "#009596",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('RhelGraphCard Component', () => {
startDate: new Date('2019-06-01T00:00:00Z'),
endDate: new Date('2019-06-30T23:59:59Z'),
graphData: {
sockets: [
physicalSockets: [
{
date: new Date('2019-06-01T00:00:00Z'),
y: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ describe('RhelGraphCardHelpers', () => {
'no data granularity data display'
);

itemsByKey.hypervisor = { x: 0, y: 50, date: '2019-06-01T00:00:00Z' };
itemsByKey.sockets = { x: 0, y: 50, date: '2019-06-01T00:00:00Z' };
itemsByKey.hypervisorSockets = { x: 0, y: 50, date: '2019-06-01T00:00:00Z' };
itemsByKey.physicalSockets = { x: 0, y: 50, date: '2019-06-01T00:00:00Z' };
itemsByKey.threshold = { x: 0, y: 100, date: '2019-06-01T00:00:00Z' };

expect({ daily: daily(), weekly: weekly(), monthly: monthly(), quarterly: quarterly() }).toMatchSnapshot(
Expand Down
18 changes: 9 additions & 9 deletions src/components/rhelGraphCard/rhelGraphCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class RhelGraphCard extends React.Component {
{...chartAreaProps}
dataSets={[
{
data: graphData.sockets,
id: 'sockets',
data: graphData.physicalSockets,
id: 'physicalSockets',
animate: {
duration: 250,
onLoad: { duration: 250 }
Expand All @@ -99,8 +99,8 @@ class RhelGraphCard extends React.Component {
isStacked: true
},
{
data: graphData.hypervisor,
id: 'hypervisor',
data: graphData.hypervisorSockets,
id: 'hypervisorSockets',
animate: {
duration: 250,
onLoad: { duration: 250 }
Expand Down Expand Up @@ -176,14 +176,14 @@ RhelGraphCard.propTypes = {
getGraphCapacity: PropTypes.func,
getGraphReports: PropTypes.func,
graphData: PropTypes.shape({
sockets: PropTypes.arrayOf(
physicalSockets: PropTypes.arrayOf(
PropTypes.shape({
date: PropTypes.instanceOf(Date),
x: PropTypes.number,
y: PropTypes.number
})
),
hypervisor: PropTypes.arrayOf(
hypervisorSockets: PropTypes.arrayOf(
PropTypes.shape({
date: PropTypes.instanceOf(Date),
x: PropTypes.number,
Expand Down Expand Up @@ -218,13 +218,13 @@ RhelGraphCard.defaultProps = {
getGraphCapacity: helpers.noop,
getGraphReports: helpers.noop,
graphData: {
sockets: [],
hypervisor: [],
physicalSockets: [],
hypervisorSockets: [],
threshold: []
},
graphGranularity: GRANULARITY_TYPES.DAILY,
pending: false,
productId: rhsmApiTypes.RHSM_API_PATH_RHEL_ID_TYPES.RHEL,
productId: rhsmApiTypes.RHSM_API_PATH_ID_TYPES.RHEL,
t: helpers.noopTranslate,
startDate: dateHelpers.defaultDateTime.startDate,
endDate: dateHelpers.defaultDateTime.endDate
Expand Down
6 changes: 3 additions & 3 deletions src/components/rhelGraphCard/rhelGraphCardHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const getTooltipDate = ({ date, granularity }) => {
* Consider adding back in the year on tooltip cross year displays
*/
const getTooltips = ({ itemsByKey, granularity }) => {
let hypervisor = itemsByKey.hypervisor && itemsByKey.hypervisor.y;
let sockets = itemsByKey.sockets && itemsByKey.sockets.y;
let hypervisor = itemsByKey.hypervisorSockets && itemsByKey.hypervisorSockets.y;
let sockets = itemsByKey.physicalSockets && itemsByKey.physicalSockets.y;
let threshold = itemsByKey.threshold && itemsByKey.threshold.y;

hypervisor =
Expand All @@ -74,7 +74,7 @@ const getTooltips = ({ itemsByKey, granularity }) => {
const date =
((hypervisor || sockets || threshold) &&
`${translate('curiosity-graph.dateLabel')}: ${getTooltipDate({
date: itemsByKey.sockets.date,
date: itemsByKey.physicalSockets.date,
granularity
})}`) ||
'';
Expand Down
12 changes: 6 additions & 6 deletions src/components/router/routerTypes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { helpers } from '../../common/helpers';
import RhelView from '../rhelView/rhelView';
import TourView from '../tourView/tourView';
import { RHSM_API_PATH_RHEL_ID_TYPES } from '../../types/rhsmApiTypes';
import { RHSM_API_PATH_ID_TYPES } from '../../types/rhsmApiTypes';

/**
* Return an assumed dynamic route baseName directory
Expand Down Expand Up @@ -75,28 +75,28 @@ const navigation = [
{
title: 'Red Hat Enterprise Linux',
id: 'all',
pathParameter: RHSM_API_PATH_RHEL_ID_TYPES.RHEL,
pathParameter: RHSM_API_PATH_ID_TYPES.RHEL,
default: true
},
{
title: 'ARM',
id: 'arm',
pathParameter: RHSM_API_PATH_RHEL_ID_TYPES.ARM
pathParameter: RHSM_API_PATH_ID_TYPES.ARM
},
{
title: 'IBM Power',
id: 'ibmpower',
pathParameter: RHSM_API_PATH_RHEL_ID_TYPES.IBM_POWER
pathParameter: RHSM_API_PATH_ID_TYPES.IBM_POWER
},
{
title: 'IBM Z systems',
id: 'ibmz',
pathParameter: RHSM_API_PATH_RHEL_ID_TYPES.IBM_Z
pathParameter: RHSM_API_PATH_ID_TYPES.IBM_Z
},
{
title: 'x86',
id: 'x86',
pathParameter: RHSM_API_PATH_RHEL_ID_TYPES.X86
pathParameter: RHSM_API_PATH_ID_TYPES.X86
}
];

Expand Down
Loading

0 comments on commit e4430bb

Please sign in to comment.