Skip to content

Commit

Permalink
fix(productView,openshiftView): ent-3324 align code for products (#590)
Browse files Browse the repository at this point in the history
* i18n, locale strings for products
* graphCard, move granularity field into product view
* productView, openshiftView customizable toolbars
  • Loading branch information
cdcabrera committed Feb 25, 2021
1 parent 43d4e75 commit 3dcf3ed
Show file tree
Hide file tree
Showing 14 changed files with 564 additions and 459 deletions.
12 changes: 6 additions & 6 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"curiosity-graph": {
"cardHeading": "CPU usage",
"coresHeading": "CPU core usage",
"socketsHeading": "CPU socket usage",
"cardHeading_cores": "CPU core usage",
"cardHeading_sockets": "CPU socket usage",
"infiniteThresholdLabel": "unlimited",
"noLabel": "Data",
"noDataLabel": "no data",
Expand All @@ -36,8 +36,8 @@
"thresholdLabel": "Subscription threshold",
"thresholdLegendTooltip": "Maximum capacity, based on total {{product}} subscriptions in this account.",
"thresholdLegendTooltip_RHEL": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
"thresholdCoresLegendTooltip_OpenShift": "Maximum capacity, as CPU cores, based on total {{product}} subscriptions in this account.",
"thresholdSocketsLegendTooltip_OpenShift": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
"thresholdCoresLegendTooltip_OpenShift Container Platform": "Maximum capacity, as CPU cores, based on total {{product}} subscriptions in this account.",
"thresholdSocketsLegendTooltip_OpenShift Container Platform": "Maximum capacity, as CPU sockets, based on total {{product}} subscriptions in this account.",
"tooltipSummary": "Your subscription data facets. With one level of column and row headers."
},
"curiosity-inventory": {
Expand Down Expand Up @@ -141,8 +141,8 @@
"curiosity-view": {
"title": "{{appName}}",
"subtitle": "Monitor your usage based on your subscription terms. <0>Learn more about {{appName}} reporting</0>",
"title_OpenShift": "Red Hat OpenShift",
"subtitle_OpenShift": "Monitor your Red Hat OpenShift usage by socket or core usage, based on your subscription terms. <0>Learn more about {{appName}} reporting</0>",
"title_OpenShift Container Platform": "Red Hat OpenShift",
"subtitle_OpenShift Container Platform": "Monitor your Red Hat OpenShift usage by socket or core usage, based on your subscription terms. <0>Learn more about {{appName}} reporting</0>",
"title_RHEL": "Red Hat Enterprise Linux",
"subtitle_RHEL": "Monitor your Red Hat Enterprise Linux usage by physical, virtual, and public cloud sockets. <0>Learn more about {{appName}} reporting</0>",
"title_Satellite": "Red Hat Satellite"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,7 @@ exports[`GraphCard Component should render a non-connected component: non-connec
</CardTitle>
<CardActions
className=""
>
<ToolbarFieldGranularity
options={
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
},
]
}
t={[Function]}
value="daily"
viewId="graphCard"
/>
</CardActions>
/>
</CardHeader>
</MinHeight>
<MinHeight
Expand Down Expand Up @@ -209,37 +179,7 @@ exports[`GraphCard Component should render multiple states: error with 403 statu
</CardTitle>
<CardActions
className="blur"
>
<ToolbarFieldGranularity
options={
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
},
]
}
t={[Function]}
value="daily"
viewId="graphCard"
/>
</CardActions>
/>
</CardHeader>
</MinHeight>
<MinHeight
Expand Down Expand Up @@ -330,37 +270,7 @@ exports[`GraphCard Component should render multiple states: error with 500 statu
</CardTitle>
<CardActions
className="blur"
>
<ToolbarFieldGranularity
options={
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
},
]
}
t={[Function]}
value="daily"
viewId="graphCard"
/>
</CardActions>
/>
</CardHeader>
</MinHeight>
<MinHeight
Expand Down Expand Up @@ -451,37 +361,7 @@ exports[`GraphCard Component should render multiple states: fulfilled 1`] = `
</CardTitle>
<CardActions
className=""
>
<ToolbarFieldGranularity
options={
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
},
]
}
t={[Function]}
value="daily"
viewId="graphCard"
/>
</CardActions>
/>
</CardHeader>
</MinHeight>
<MinHeight
Expand Down Expand Up @@ -572,37 +452,7 @@ exports[`GraphCard Component should render multiple states: pending 1`] = `
</CardTitle>
<CardActions
className=""
>
<ToolbarFieldGranularity
options={
Array [
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"daily\\"})",
"value": "daily",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"weekly\\"})",
"value": "weekly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"monthly\\"})",
"value": "monthly",
},
Object {
"selected": false,
"title": "t(curiosity-toolbar.granularity, {\\"context\\":\\"quarterly\\"})",
"value": "quarterly",
},
]
}
t={[Function]}
value="daily"
viewId="graphCard"
/>
</CardActions>
/>
</CardHeader>
</MinHeight>
<MinHeight
Expand Down
10 changes: 2 additions & 8 deletions src/components/graphCard/graphCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import GraphCardChartLegend from './graphCardChartLegend';
import { ChartArea } from '../chartArea/chartArea';
import { Loader } from '../loader/loader';
import { MinHeight } from '../minHeight/minHeight';
import { ToolbarFieldGranularity } from '../toolbar/toolbarFieldGranularity';
import { translate } from '../i18n/i18n';

/**
Expand Down Expand Up @@ -143,14 +142,12 @@ class GraphCard extends React.Component {
* @returns {Node}
*/
render() {
const { cardTitle, children, error, isDisabled, pending, viewId } = this.props;
const { cardTitle, children, error, isDisabled, pending } = this.props;

if (isDisabled) {
return null;
}

const graphGranularity = this.getQueryGranularity();

return (
<Card className="curiosity-usage-graph">
<MinHeight key="headerMinHeight">
Expand All @@ -160,10 +157,7 @@ class GraphCard extends React.Component {
{cardTitle}
</Title>
</CardTitle>
<CardActions className={(error && 'blur') || ''}>
{children}
<ToolbarFieldGranularity viewId={viewId} value={graphGranularity} />
</CardActions>
<CardActions className={(error && 'blur') || ''}>{children}</CardActions>
</CardHeader>
</MinHeight>
<MinHeight key="bodyMinHeight">
Expand Down
6 changes: 3 additions & 3 deletions src/components/i18n/__tests__/__snapshots__/i18n.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Array [
},
Object {
"key": "curiosity-graph.cardHeading",
"match": "t('curiosity-graph.cardHeading')",
"match": "t('curiosity-graph.cardHeading', { context: uomFilter })",
},
Object {
"key": "curiosity-inventory.tab",
Expand Down Expand Up @@ -273,8 +273,8 @@ Array [
"match": "t(\`curiosity-view.title\`, { appName: helpers.UI_DISPLAY_NAME, context: productLabel })",
},
Object {
"key": "curiosity-graph.socketsHeading",
"match": "t('curiosity-graph.socketsHeading')",
"key": "curiosity-graph.cardHeading",
"match": "t('curiosity-graph.cardHeading', { context: 'sockets' })",
},
Object {
"key": "curiosity-inventory.tab",
Expand Down
Loading

0 comments on commit 3dcf3ed

Please sign in to comment.