From 9731ef33c1b6a172cd0501b8301dc591635b9a89 Mon Sep 17 00:00:00 2001 From: Libor Vanc Date: Tue, 9 Jan 2024 11:50:50 -1000 Subject: [PATCH 01/10] Added MetricTile component --- .../charts/components/pipeline_charts.vue | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue index 6422b4ac8d889b..654d4cbe8cc535 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue @@ -23,6 +23,7 @@ import { import getPipelineCountByStatus from '../graphql/queries/get_pipeline_count_by_status.query.graphql'; import getProjectPipelineStatistics from '../graphql/queries/get_project_pipeline_statistics.query.graphql'; import StatisticsList from './statistics_list.vue'; +import MetricTile from '~/analytics/shared/components/metric_tile.vue'; const defaultAnalyticsValues = { weekPipelinesTotals: [], @@ -54,6 +55,7 @@ export default { GlChartSeriesLabel, GlSkeletonLoader, StatisticsList, + MetricTile, CiCdAnalyticsCharts, }, inject: { @@ -70,6 +72,8 @@ export default { counts: { ...defaultCountValues }, tooltipTitle: '', tooltipContent: [], + metrics: [], + groupedMetrics: [], }; }, apollo: { @@ -212,6 +216,9 @@ export default { }, }; }, + hasGroupedMetrics() { + return Boolean(this.groupBy.length); + }, }, methods: { hideAlert() { @@ -324,15 +331,36 @@ export default { failure.text }}
-

{{ s__('PipelineCharts|CI/CD Analytics') }}

+

{{ s__('PipelineCharts|CI/CD Analytics') }}

-

{{ s__('PipelineCharts|Overall statistics') }}

-
+
+ + + +
-
+
{{ __('Pipeline durations for the last 30 commits') }} Date: Fri, 9 Feb 2024 12:17:51 -0500 Subject: [PATCH 02/10] Proposed format changes for CI/CD Analytics Update the layout of the CI/CD Analytics page to match design in the associated issue. - bulleted list of stats changed to row of GlSingleStat components - Pipeline charts moved above Pipeline durations chart Changelog: fixed --- .../charts/components/pipeline_charts.vue | 109 +++++++----------- .../charts/components/statistics_list.vue | 71 ++++++++---- locale/gitlab.pot | 19 ++- .../statistics_list_spec.js.snap | 92 +++++++++------ .../charts/components/statistics_list_spec.js | 18 +-- 5 files changed, 160 insertions(+), 149 deletions(-) diff --git a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue index 654d4cbe8cc535..b56c7c5e8eb45b 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue @@ -23,7 +23,6 @@ import { import getPipelineCountByStatus from '../graphql/queries/get_pipeline_count_by_status.query.graphql'; import getProjectPipelineStatistics from '../graphql/queries/get_project_pipeline_statistics.query.graphql'; import StatisticsList from './statistics_list.vue'; -import MetricTile from '~/analytics/shared/components/metric_tile.vue'; const defaultAnalyticsValues = { weekPipelinesTotals: [], @@ -55,7 +54,6 @@ export default { GlChartSeriesLabel, GlSkeletonLoader, StatisticsList, - MetricTile, CiCdAnalyticsCharts, }, inject: { @@ -72,8 +70,6 @@ export default { counts: { ...defaultCountValues }, tooltipTitle: '', tooltipContent: [], - metrics: [], - groupedMetrics: [], }; }, apollo: { @@ -216,9 +212,6 @@ export default { }, }; }, - hasGroupedMetrics() { - return Boolean(this.groupBy.length); - }, }, methods: { hideAlert() { @@ -333,67 +326,47 @@ export default {

{{ s__('PipelineCharts|CI/CD Analytics') }}

-
-
- - - - - - -
-
- {{ __('Pipeline durations for the last 30 commits') }} - -
+ +

{{ __('Pipelines charts') }}

+
+ + + +
+ + + + +

{{ __('Pipeline durations for the last 30 commits') }}

+
+ + +
- +
diff --git a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue index f921b2dfdd63c4..c0390678d1ac7b 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue @@ -1,13 +1,16 @@ diff --git a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue index f921b2dfdd63c4..c0390678d1ac7b 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue @@ -1,13 +1,16 @@
-- GitLab From f8e3ee26ebc8677aaa87b87eaec49db1fe4a9e2a Mon Sep 17 00:00:00 2001 From: Chad Lavimoniere Date: Thu, 22 Feb 2024 11:56:18 -0500 Subject: [PATCH 08/10] Fix failing rspec --- spec/features/projects/graph_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/projects/graph_spec.rb b/spec/features/projects/graph_spec.rb index effe743ac81e27..dbafd236b21ffa 100644 --- a/spec/features/projects/graph_spec.rb +++ b/spec/features/projects/graph_spec.rb @@ -95,7 +95,7 @@ end it 'renders CI graphs' do - expect(page).to have_content 'Overall' + expect(page).to have_content 'CI/CD Analytics' expect(page).to have_content 'Last week' expect(page).to have_content 'Last month' expect(page).to have_content 'Last year' -- GitLab From 36314b7853e69f6a75cad2a49c71d7d3110fd90b Mon Sep 17 00:00:00 2001 From: Chad Lavimoniere Date: Mon, 26 Feb 2024 10:50:09 -0500 Subject: [PATCH 09/10] Address feedback from @ekigbo --- .../charts/components/statistics_list.vue | 20 +++++------- .../statistics_list_spec.js.snap | 6 ++++ .../charts/components/statistics_list_spec.js | 32 +++++++++++++++---- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue index 6cde3c9bf6c99d..8de2ad817231d2 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue @@ -54,15 +54,14 @@ export default { value: formatNumber(this.counts.failed), link: this.failedPipelinesLink, }, - /** NOT IMPLEMENTED */ - // { - // label: s__('PipelineCharts|Average duration'), - // identifier: 'average-duration', - // value: formatNumber(this.counts.failed), - // }, ]; }, }, + methods: { + shouldDisplayLink(statistic) { + return statistic.link && statistic.value !== 0; + }, + }, };
diff --git a/spec/frontend/projects/pipelines/charts/components/__snapshots__/statistics_list_spec.js.snap b/spec/frontend/projects/pipelines/charts/components/__snapshots__/statistics_list_spec.js.snap index 27a33ee49cabda..c47579185e1a40 100644 --- a/spec/frontend/projects/pipelines/charts/components/__snapshots__/statistics_list_spec.js.snap +++ b/spec/frontend/projects/pipelines/charts/components/__snapshots__/statistics_list_spec.js.snap @@ -55,6 +55,12 @@ exports[`StatisticsList displays the counts data with labels 1`] = ` value="20,000" variant="muted" /> + + See details +
`; diff --git a/spec/frontend/projects/pipelines/charts/components/statistics_list_spec.js b/spec/frontend/projects/pipelines/charts/components/statistics_list_spec.js index b7a04055b2408d..02560fa3fa12b9 100644 --- a/spec/frontend/projects/pipelines/charts/components/statistics_list_spec.js +++ b/spec/frontend/projects/pipelines/charts/components/statistics_list_spec.js @@ -1,9 +1,4 @@ -/** - * NOTE: the link to failed pipelines cannot be included in GlSingleStat as it is currently implemented. - * Relevant lines in this file have been removed. - * - * See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141307#note_1766620265 for more details. - */ +import { GlLink } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import Component from '~/projects/pipelines/charts/components/statistics_list.vue'; import { counts } from '../mock_data'; @@ -11,8 +6,15 @@ import { counts } from '../mock_data'; describe('StatisticsList', () => { let wrapper; + const failedPipelinesLink = '/flightjs/Flight/-/pipelines?page=1&scope=all&status=failed'; + + const findFailedPipelinesLink = () => wrapper.findComponent(GlLink); + beforeEach(() => { wrapper = shallowMount(Component, { + provide: { + failedPipelinesLink, + }, propsData: { counts, }, @@ -22,4 +24,22 @@ describe('StatisticsList', () => { it('displays the counts data with labels', () => { expect(wrapper.element).toMatchSnapshot(); }); + + it('displays failed pipelines link', () => { + expect(findFailedPipelinesLink().attributes('href')).toBe(failedPipelinesLink); + }); + + describe('with no failed piplines link', () => { + beforeEach(() => { + wrapper = shallowMount(Component, { + propsData: { + counts, + }, + }); + }); + + it('hides the failed pipelines link', () => { + expect(findFailedPipelinesLink().exists()).toBe(false); + }); + }); }); -- GitLab From 99a73910669ee2807ba05d72d6a81908b51b11de Mon Sep 17 00:00:00 2001 From: Chad Lavimoniere Date: Tue, 27 Feb 2024 10:17:57 -0500 Subject: [PATCH 10/10] Remove updated loading animations As recommended by @ekigbo, they'll be moved to a separate MR --- .../charts/components/pipeline_charts.vue | 15 ++------ .../charts/components/statistics_list.vue | 36 ++++++++----------- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue index b56c7c5e8eb45b..20ae0a7fc83e56 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/pipeline_charts.vue @@ -326,15 +326,10 @@ export default {

{{ s__('PipelineCharts|CI/CD Analytics') }}

- + +

{{ __('Pipelines charts') }}

-
- - - -

{{ __('Pipeline durations for the last 30 commits') }}

-
- - - -
-import { GlLink, GlSkeletonLoader } from '@gitlab/ui'; +import { GlLink } from '@gitlab/ui'; import { GlSingleStat } from '@gitlab/ui/dist/charts'; import { SUPPORTED_FORMATS, getFormatter } from '~/lib/utils/unit_format'; import { s__, formatNumber } from '~/locale'; @@ -10,7 +10,6 @@ export default { components: { GlLink, GlSingleStat, - GlSkeletonLoader, }, inject: { failedPipelinesLink: { @@ -66,25 +65,18 @@ export default { -- GitLab