From 0434f38ef1dce4fe640fe1e4542235746ceb943c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 31 Jan 2020 18:09:11 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- Gemfile | 3 +- Gemfile.lock | 2 +- app/assets/javascripts/merge_request.js | 2 +- .../pages/projects/pipelines/charts/index.js | 35 +----- .../projects/pipelines/charts/components/app.vue | 72 +++++++++++ .../charts/components/statistics_list.vue | 30 +++++ .../projects/pipelines/charts/constants.js | 7 ++ .../javascripts/projects/pipelines/charts/index.js | 37 ++++++ .../serverless/components/functions.vue | 2 +- app/assets/stylesheets/pages/trials.scss | 15 +++ app/controllers/concerns/page_limiter.rb | 2 +- app/models/prometheus_metric.rb | 3 +- app/models/prometheus_metric_enums.rb | 10 +- app/presenters/release_presenter.rb | 6 + app/views/projects/pipelines/charts.html.haml | 3 +- app/views/projects/pipelines/charts/_overall.haml | 6 - .../pipelines/charts/_pipeline_statistics.haml | 14 --- .../projects/pipelines/charts/_pipeline_times.haml | 8 -- app/views/projects/snippets/index.html.haml | 7 +- .../shared/empty_states/_profile_tabs.html.haml | 3 +- .../196183-convert-ci-cd-charts-to-echarts.yml | 5 + ...-access-policy-check-for-new-snippet-button.yml | 6 + .../unreleased/bw-merge-request-permission.yml | 5 + .../unreleased/refactoring-entities-file-7.yml | 5 + changelogs/unreleased/sh-fix-trigger-check-rds.yml | 5 + config/environments/development.rb | 4 - doc/development/code_review.md | 6 +- doc/development/documentation/styleguide.md | 5 +- doc/user/incident_management/index.md | 24 ---- doc/user/project/img/labels_delete_v12_1.png | Bin 9531 -> 0 bytes doc/user/project/img/labels_list_v12_1.png | Bin 104907 -> 0 bytes .../project/img/labels_new_label_from_sidebar.gif | Bin 759243 -> 0 bytes .../img/prometheus_dashboard_column_panel_type.png | Bin 0 -> 13219 bytes .../img/prometheus_service_configuration.png | Bin 18100 -> 5022 bytes doc/user/project/integrations/prometheus.md | 32 ++++- lib/api/entities.rb | 46 +------ lib/api/entities/commit.rb | 14 +++ lib/api/entities/commit_detail.rb | 22 ++++ lib/api/entities/commit_signature.rb | 12 ++ lib/api/entities/commit_stats.rb | 9 ++ lib/api/entities/commit_with_stats.rb | 9 ++ lib/api/entities/diff_refs.rb | 9 ++ lib/gitlab/alerting/notification_payload_parser.rb | 75 ++++++++++++ lib/gitlab/database/grant.rb | 11 +- lib/gitlab/database_importers/common_metrics.rb | 2 - .../common_metrics/prometheus_metric_enums.rb | 9 +- locale/gitlab.pot | 6 +- spec/controllers/concerns/page_limiter_spec.rb | 20 ++- .../explore/projects_controller_spec.rb | 10 +- spec/features/projects/graph_spec.rb | 2 +- .../projects/snippets/user_views_snippets_spec.rb | 97 ++++++++++++--- spec/features/task_lists_spec.rb | 31 +++-- .../__snapshots__/statistics_list_spec.js.snap | 45 +++++++ .../pipelines/charts/components/app_spec.js | 42 +++++++ .../charts/components/statistics_list_spec.js | 24 ++++ .../projects/pipelines/charts/mock_data.js | 11 ++ .../alerting/notification_payload_parser_spec.rb | 134 +++++++++++++++++++++ spec/models/prometheus_metric_spec.rb | 3 + spec/presenters/release_presenter_spec.rb | 16 +++ 59 files changed, 820 insertions(+), 203 deletions(-) create mode 100644 app/assets/javascripts/projects/pipelines/charts/components/app.vue create mode 100644 app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue create mode 100644 app/assets/javascripts/projects/pipelines/charts/constants.js create mode 100644 app/assets/javascripts/projects/pipelines/charts/index.js create mode 100644 app/assets/stylesheets/pages/trials.scss delete mode 100644 app/views/projects/pipelines/charts/_overall.haml delete mode 100644 app/views/projects/pipelines/charts/_pipeline_statistics.haml delete mode 100644 app/views/projects/pipelines/charts/_pipeline_times.haml create mode 100644 changelogs/unreleased/196183-convert-ci-cd-charts-to-echarts.yml create mode 100644 changelogs/unreleased/al-55240-access-policy-check-for-new-snippet-button.yml create mode 100644 changelogs/unreleased/bw-merge-request-permission.yml create mode 100644 changelogs/unreleased/refactoring-entities-file-7.yml create mode 100644 changelogs/unreleased/sh-fix-trigger-check-rds.yml delete mode 100644 doc/user/project/img/labels_delete_v12_1.png delete mode 100644 doc/user/project/img/labels_list_v12_1.png delete mode 100644 doc/user/project/img/labels_new_label_from_sidebar.gif create mode 100644 doc/user/project/integrations/img/prometheus_dashboard_column_panel_type.png create mode 100644 lib/api/entities/commit.rb create mode 100644 lib/api/entities/commit_detail.rb create mode 100644 lib/api/entities/commit_signature.rb create mode 100644 lib/api/entities/commit_stats.rb create mode 100644 lib/api/entities/commit_with_stats.rb create mode 100644 lib/api/entities/diff_refs.rb create mode 100644 lib/gitlab/alerting/notification_payload_parser.rb create mode 100644 spec/frontend/projects/pipelines/charts/components/__snapshots__/statistics_list_spec.js.snap create mode 100644 spec/frontend/projects/pipelines/charts/components/app_spec.js create mode 100644 spec/frontend/projects/pipelines/charts/components/statistics_list_spec.js create mode 100644 spec/frontend/projects/pipelines/charts/mock_data.js create mode 100644 spec/lib/gitlab/alerting/notification_payload_parser_spec.rb diff --git a/Gemfile b/Gemfile index 6ac02e92667..ac1d3d8e9c6 100644 --- a/Gemfile +++ b/Gemfile @@ -332,7 +332,6 @@ group :metrics do end group :development do - gem 'listen', '~> 3.0' gem 'brakeman', '~> 4.2', require: false gem 'danger', '~> 6.0', require: false @@ -487,3 +486,5 @@ gem 'liquid', '~> 4.0' # LRU cache gem 'lru_redux' + +gem 'erubi', '~> 1.9.0' diff --git a/Gemfile.lock b/Gemfile.lock index e61068bbf7f..ee870d6d3f5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1205,6 +1205,7 @@ DEPENDENCIES elasticsearch-rails (~> 6.1) email_reply_trimmer (~> 0.1) email_spec (~> 2.2.0) + erubi (~> 1.9.0) escape_utils (~> 1.1) factory_bot_rails (~> 5.1.0) faraday (~> 0.12) @@ -1279,7 +1280,6 @@ DEPENDENCIES license_finder (~> 5.4) licensee (~> 8.9) liquid (~> 4.0) - listen (~> 3.0) lograge (~> 0.5) loofah (~> 2.2) lru_redux diff --git a/app/assets/javascripts/merge_request.js b/app/assets/javascripts/merge_request.js index 3a7ade5ad94..6c794c1d324 100644 --- a/app/assets/javascripts/merge_request.js +++ b/app/assets/javascripts/merge_request.js @@ -24,7 +24,7 @@ function MergeRequest(opts) { this.initCommitMessageListeners(); this.closeReopenReportToggle = IssuablesHelper.initCloseReopenReport(); - if ($('a.btn-close').length) { + if ($('.description.js-task-list-container').length) { this.taskList = new TaskList({ dataType: 'merge_request', fieldName: 'description', 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); diff --git a/app/assets/javascripts/projects/pipelines/charts/components/app.vue b/app/assets/javascripts/projects/pipelines/charts/components/app.vue new file mode 100644 index 00000000000..4bd72c405ee --- /dev/null +++ b/app/assets/javascripts/projects/pipelines/charts/components/app.vue @@ -0,0 +1,72 @@ + + diff --git a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue new file mode 100644 index 00000000000..cd9e464c5ac --- /dev/null +++ b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue @@ -0,0 +1,30 @@ + + diff --git a/app/assets/javascripts/projects/pipelines/charts/constants.js b/app/assets/javascripts/projects/pipelines/charts/constants.js new file mode 100644 index 00000000000..eeb29370e51 --- /dev/null +++ b/app/assets/javascripts/projects/pipelines/charts/constants.js @@ -0,0 +1,7 @@ +export const CHART_CONTAINER_HEIGHT = 300; + +export const INNER_CHART_HEIGHT = 200; + +export const X_AXIS_LABEL_ROTATION = 45; + +export const X_AXIS_TITLE_OFFSET = 60; diff --git a/app/assets/javascripts/projects/pipelines/charts/index.js b/app/assets/javascripts/projects/pipelines/charts/index.js new file mode 100644 index 00000000000..b0f5f549980 --- /dev/null +++ b/app/assets/javascripts/projects/pipelines/charts/index.js @@ -0,0 +1,37 @@ +import Vue from 'vue'; +import ProjectPipelinesCharts from './components/app.vue'; + +export default () => { + const el = document.querySelector('#js-project-pipelines-charts-app'); + const { + countsFailed, + countsSuccess, + countsTotal, + successRatio, + timesChartLabels, + timesChartValues, + } = el.dataset; + + return new Vue({ + el, + name: 'ProjectPipelinesChartsApp', + components: { + ProjectPipelinesCharts, + }, + render: createElement => + createElement(ProjectPipelinesCharts, { + props: { + counts: { + failed: countsFailed, + success: countsSuccess, + total: countsTotal, + successRatio, + }, + timesChartData: { + labels: JSON.parse(timesChartLabels), + values: JSON.parse(timesChartValues), + }, + }, + }), + }); +}; diff --git a/app/assets/javascripts/serverless/components/functions.vue b/app/assets/javascripts/serverless/components/functions.vue index cdbf57f3e55..e06149f2bcb 100644 --- a/app/assets/javascripts/serverless/components/functions.vue +++ b/app/assets/javascripts/serverless/components/functions.vue @@ -74,7 +74,7 @@ export default {