diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 18:09:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-31 18:09:11 +0000 |
commit | 0434f38ef1dce4fe640fe1e4542235746ceb943c (patch) | |
tree | 3affe5902c9da74441dfbf5069f76c023b5cd03a /app/assets/javascripts/pages/projects | |
parent | c27acb1d376f7127cd33eadcc8f5683ed55262bc (diff) | |
download | gitlab-ce-0434f38ef1dce4fe640fe1e4542235746ceb943c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pages/projects')
-rw-r--r-- | app/assets/javascripts/pages/projects/pipelines/charts/index.js | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/app/assets/javascripts/pages/projects/pipelines/charts/index.js b/app/assets/javascripts/pages/projects/pipelines/charts/index.js index 9fa580d2ba9..2e7af11c39e 100644 --- a/app/assets/javascripts/pages/projects/pipelines/charts/index.js +++ b/app/assets/javascripts/pages/projects/pipelines/charts/index.js @@ -1,7 +1,9 @@ import $ from 'jquery'; import Chart from 'chart.js'; -import { barChartOptions, lineChartOptions } from '~/lib/utils/chart_utils'; +import { lineChartOptions } from '~/lib/utils/chart_utils'; + +import initProjectPipelinesChartsApp from '~/projects/pipelines/charts/index'; const SUCCESS_LINE_COLOR = '#1aaa55'; @@ -44,40 +46,13 @@ const buildChart = (chartScope, shouldAdjustFontSize) => { }); }; -const buildBarChart = (chartTimesData, shouldAdjustFontSize) => { - const data = { - labels: chartTimesData.labels, - datasets: [ - { - backgroundColor: 'rgba(220,220,220,0.5)', - borderColor: 'rgba(220,220,220,1)', - borderWidth: 1, - barValueSpacing: 1, - barDatasetSpacing: 1, - data: chartTimesData.values, - }, - ], - }; - return new Chart( - $('#build_timesChart') - .get(0) - .getContext('2d'), - { - type: 'bar', - data, - options: barChartOptions(shouldAdjustFontSize), - }, - ); -}; - document.addEventListener('DOMContentLoaded', () => { - const chartTimesData = JSON.parse(document.getElementById('pipelinesTimesChartsData').innerHTML); const chartsData = JSON.parse(document.getElementById('pipelinesChartsData').innerHTML); // Scale fonts if window width lower than 768px (iPad portrait) const shouldAdjustFontSize = window.innerWidth < 768; - buildBarChart(chartTimesData, shouldAdjustFontSize); - chartsData.forEach(scope => buildChart(scope, shouldAdjustFontSize)); }); + +document.addEventListener('DOMContentLoaded', initProjectPipelinesChartsApp); |