});
}
-export function getComponentTags(component: string) {
- return getComponentShow(component).then(r => r.component.tags || []);
+export function getComponentData(component: string) {
+ return getComponentShow(component).then(r => r.component);
}
export function getMyProjects(data?: Object) {
import { GRAPHS_METRICS, parseQuery, serializeQuery, serializeUrlQuery } from '../utils';
import { translate } from '../../../helpers/l10n';
import './projectActivity.css';
-import type { Analysis, LeakPeriod, MeasureHistory, Metric, Query, Paging } from '../types';
+import type { Analysis, MeasureHistory, Metric, Query, Paging } from '../types';
import type { RawQuery } from '../../../helpers/query';
type Props = {
location: { pathname: string, query: RawQuery },
- project: { configuration?: { showHistory: boolean }, key: string },
+ project: { configuration?: { showHistory: boolean }, key: string, leakPeriodDate: string },
router: { push: ({ pathname: string, query?: RawQuery }) => void }
};
export type State = {
analyses: Array<Analysis>,
- leakPeriod?: LeakPeriod,
loading: boolean,
measures: Array<*>,
metrics: Array<Metric>,
<ProjectActivityGraphs
analyses={this.state.analyses}
- leakPeriod={this.state.leakPeriod}
+ leakPeriodDate={moment(this.props.project.leakPeriodDate).toDate()}
loading={this.state.loading}
measuresHistory={this.state.measuresHistory}
metricsType={this.getMetricType()}
type Props = {
analyses: Array<Analysis>,
+ leakPeriodDate: Date,
loading: boolean,
measuresHistory: Array<MeasureHistory>,
metricsType: string,
<ProjectActivityGraphsHeader graph={props.query.graph} updateQuery={props.updateQuery} />
<StaticGraphs
analyses={props.analyses}
+ leakPeriodDate={props.leakPeriodDate}
loading={props.loading}
measuresHistory={props.measuresHistory}
metricsType={props.metricsType}
type Props = {
analyses: Array<Analysis>,
+ leakPeriodDate: Date,
loading: boolean,
measuresHistory: Array<MeasureHistory>,
metricsType: string
export default class StaticGraphs extends React.PureComponent {
props: Props;
+ formatYTick = tick => formatMeasure(tick, getShortType(this.props.metricsType));
+
+ formatValue = value => formatMeasure(value, this.props.metricsType);
+
getEvents = () => {
const events = this.props.analyses.reduce((acc, analysis) => {
return acc.concat(
);
}
- const { metricsType } = this.props;
- const formatValue = value => formatMeasure(value, metricsType);
- const formatYTick = tick => formatMeasure(tick, getShortType(metricsType));
const series = this.getSeries();
return (
<div className="project-activity-graph-container">
<AdvancedTimeline
basisCurve={false}
series={series}
- metricType={metricsType}
+ metricType={this.props.metricsType}
events={this.getEvents()}
interpolate="linear"
- formatValue={formatValue}
- formatYTick={formatYTick}
+ formatValue={this.formatValue}
+ formatYTick={this.formatYTick}
leakPeriodDate={this.props.leakPeriodDate}
padding={[25, 25, 30, 60]}
/>
events: Array<Event>
};
-export type LeakPeriod = {
- date: string,
- index: number,
- mode: string,
- parameter: string
-};
-
export type HistoryItem = { date: Date, value: string };
export type MeasureHistory = { metric: string, history: Array<HistoryItem> };
*/
import { getLanguages } from '../api/languages';
import { getGlobalNavigation, getComponentNavigation } from '../api/nav';
-import { getComponentTags } from '../api/components';
+import { getComponentData } from '../api/components';
import * as auth from '../api/auth';
import { getOrganizations } from '../api/organizations';
import { receiveLanguages } from './languages/actions';
});
export const fetchProject = key => dispatch =>
- Promise.all([getComponentNavigation(key), getComponentTags(key)]).then(([component, tags]) => {
- component.tags = tags;
+ Promise.all([
+ getComponentNavigation(key),
+ getComponentData(key)
+ ]).then(([componentNav, componentData]) => {
+ const component = { ...componentData, ...componentNav };
dispatch(receiveComponents([addQualifier(component)]));
if (component.organization != null) {
dispatch(fetchOrganizations([component.organization]));