From ac13af0a5480f6755f2be85e99826cd7b60f741b Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Mon, 10 Oct 2022 15:08:47 +0200 Subject: [PATCH] SONAR-17004 [894180] Short text alternative is missing --- .../apps/overview/branches/ActivityPanel.tsx | 26 +-- .../__snapshots__/ActivityPanel-test.tsx.snap | 218 ++++++++---------- .../activity-graph/GraphHistory.tsx | 5 +- .../activity-graph/GraphsHistory.tsx | 58 +++-- .../__snapshots__/GraphsHistory-test.tsx.snap | 3 + .../js/components/charts/AdvancedTimeline.tsx | 35 ++- .../resources/org/sonar/l10n/core.properties | 3 +- 7 files changed, 182 insertions(+), 166 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx index 4868a496edc..b737b1bbd07 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/ActivityPanel.tsx @@ -92,23 +92,19 @@ export function ActivityPanel(props: ActivityPanelProps) {
-
localizeMetric(metricKey)).join(', ') - )}> -
- -
-
+ )} + graph={graph} + graphs={graphs} + leakPeriodDate={shownLeakPeriodDate} + loading={Boolean(loading)} + measuresHistory={measuresHistory} + series={series} + />
diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap index 0dde391a2ce..ca28c6eba5e 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/__snapshots__/ActivityPanel-test.tsx.snap @@ -36,71 +36,64 @@ exports[`should render correctly 1`] = ` } updateGraph={[MockFunction]} /> -
-
- -
-
+ ], + "name": "bugs", + "translatedName": "Bugs", + "type": "PERCENT", + }, + ] + } + />
-
-
- -
-
+ ], + "name": "bugs", + "translatedName": "Bugs", + "type": "PERCENT", + }, + ] + } + />
void; updateSelectedDate?: (selectedDate?: Date) => void; updateTooltip: (selectedDate?: Date) => void; @@ -78,7 +79,8 @@ export default class GraphHistory extends React.PureComponent { metricsType, selectedDate, series, - showAreas + showAreas, + graphDescription } = this.props; const { tooltipIdx, tooltipXPos } = this.state; @@ -105,6 +107,7 @@ export default class GraphHistory extends React.PureComponent { series={series} showAreas={showAreas} startDate={graphStartDate} + graphDescription={graphDescription} updateSelectedDate={this.props.updateSelectedDate} updateTooltip={this.updateTooltip} updateZoom={this.props.updateGraphZoom} diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx index a644e8e3a35..f0d4a97f820 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsHistory.tsx @@ -17,10 +17,10 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { isEqual } from 'lodash'; +import { isEqual, uniqBy } from 'lodash'; import * as React from 'react'; import DeferredSpinner from '../../components/ui/DeferredSpinner'; -import { translate } from '../../helpers/l10n'; +import { translate, translateWithParameters } from '../../helpers/l10n'; import { getBaseUrl } from '../../helpers/system'; import { GraphType, MeasureHistory, Serie } from '../../types/project-activity'; import { ParsedAnalysis } from '../../types/types'; @@ -30,6 +30,7 @@ import { getSeriesMetricType, hasHistoryData, isCustomGraph } from './utils'; interface Props { analyses: ParsedAnalysis[]; + ariaLabel?: string; graph: GraphType; graphs: Serie[][]; graphEndDate?: Date; @@ -79,7 +80,7 @@ export default class GraphsHistory extends React.PureComponent { }; render() { - const { graph, loading, series } = this.props; + const { graph, loading, series, ariaLabel } = this.props; const isCustom = isCustomGraph(graph); if (loading) { @@ -117,26 +118,37 @@ export default class GraphsHistory extends React.PureComponent { const showAreas = [GraphType.coverage, GraphType.duplications].includes(graph); return (
- {this.props.graphs.map((graphSeries, idx) => ( - - ))} + {this.props.graphs.map((graphSeries, idx) => { + return ( + translatedName) + .join(', ') + ) + } + showAreas={showAreas} + updateGraphZoom={this.props.updateGraphZoom} + updateSelectedDate={this.props.updateSelectedDate} + updateTooltip={this.updateTooltip} + /> + ); + })}
); } diff --git a/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsHistory-test.tsx.snap b/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsHistory-test.tsx.snap index 6c121cd5ca5..b7d7f3fadc7 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsHistory-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/activity-graph/__tests__/__snapshots__/GraphsHistory-test.tsx.snap @@ -5,6 +5,7 @@ exports[`should correctly render a graph 1`] = ` className="display-flex-justify-center display-flex-column display-flex-stretch flex-grow" > }; render() { - if (!this.props.width || !this.props.height) { + const { + width, + height, + padding, + disableZoom, + startDate, + endDate, + leakPeriodDate, + hideGrid, + hideXAxis, + showAreas, + graphDescription + } = this.props; + if (!width || !height) { return
; } - const zoomEnabled = !this.props.disableZoom && this.props.updateZoom != null; - const isZoomed = Boolean(this.props.startDate || this.props.endDate); + const zoomEnabled = !disableZoom && this.props.updateZoom != null; + const isZoomed = Boolean(startDate || endDate); return ( + height={height} + width={width}> {zoomEnabled && this.renderClipPath()} - - {this.props.leakPeriodDate != null && this.renderLeak()} - {!this.props.hideGrid && this.renderHorizontalGrid()} - {!this.props.hideXAxis && this.renderXAxisTicks()} - {this.props.showAreas && this.renderAreas()} + + {leakPeriodDate != null && this.renderLeak()} + {!hideGrid && this.renderHorizontalGrid()} + {!hideXAxis && this.renderXAxisTicks()} + {showAreas && this.renderAreas()} {this.renderLines()} {this.renderDots()} {this.renderSelectedDate()} diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 52dd8eba7df..76dc91099ce 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1535,6 +1535,7 @@ project_activity.new_code_period_start=New Code Period starts here project_activity.new_code_period_start.help=The analysis before this mark is the baseline for New Code comparison project_activity.graphs.choose_type=Choose graph type +project_activity.graphs.explanation_x=This interactive graph shows data for the following project measures over time: {0} project_activity.graphs.new_code=New Code project_activity.graphs.new_code_long=New Code is indicated in yellow on the graph. project_activity.graphs.issues=Issues @@ -3220,7 +3221,7 @@ overview.project_key.APP=Application Key overview.project_key.TRK=Project Key overview.project_key.click_to_copy=Click to copy the key to your clipboard overview.activity=Activity -overview.activity.graph_shows_data_for_x=This space normally shows historical data for {0}. Click on the "Activity" link below to see more information. +overview.activity.graph_shows_data_for_x=This graph shows historical data for {0}. Click on the "Activity" link below to see more information. overview.recent_activity=Recent Activity overview.measures=Measures overview.measures.empty_explanation=Measures on New Code will appear after the second analysis of this branch. -- 2.39.5