Skip to content

Commit

Permalink
fix(graphCard): sw-747, sw-748 styling, copy (#1119)
Browse files Browse the repository at this point in the history
* locale, variant OpenShift strings
* graphCardHelpers, pad axes on label existence
* graphCardMetricTotals, div test wrapper for standalone
* styling, graph padding for standalone
  • Loading branch information
cdcabrera committed May 25, 2023
1 parent fab2f03 commit ee403b6
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 59 deletions.
6 changes: 3 additions & 3 deletions public/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@
"title": "{{appName}}",
"subtitle": "Monitor your usage based on your subscription terms. <0>Learn more about {{appName}} reporting</0>",
"description": "Monitor your usage based on your subscription terms.",
"title_openshift": "$t(curiosity-view.title_OpenShift Container Platform)",
"subtitle_openshift": "$t(curiosity-view.subtitle_OpenShift Container Platform)",
"description_openshift": "$t(curiosity-view.description_OpenShift Container Platform)",
"title_openshift": "Red Hat OpenShift",
"subtitle_openshift": "Monitor your OpenShift usage for both Annual and On-Demand subscriptions. <0>Learn more about {{appName}} reporting</0>",
"description_openshift": "Monitor your OpenShift usage for both Annual and On-Demand subscriptions.",
"title_OpenShift Container Platform": "OpenShift Container Platform",
"subtitle_OpenShift Container Platform": "Monitor your OpenShift Container Platform usage for both Annual and On-Demand subscriptions. <0>Learn more about {{appName}} reporting</0>",
"description_OpenShift Container Platform": "Monitor your OpenShift Container Platform usage for both Annual and On-Demand subscriptions.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ exports[`GraphCardContext should parse configuration: configuration, grouped 1`]
"strokeWidth": 2,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "Core-seconds_loremIpsum",
},
},
Expand Down Expand Up @@ -177,12 +171,6 @@ exports[`GraphCardContext should parse configuration: configuration, standalone
"strokeWidth": 2,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "Core-seconds_loremIpsum",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ exports[`GraphCardHelpers generateChartSettings should return base graph setting
"strokeWidth": 2,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "dolorSit",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,11 @@ exports[`GraphCardMetricTotals Component should handle multiple display states:
</div>
`;

exports[`GraphCardMetricTotals Component should render a basic component: basic 1`] = `"lorem ipsum"`;
exports[`GraphCardMetricTotals Component should render a basic component: basic 1`] = `
<div
className="curiosity-usage-graph__standalone"
data-test="graphStandalone"
>
lorem ipsum
</div>
`;
19 changes: 13 additions & 6 deletions src/components/graphCard/graphCardHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ const generateChartSettings = ({ filters = [], settings: graphCardSettings = {},
const { isMultiMetric, isFirst, isLast, ...remainingCombinedSettings } = combinedSettings;
const updatedChartType = filterSettings?.chartType || ChartTypeVariant.area;
const isThreshold = filterSettings?.chartType === ChartTypeVariant.threshold;
const isAxisLabel =
remainingCombinedSettings?.yAxisChartLabel ||
remainingCombinedSettings?.xAxisChartLabel ||
filterSettings?.yAxisChartLabel ||
filterSettings?.xAxisChartLabel;
const baseFilterSettings = {
chartType: updatedChartType,
id: generateChartIds({ isCapacity: isThreshold, metric, productId, query: filterSettings?.query }),
Expand All @@ -83,12 +88,14 @@ const generateChartSettings = ({ filters = [], settings: graphCardSettings = {},
if (isFirst) {
filtersSettings.push({
settings: {
padding: {
bottom: 75,
left: 75,
right: 45,
top: 45
},
...(isAxisLabel && {
padding: {
bottom: 75,
left: 75,
right: 45,
top: 45
}
}),
...remainingCombinedSettings,
isMetricDisplay: remainingCombinedSettings?.isMetricDisplay ?? remainingCombinedSettings?.cards?.length > 0,
isMultiMetric,
Expand Down
6 changes: 5 additions & 1 deletion src/components/graphCard/graphCardMetricTotals.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ const GraphCardMetricTotals = ({
);
}

return children;
return (
<div data-test="graphStandalone" className="curiosity-usage-graph__standalone">
{children}
</div>
);
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,6 @@ exports[`Product OpenShift Container config should apply graph configuration: fi
"strokeWidth": 3,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "Cores",
"stroke": "#06c",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,6 @@ exports[`Product OpenShift Dedicated config should apply graph configuration: fi
"yAxisUseDataSet": true,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "Cores",
"stroke": "#06c",
"yAxisUseDataSet": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,6 @@ exports[`Product OpenShift Metrics config should apply graph configuration: filt
"strokeWidth": 2,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"stringId": "Cores",
"stroke": "#06c",
},
Expand Down
6 changes: 0 additions & 6 deletions src/config/__tests__/__snapshots__/product.rhel.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -412,12 +412,6 @@ exports[`Product RHEL config should apply graph configuration: filters 1`] = `
"strokeWidth": 3,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"query": {
"category": "physical",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,6 @@ exports[`Product Satellite config should apply graph configuration: filters 1`]
"strokeWidth": 2,
},
],
"padding": {
"bottom": 75,
"left": 75,
"right": 45,
"top": 45,
},
"query": {
"category": "physical",
},
Expand Down
6 changes: 6 additions & 0 deletions src/styles/_usage-graph.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
}
}

&__standalone {
margin-left: var(--pf-global--spacer--md);
margin-right: var(--pf-global--spacer--md);
margin-top: var(--pf-global--spacer--md);
}

&__totals {
background-color: var(--pf-global--BackgroundColor--100);
display: flex;
Expand Down

0 comments on commit ee403b6

Please sign in to comment.