From ea09f3dd3ec3745c28b4baf45b44de139585198c Mon Sep 17 00:00:00 2001 From: Stephen Stone Date: Tue, 5 Jan 2021 15:32:19 -0600 Subject: [PATCH 1/5] fix(chartcards): translate group and total tooltip labels --- package.json | 4 ++-- src/components/BarChartCard/BarChartCard.jsx | 4 ++++ .../BarChartCard/BarChartCard.story.jsx | 1 - src/components/BarChartCard/barChartUtils.js | 1 - .../TimeSeriesCard/TimeSeriesCard.jsx | 3 +++ .../TimeSeriesCard/TimeSeriesCard.story.jsx | 4 +++- src/constants/CardPropTypes.js | 2 ++ .../__snapshots__/publicAPI.test.js.snap | 12 ++++++++++++ yarn.lock | 18 +++++++++--------- 9 files changed, 35 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index abd8218a7a..75378e5e07 100644 --- a/package.json +++ b/package.json @@ -127,8 +127,8 @@ }, "dependencies": { "@babel/runtime": "^7.10.2", - "@carbon/charts": "^0.41.11", - "@carbon/charts-react": "^0.41.11", + "@carbon/charts": "^0.41.14", + "@carbon/charts-react": "^0.41.14", "@carbon/colors": "10.15.0", "@carbon/icons-react": "10.17.0", "@carbon/layout": "10.12.0", diff --git a/src/components/BarChartCard/BarChartCard.jsx b/src/components/BarChartCard/BarChartCard.jsx index d927270a7a..66a330d117 100644 --- a/src/components/BarChartCard/BarChartCard.jsx +++ b/src/components/BarChartCard/BarChartCard.jsx @@ -282,6 +282,8 @@ const BarChartCard = ({ showTimeInGMT, tooltipDateFormatPattern ), + groupLabel: i18n.tooltipGroupLabel, + totalLabel: i18n.tooltipTotalLabel, }, // zoomBar should only be enabled for time-based charts ...(zoomBar?.enabled && @@ -353,6 +355,8 @@ BarChartCard.defaultProps = { size: CARD_SIZES.MEDIUMWIDE, i18n: { noDataLabel: 'No data', + tooltipGroupLabel: 'Group', + tooltipTotalLabel: 'Total', }, domainRange: null, content: { diff --git a/src/components/BarChartCard/BarChartCard.story.jsx b/src/components/BarChartCard/BarChartCard.story.jsx index ca93af5c11..340fd88ceb 100644 --- a/src/components/BarChartCard/BarChartCard.story.jsx +++ b/src/components/BarChartCard/BarChartCard.story.jsx @@ -20,7 +20,6 @@ const acceptableSizes = Object.keys(CARD_SIZES).filter( export default { title: 'Watson IoT/BarChartCard', - parameters: { component: BarChartCard, }, diff --git a/src/components/BarChartCard/barChartUtils.js b/src/components/BarChartCard/barChartUtils.js index 796b9e04e9..1917a3826b 100644 --- a/src/components/BarChartCard/barChartUtils.js +++ b/src/components/BarChartCard/barChartUtils.js @@ -438,7 +438,6 @@ export const formatColors = ( /** * Extends default tooltip with additional date information if the graph is time-based - * and adds color of dataset if defined * * This function is a bit more hacky than TimeSeriesCard because carbon charts formats it differently * TODO: remove the hackiness once this issue is solved: https://github.com/carbon-design-system/carbon-charts/issues/657 diff --git a/src/components/TimeSeriesCard/TimeSeriesCard.jsx b/src/components/TimeSeriesCard/TimeSeriesCard.jsx index 3f2719c58d..7acfe03b71 100644 --- a/src/components/TimeSeriesCard/TimeSeriesCard.jsx +++ b/src/components/TimeSeriesCard/TimeSeriesCard.jsx @@ -89,6 +89,7 @@ const TimeSeriesCardPropTypes = { i18n: PropTypes.shape({ alertDetected: PropTypes.string, noData: PropTypes.string, + tooltipGroupLabel: PropTypes.string, }), /** array of data from the backend for instance [{timestamp: Date object || ms timestamp, temperature: 35, humidity: 10}, ...] */ values: PropTypes.arrayOf( @@ -594,6 +595,7 @@ const TimeSeriesCard = ({ showTimeInGMT, tooltipDateFormatPattern ), + groupLabel: i18n.tooltipGroupLabel, }, getStrokeColor: handleStrokeColor, getFillColor: handleFillColor, @@ -675,6 +677,7 @@ TimeSeriesCard.defaultProps = { i18n: { alertDetected: 'Alert detected:', noDataLabel: 'No data is available for this time range.', + tooltipGroupLabel: 'Group', }, chartType: TIME_SERIES_TYPES.LINE, locale: 'en', diff --git a/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx b/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx index a55b6bb857..f950f6fad5 100644 --- a/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx +++ b/src/components/TimeSeriesCard/TimeSeriesCard.story.jsx @@ -16,7 +16,6 @@ const commonProps = { export default { title: 'Watson IoT/TimeSeriesCard', - parameters: { component: TimeSeriesCard, }, @@ -1331,6 +1330,9 @@ export const Locale = () => { showTimeInGMT={boolean('showTimeInGMT', false)} size={size} onCardAction={action('onCardAction')} + i18n={{ + tooltipGroupLabel: 'Translated Group', + }} /> ); diff --git a/src/constants/CardPropTypes.js b/src/constants/CardPropTypes.js index e30d5ee2ec..4ac7df9ba3 100644 --- a/src/constants/CardPropTypes.js +++ b/src/constants/CardPropTypes.js @@ -368,6 +368,8 @@ export const BarChartCardPropTypes = { /** internationalization */ i18n: PropTypes.shape({ alertDetected: PropTypes.string, + tooltipGroupLabel: PropTypes.string, + tooltipTotalLabel: PropTypes.string, }), /** optional domain to graph from. First value is the beginning of the range. Second value is the end of the range * can be date instance or timestamp */ diff --git a/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap b/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap index 28caf2da9d..60d272ede6 100644 --- a/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap +++ b/src/utils/__tests__/__snapshots__/publicAPI.test.js.snap @@ -4510,6 +4510,8 @@ Map { "domainRange": null, "i18n": Object { "noDataLabel": "No data", + "tooltipGroupLabel": "Group", + "tooltipTotalLabel": "Total", }, "locale": "en", "showTimeInGMT": false, @@ -5158,6 +5160,12 @@ Map { "alertDetected": Object { "type": "string", }, + "tooltipGroupLabel": Object { + "type": "string", + }, + "tooltipTotalLabel": Object { + "type": "string", + }, }, ], "type": "shape", @@ -11910,6 +11918,7 @@ Map { "i18n": Object { "alertDetected": "Alert detected:", "noDataLabel": "No data is available for this time range.", + "tooltipGroupLabel": "Group", }, "locale": "en", "showTimeInGMT": false, @@ -12608,6 +12617,9 @@ Map { "noData": Object { "type": "string", }, + "tooltipGroupLabel": Object { + "type": "string", + }, }, ], "type": "shape", diff --git a/yarn.lock b/yarn.lock index 4b326780a4..506ec311d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2572,17 +2572,17 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@carbon/charts-react@^0.41.11": - version "0.41.11" - resolved "https://registry.yarnpkg.com/@carbon/charts-react/-/charts-react-0.41.11.tgz#60fa7044dfbae9c4a94679ab290aadbf34a5c069" - integrity sha512-WRsfO+X5NQhhKzyevY8MQAWlL+SKOlvPm+WK1vaKnD5VuFMrdnLB2OG6esJmrF7taAC5qeY5mTlAfJ0ZE97p5Q== +"@carbon/charts-react@^0.41.14": + version "0.41.14" + resolved "https://registry.yarnpkg.com/@carbon/charts-react/-/charts-react-0.41.14.tgz#66dd52aa8b018f64d2ed65c0b0a3f340065b6226" + integrity sha512-OtGNx47KM4Dx2zdJYJSznC/7X3cy4/Zn35zXRPyv0A7hmq3+IGDh2eTl6GapBdq4dV4KXRBCYBEBjdnHGtQnRw== dependencies: - "@carbon/charts" "^0.41.11" + "@carbon/charts" "^0.41.14" -"@carbon/charts@^0.41.11": - version "0.41.11" - resolved "https://registry.yarnpkg.com/@carbon/charts/-/charts-0.41.11.tgz#9b295c891e440adef0cf38fc5202f95e0081ca54" - integrity sha512-0V/LOcUYh9dtqu09r7I1HwDrr+2sBBAnNYABAl6HC42PUbnt3MmXpWAZi+e69YvSyw1IuH6jBWLAb1vkc27/PQ== +"@carbon/charts@^0.41.14": + version "0.41.14" + resolved "https://registry.yarnpkg.com/@carbon/charts/-/charts-0.41.14.tgz#4e168f494bf4355abdece18152cc26bd4d2f54c9" + integrity sha512-ckadka8DuUOO9s/2M7Sj/uWB2+HInQxWxL/aDey5C4IlmV/4AAvCMHfv5VCkc6OCADuAzr8j07L7p0BWTFGTcw== dependencies: "@carbon/colors" "10.15.0" "@carbon/utils-position" "1.1.1" From 2bc74d9436462868293ffb453a4fe793333e3d10 Mon Sep 17 00:00:00 2001 From: Stephen Stone Date: Wed, 6 Jan 2021 10:19:54 -0600 Subject: [PATCH 2/5] fix(carbonCharts): revert to original version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 75378e5e07..abd8218a7a 100644 --- a/package.json +++ b/package.json @@ -127,8 +127,8 @@ }, "dependencies": { "@babel/runtime": "^7.10.2", - "@carbon/charts": "^0.41.14", - "@carbon/charts-react": "^0.41.14", + "@carbon/charts": "^0.41.11", + "@carbon/charts-react": "^0.41.11", "@carbon/colors": "10.15.0", "@carbon/icons-react": "10.17.0", "@carbon/layout": "10.12.0", From 799c487101e504e2fdd7365ed2d1da3d3ebacd8b Mon Sep 17 00:00:00 2001 From: Stephen Stone Date: Wed, 6 Jan 2021 10:22:21 -0600 Subject: [PATCH 3/5] chore: update yarn lock --- yarn.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 506ec311d4..ca47315f8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2572,14 +2572,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@carbon/charts-react@^0.41.14": +"@carbon/charts-react@^0.41.11": version "0.41.14" resolved "https://registry.yarnpkg.com/@carbon/charts-react/-/charts-react-0.41.14.tgz#66dd52aa8b018f64d2ed65c0b0a3f340065b6226" integrity sha512-OtGNx47KM4Dx2zdJYJSznC/7X3cy4/Zn35zXRPyv0A7hmq3+IGDh2eTl6GapBdq4dV4KXRBCYBEBjdnHGtQnRw== dependencies: "@carbon/charts" "^0.41.14" -"@carbon/charts@^0.41.14": +"@carbon/charts@^0.41.11", "@carbon/charts@^0.41.14": version "0.41.14" resolved "https://registry.yarnpkg.com/@carbon/charts/-/charts-0.41.14.tgz#4e168f494bf4355abdece18152cc26bd4d2f54c9" integrity sha512-ckadka8DuUOO9s/2M7Sj/uWB2+HInQxWxL/aDey5C4IlmV/4AAvCMHfv5VCkc6OCADuAzr8j07L7p0BWTFGTcw== From 09bc365c0c90d9ebec85cc92c73614d2ae6afcdb Mon Sep 17 00:00:00 2001 From: Stephen Stone Date: Wed, 6 Jan 2021 10:43:03 -0600 Subject: [PATCH 4/5] fix(carbonCharts): revert to original version --- yarn.lock | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index ca47315f8d..7d41196790 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2573,16 +2573,16 @@ integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== "@carbon/charts-react@^0.41.11": - version "0.41.14" - resolved "https://registry.yarnpkg.com/@carbon/charts-react/-/charts-react-0.41.14.tgz#66dd52aa8b018f64d2ed65c0b0a3f340065b6226" - integrity sha512-OtGNx47KM4Dx2zdJYJSznC/7X3cy4/Zn35zXRPyv0A7hmq3+IGDh2eTl6GapBdq4dV4KXRBCYBEBjdnHGtQnRw== + version "0.41.11" + resolved "https://registry.yarnpkg.com/@carbon/charts-react/-/charts-react-0.41.11.tgz#60fa7044dfbae9c4a94679ab290aadbf34a5c069" + integrity sha512-WRsfO+X5NQhhKzyevY8MQAWlL+SKOlvPm+WK1vaKnD5VuFMrdnLB2OG6esJmrF7taAC5qeY5mTlAfJ0ZE97p5Q== dependencies: - "@carbon/charts" "^0.41.14" + "@carbon/charts" "^0.41.11" -"@carbon/charts@^0.41.11", "@carbon/charts@^0.41.14": - version "0.41.14" - resolved "https://registry.yarnpkg.com/@carbon/charts/-/charts-0.41.14.tgz#4e168f494bf4355abdece18152cc26bd4d2f54c9" - integrity sha512-ckadka8DuUOO9s/2M7Sj/uWB2+HInQxWxL/aDey5C4IlmV/4AAvCMHfv5VCkc6OCADuAzr8j07L7p0BWTFGTcw== +"@carbon/charts@^0.41.11": + version "0.41.11" + resolved "https://registry.yarnpkg.com/@carbon/charts/-/charts-0.41.11.tgz#9b295c891e440adef0cf38fc5202f95e0081ca54" + integrity sha512-0V/LOcUYh9dtqu09r7I1HwDrr+2sBBAnNYABAl6HC42PUbnt3MmXpWAZi+e69YvSyw1IuH6jBWLAb1vkc27/PQ== dependencies: "@carbon/colors" "10.15.0" "@carbon/utils-position" "1.1.1" @@ -11481,9 +11481,8 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: - version "1.3.7" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" - integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== + version "1.3.5" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" init-package-json@^1.10.3: version "1.10.3" From 096951b0ce853b264d94df436193b1613b5467d4 Mon Sep 17 00:00:00 2001 From: Stephen Stone Date: Thu, 7 Jan 2021 17:54:23 -0600 Subject: [PATCH 5/5] fix: revert yarn lock to original --- yarn.lock | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7d41196790..4b326780a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11481,8 +11481,9 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: - version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + version "1.3.7" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" + integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== init-package-json@^1.10.3: version "1.10.3"