Commit 79b9ba46 authored by Frédéric Caplette's avatar Frédéric Caplette

Merge branch '263723-add-stats-to-group-coverage-tooltip' into 'master'

Add project count and coverage count to tooltip

See merge request gitlab-org/gitlab!73215
parents f36f3511 bf87128d
...@@ -55,7 +55,12 @@ export default { ...@@ -55,7 +55,12 @@ export default {
this.groupCoverageChartData = [ this.groupCoverageChartData = [
{ {
name: this.$options.i18n.graphName, name: this.$options.i18n.graphName,
data: groupCoverage.map((coverage) => [coverage.date, coverage.averageCoverage]), data: groupCoverage.map((coverage) => [
coverage.date,
coverage.averageCoverage,
coverage.projectCount,
coverage.coverageCount,
]),
}, },
]; ];
}, },
...@@ -137,8 +142,12 @@ export default { ...@@ -137,8 +142,12 @@ export default {
}, },
methods: { methods: {
formatTooltipText(params) { formatTooltipText(params) {
const [, averageCoverage, projectCount, coverageCount] = params.seriesData?.[0]?.data;
this.tooltipTitle = formatDate(params.value, 'mmm dd'); this.tooltipTitle = formatDate(params.value, 'mmm dd');
this.coveragePercentage = formatPercent(params.seriesData?.[0]?.data?.[1], 2); this.tooltipAverageCoverage = formatPercent(averageCoverage, 2);
this.tooltipProjectCount = projectCount;
this.tooltipCoverageCount = coverageCount;
}, },
}, },
i18n: { i18n: {
...@@ -147,7 +156,11 @@ export default { ...@@ -147,7 +156,11 @@ export default {
yAxisName: __('Coverage'), yAxisName: __('Coverage'),
xAxisName: __('Date'), xAxisName: __('Date'),
graphName: s__('RepositoriesAnalytics|Average coverage'), graphName: s__('RepositoriesAnalytics|Average coverage'),
graphTooltipMessage: __('Code Coverage: %{coveragePercentage}'), graphTooltip: {
averageCoverage: s__('RepositoriesAnalytics|Code Coverage: %{averageCoverage}'),
projectCount: s__('RepositoriesAnalytics|Projects with Coverage: %{projectCount}'),
coverageCount: s__('RepositoriesAnalytics|Jobs with Coverage: %{coverageCount}'),
},
metrics: { metrics: {
projectCountLabel: s__('RepositoriesAnalytics|Projects with Coverage'), projectCountLabel: s__('RepositoriesAnalytics|Projects with Coverage'),
averageCoverageLabel: s__('RepositoriesAnalytics|Average Coverage by Job'), averageCoverageLabel: s__('RepositoriesAnalytics|Average Coverage by Job'),
...@@ -207,10 +220,16 @@ export default { ...@@ -207,10 +220,16 @@ export default {
{{ tooltipTitle }} {{ tooltipTitle }}
</template> </template>
<template #tooltip-content> <template #tooltip-content>
<gl-sprintf :message="$options.i18n.graphTooltipMessage"> <gl-sprintf :message="$options.i18n.graphTooltip.averageCoverage">
<template #coveragePercentage> <template #averageCoverage> {{ tooltipAverageCoverage }}</template>
{{ coveragePercentage }} </gl-sprintf>
</template> <br />
<gl-sprintf :message="$options.i18n.graphTooltip.projectCount">
<template #projectCount> {{ tooltipProjectCount }} </template>
</gl-sprintf>
<br />
<gl-sprintf :message="$options.i18n.graphTooltip.coverageCount">
<template #coverageCount> {{ tooltipCoverageCount }} </template>
</gl-sprintf> </gl-sprintf>
</template> </template>
</gl-area-chart> </gl-area-chart>
......
...@@ -8216,9 +8216,6 @@ msgstr "" ...@@ -8216,9 +8216,6 @@ msgstr ""
msgid "Code" msgid "Code"
msgstr "" msgstr ""
msgid "Code Coverage: %{coveragePercentage}"
msgstr ""
msgid "Code Coverage: %{coveragePercentage}%{percentSymbol}" msgid "Code Coverage: %{coveragePercentage}%{percentSymbol}"
msgstr "" msgstr ""
...@@ -29005,6 +29002,9 @@ msgstr "" ...@@ -29005,6 +29002,9 @@ msgstr ""
msgid "RepositoriesAnalytics|Average test coverage last 30 days" msgid "RepositoriesAnalytics|Average test coverage last 30 days"
msgstr "" msgstr ""
msgid "RepositoriesAnalytics|Code Coverage: %{averageCoverage}"
msgstr ""
msgid "RepositoriesAnalytics|Coverage" msgid "RepositoriesAnalytics|Coverage"
msgstr "" msgstr ""
...@@ -29026,6 +29026,9 @@ msgstr "" ...@@ -29026,6 +29026,9 @@ msgstr ""
msgid "RepositoriesAnalytics|Jobs with Coverage" msgid "RepositoriesAnalytics|Jobs with Coverage"
msgstr "" msgstr ""
msgid "RepositoriesAnalytics|Jobs with Coverage: %{coverageCount}"
msgstr ""
msgid "RepositoriesAnalytics|Last Update" msgid "RepositoriesAnalytics|Last Update"
msgstr "" msgstr ""
...@@ -29044,6 +29047,9 @@ msgstr "" ...@@ -29044,6 +29047,9 @@ msgstr ""
msgid "RepositoriesAnalytics|Projects with Coverage" msgid "RepositoriesAnalytics|Projects with Coverage"
msgstr "" msgstr ""
msgid "RepositoriesAnalytics|Projects with Coverage: %{projectCount}"
msgstr ""
msgid "RepositoriesAnalytics|Test Code Coverage" msgid "RepositoriesAnalytics|Test Code Coverage"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment