debian-mirror-gitlab/app/assets/javascripts/pages/projects/graphs/show/index.js

24 lines
686 B
JavaScript
Raw Normal View History

2018-03-27 19:54:05 +05:30
import flash from '~/flash';
import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
2017-09-10 17:25:29 +05:30
import ContributorsStatGraph from './stat_graph_contributors';
document.addEventListener('DOMContentLoaded', () => {
2018-03-17 18:26:18 +05:30
const url = document.querySelector('.js-graphs-show').dataset.projectGraphPath;
axios.get(url)
.then(({ data }) => {
2017-09-10 17:25:29 +05:30
const graph = new ContributorsStatGraph();
graph.init(data);
$('#brush_change').change(() => {
graph.change_date_header();
graph.redraw_authors();
});
$('.stat-graph').fadeIn();
$('.loading-graph').hide();
2018-03-17 18:26:18 +05:30
})
.catch(() => flash(__('Error fetching contributors data.')));
2017-09-10 17:25:29 +05:30
});