diff --git a/public/locales/en-US.json b/public/locales/en-US.json index b172403a0..563128c43 100644 --- a/public/locales/en-US.json +++ b/public/locales/en-US.json @@ -49,12 +49,20 @@ "tableSkeletonAriaLabel": "Loading" }, "curiosity-toolbar": { + "category": "Filter by", + "categoryPlaceholder": "Filter by", "slaCategory": "SLA", "slaNone": "No SLA", "slaPlaceholder": "Filter by SLA", "slaPremium": "Premium", "slaSelfSupport": "Self-Support", - "slaStandard": "Standard" + "slaStandard": "Standard", + "usageCategory": "Usage", + "usagePlaceholder": "Filter by usage", + "usageDevelopment": "Development/Test", + "usageDisaster": "Disaster Recovery", + "usageProduction": "Production", + "usageUnspecified": "Unspecified" }, "curiosity-optin": { "buttonActivate": "Activate {{appName}}", diff --git a/src/components/c3GraphCard/c3GraphCard.js b/src/components/c3GraphCard/c3GraphCard.js index 56c2fb258..ec520ac91 100644 --- a/src/components/c3GraphCard/c3GraphCard.js +++ b/src/components/c3GraphCard/c3GraphCard.js @@ -67,7 +67,7 @@ class C3GraphCard extends React.Component { const { viewId } = this.props; store.dispatch({ - type: reduxTypes.rhsm.SET_FILTER_GRANULARITY_RHSM, + type: reduxTypes.query.SET_QUERY_GRANULARITY_RHSM, viewId, [rhsmApiTypes.RHSM_API_QUERY_GRANULARITY]: value }); diff --git a/src/components/graphCard/graphCard.js b/src/components/graphCard/graphCard.js index 48f46e576..d616f5836 100644 --- a/src/components/graphCard/graphCard.js +++ b/src/components/graphCard/graphCard.js @@ -67,7 +67,7 @@ class GraphCard extends React.Component { const { viewId } = this.props; store.dispatch({ - type: reduxTypes.rhsm.SET_FILTER_GRANULARITY_RHSM, + type: reduxTypes.query.SET_QUERY_GRANULARITY_RHSM, viewId, [rhsmApiTypes.RHSM_API_QUERY_GRANULARITY]: value }); diff --git a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap index d4ac3e31e..5ba1f50ab 100644 --- a/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap +++ b/src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap @@ -330,6 +330,14 @@ Array [ Object { "file": "./src/components/toolbar/toolbar.js", "keys": Array [ + Object { + "key": "curiosity-toolbar.category", + "match": "t('curiosity-toolbar.category')", + }, + Object { + "key": "curiosity-toolbar.categoryPlaceholder", + "match": "t('curiosity-toolbar.categoryPlaceholder')", + }, Object { "key": "curiosity-toolbar.slaCategory", "match": "t('curiosity-toolbar.slaCategory')", @@ -342,6 +350,18 @@ Array [ "key": "curiosity-toolbar.slaPlaceholder", "match": "t('curiosity-toolbar.slaPlaceholder')", }, + Object { + "key": "curiosity-toolbar.usageCategory", + "match": "t('curiosity-toolbar.usageCategory')", + }, + Object { + "key": "curiosity-toolbar.usageCategory", + "match": "t('curiosity-toolbar.usageCategory')", + }, + Object { + "key": "curiosity-toolbar.usagePlaceholder", + "match": "t('curiosity-toolbar.usagePlaceholder')", + }, ], }, Object { @@ -363,6 +383,30 @@ Array [ "key": "curiosity-toolbar.slaNone", "match": "translate('curiosity-toolbar.slaNone')", }, + Object { + "key": "curiosity-toolbar.usageDevelopment", + "match": "translate('curiosity-toolbar.usageDevelopment')", + }, + Object { + "key": "curiosity-toolbar.usageDisaster", + "match": "translate('curiosity-toolbar.usageDisaster')", + }, + Object { + "key": "curiosity-toolbar.usageProduction", + "match": "translate('curiosity-toolbar.usageProduction')", + }, + Object { + "key": "curiosity-toolbar.usageUnspecified", + "match": "translate('curiosity-toolbar.usageUnspecified')", + }, + Object { + "key": "curiosity-toolbar.slaCategory", + "match": "translate('curiosity-toolbar.slaCategory')", + }, + Object { + "key": "curiosity-toolbar.usageCategory", + "match": "translate('curiosity-toolbar.usageCategory')", + }, ], }, Object { diff --git a/src/components/openshiftView/__tests__/__snapshots__/openshiftView.test.js.snap b/src/components/openshiftView/__tests__/__snapshots__/openshiftView.test.js.snap index 3e9ec782c..9166c4638 100644 --- a/src/components/openshiftView/__tests__/__snapshots__/openshiftView.test.js.snap +++ b/src/components/openshiftView/__tests__/__snapshots__/openshiftView.test.js.snap @@ -9,14 +9,12 @@ exports[`OpenshiftView Component should display an alternate graph on query-stri t(curiosity-view.OpenShiftTitle, Subscription Watch) - @@ -85,14 +83,12 @@ exports[`OpenshiftView Component should have a fallback title: title 1`] = ` t(curiosity-view.OpenShiftTitle, Subscription Watch) - @@ -161,14 +157,12 @@ exports[`OpenshiftView Component should render a non-connected component: non-co t(curiosity-view.OpenShiftTitle, Subscription Watch) - diff --git a/src/components/rhelView/__tests__/__snapshots__/rhelView.test.js.snap b/src/components/rhelView/__tests__/__snapshots__/rhelView.test.js.snap index 27039a9d6..861171c79 100644 --- a/src/components/rhelView/__tests__/__snapshots__/rhelView.test.js.snap +++ b/src/components/rhelView/__tests__/__snapshots__/rhelView.test.js.snap @@ -9,14 +9,12 @@ exports[`RhelView Component should display an alternate graph on query-string up t(curiosity-view.RHELTitle, Subscription Watch) - @@ -71,14 +69,12 @@ exports[`RhelView Component should have a fallback title: title 1`] = ` t(curiosity-view.RHELTitle, Subscription Watch) - @@ -133,14 +129,12 @@ exports[`RhelView Component should render a non-connected component: non-connect t(curiosity-view.RHELTitle, Subscription Watch) - diff --git a/src/components/toolbar/__tests__/__snapshots__/toolbar.test.js.snap b/src/components/toolbar/__tests__/__snapshots__/toolbar.test.js.snap index 78d949573..cacd02dfa 100644 --- a/src/components/toolbar/__tests__/__snapshots__/toolbar.test.js.snap +++ b/src/components/toolbar/__tests__/__snapshots__/toolbar.test.js.snap @@ -1,65 +1,672 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Toolbar Component should handle updating state and dispatching an sla filter: clear filters 1`] = `null`; - -exports[`Toolbar Component should handle updating state and dispatching an sla filter: sla selected 1`] = `null`; +exports[`Toolbar Component should handle adding and clearing filters from redux state: dispatch filter 1`] = ` +[MockFunction] { + "calls": Array [ + Array [ + Object { + "data": Object { + "currentFilter": "sla", + }, + "type": "SET_FILTER_TYPE", + }, + ], + Array [ + Array [ + Object { + "data": Object { + "activeFilters": Set { + "sla", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "sla": "premium", + }, + "type": "SET_QUERY_SLA_RHSM", + }, + ], + ], + Array [ + Array [ + Object { + "data": Object { + "activeFilters": Set { + "sla", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "sla": "standard", + }, + "type": "SET_QUERY_SLA_RHSM", + }, + ], + ], + Array [ + Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "sla": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + ], + Array [ + Object { + "data": Object { + "currentFilter": "usage", + }, + "type": "SET_FILTER_TYPE", + }, + ], + Array [ + Array [ + Object { + "data": Object { + "activeFilters": Set { + "usage", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "usage": "Development/Test", + }, + "type": "SET_QUERY_USAGE_RHSM", + }, + ], + ], + Array [ + Array [ + Object { + "data": Object { + "activeFilters": Set { + "usage", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "usage": "Disaster Recovery", + }, + "type": "SET_QUERY_USAGE_RHSM", + }, + ], + ], + Array [ + Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "usage": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + ], + Array [ + Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "sla": null, + "usage": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + ], + ], + "results": Array [ + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Object { + "data": Object { + "currentFilter": "sla", + }, + "type": "SET_FILTER_TYPE", + }, + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "activeFilters": Set { + "sla", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "sla": "premium", + }, + "type": "SET_QUERY_SLA_RHSM", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "activeFilters": Set { + "sla", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "sla": "standard", + }, + "type": "SET_QUERY_SLA_RHSM", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "sla": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Object { + "data": Object { + "currentFilter": "usage", + }, + "type": "SET_FILTER_TYPE", + }, + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "activeFilters": Set { + "usage", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "usage": "Development/Test", + }, + "type": "SET_QUERY_USAGE_RHSM", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "activeFilters": Set { + "usage", + }, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "usage": "Disaster Recovery", + }, + "type": "SET_QUERY_USAGE_RHSM", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "usage": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + }, + }, + Object { + "type": "return", + "value": Object { + "data": undefined, + "type": Array [ + Object { + "data": Object { + "currentFilter": null, + }, + "type": "SET_FILTER_TYPE", + }, + Object { + "data": Object { + "activeFilters": Set {}, + }, + "type": "SET_ACTIVE_FILTERS", + }, + Object { + "data": Object { + "clearFilters": Object { + "sla": null, + "usage": null, + }, + }, + "type": "SET_QUERY_CLEAR", + }, + ], + }, + }, + ], +} +`; exports[`Toolbar Component should render a non-connected component: non-connected 1`] = ` + + + } + > + + + + + + + + + + - - + } breakpoint="md"> + + + + + +