import BubblePopup from '../../../components/common/BubblePopup';
import FormattedDate from '../../../components/ui/FormattedDate';
import GraphsTooltipsContent from './GraphsTooltipsContent';
+import GraphsTooltipsContentEvents from './GraphsTooltipsContentEvents';
import GraphsTooltipsContentCoverage from './GraphsTooltipsContentCoverage';
import GraphsTooltipsContentDuplication from './GraphsTooltipsContentDuplication';
import GraphsTooltipsContentOverview from './GraphsTooltipsContentOverview';
-import type { MeasureHistory } from '../types';
+import type { Event, MeasureHistory } from '../types';
import type { Serie } from '../../../components/charts/AdvancedTimeline';
type Props = {
+ events: Array<Event>,
formatValue: (number | string) => string,
graph: string,
graphWidth: number,
props: Props;
render() {
- const { measuresHistory, tooltipIdx } = this.props;
+ const { events, measuresHistory, tooltipIdx } = this.props;
const top = 50;
let left = this.props.tooltipPos + 60;
let customClass;
measuresHistory={measuresHistory}
tooltipIdx={tooltipIdx}
/>}
+ {events && events.length > 0 && <GraphsTooltipsContentEvents events={events} />}
</table>
</div>
</BubblePopup>
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+// @flow
+import React from 'react';
+import ProjectEventIcon from '../../../components/icons-components/ProjectEventIcon';
+import { translate } from '../../../helpers/l10n';
+import type { Event } from '../types';
+
+type Props = {
+ events: Array<Event>
+};
+
+export default function GraphsTooltipsContentEvents({ events }: Props) {
+ return (
+ <tbody>
+ <tr><td className="project-activity-graph-tooltip-separator" colSpan="3"><hr /></td></tr>
+ {events.map(event => (
+ <tr key={event.key} className="project-activity-graph-tooltip-line">
+ <td className="spacer-right thin">
+ <ProjectEventIcon className={'project-activity-event-icon ' + event.category} />
+ </td>
+ <td colSpan="2">
+ <span>{translate('event.category', event.category)}:</span>
+ {' '} {event.name}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ );
+}
return sortBy(filteredEvents, 'date');
};
+ getSelectedDateEvents = () => {
+ const { selectedDate } = this.state;
+ const { analyses } = this.props;
+ if (analyses && selectedDate) {
+ const analysis = analyses.find(
+ analysis => analysis.date.valueOf() === selectedDate.valueOf()
+ );
+ if (analysis) {
+ return analysis.events;
+ }
+ }
+ return [];
+ };
+
hasSeriesData = () => some(this.props.series, serie => serie.data && serie.data.length > 2);
updateTooltip = (selectedDate: ?Date, tooltipXPos: ?number, tooltipIdx: ?number) =>
<div>
<AdvancedTimeline
endDate={this.props.graphEndDate}
- events={this.getEvents()}
height={height}
width={width}
interpolate="linear"
{selectedDate != null &&
tooltipXPos != null &&
<GraphsTooltips
+ events={this.getSelectedDateEvents()}
formatValue={this.formatValue}
graph={graph}
graphWidth={width}