diff --git a/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue b/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue index d90c504159dff98adf77d0926eb251f756637b73..7f9fd3a7d3a810662f8c8eb75f7f820952509a8a 100644 --- a/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue +++ b/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/app.vue @@ -7,7 +7,6 @@ import ChangeFailureRateCharts from 'ee/dora/components/change_failure_rate_char import { mergeUrlParams, updateHistory, getParameterValues } from '~/lib/utils/url_utility'; import API from '~/api'; import ReleaseStatsCard from './release_stats_card.vue'; -import SharedRunnersUsage from './shared_runner_usage.vue'; export default { name: 'CiCdAnalyticsApp', @@ -20,7 +19,6 @@ export default { LeadTimeCharts, TimeToRestoreServiceCharts, ChangeFailureRateCharts, - SharedRunnersUsage, }, releaseStatisticsTabEvent: 'g_analytics_ci_cd_release_statistics', deploymentFrequencyTabEvent: 'g_analytics_ci_cd_deployment_frequency', @@ -130,9 +128,6 @@ export default { <change-failure-rate-charts /> </gl-tab> </template> - <gl-tab :title="s__('CICDAnalytics|Shared runner usage')"> - <shared-runners-usage /> - </gl-tab> <template v-if="canViewGroupUsageQuotaBoolean" #tabs-end> <gl-link :href="pipelineGroupUsageQuotaPath" class="gl-align-self-center gl-ml-auto">{{ __('View group pipeline usage quota') diff --git a/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/shared_runner_usage.vue b/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/shared_runner_usage.vue deleted file mode 100644 index c42fe73ea65313b6935e13bf9bf7da858ab21450..0000000000000000000000000000000000000000 --- a/ee/app/assets/javascripts/analytics/group_ci_cd_analytics/components/shared_runner_usage.vue +++ /dev/null @@ -1,117 +0,0 @@ -<script> -import { GlIcon, GlPopover } from '@gitlab/ui'; -import { GlAreaChart } from '@gitlab/ui/dist/charts'; -import { formatDate } from '~/lib/utils/datetime_utility'; -import { TYPE_GROUP } from '~/graphql_shared/constants'; -import { convertToGraphQLId } from '~/graphql_shared/utils'; -import { s__, __ } from '~/locale'; -import { formatWithUtc } from '../constants'; -import getCiMinutesUsageByNamespace from '../graphql/ci_minutes.query.graphql'; - -const timeFormatter = (val) => val; - -export default { - components: { - GlIcon, - GlPopover, - GlAreaChart, - }, - i18n: { - sharedRunnersUsage: s__('CICDAnalytics|Shared Runners Usage'), - xAxisLabel: __('Month'), - yAxisLabel: __('Minutes'), - seriesName: s__('CICDAnalytics|Shared runner pipeline minute duration by month'), - }, - popoverOptions: { - triggers: 'hover', - placement: 'top', - content: s__( - 'CICDAnalytics|Shared runner usage is the total runtime of all jobs that ran on shared runners', - ), - title: s__('CICDAnalytics|What is shared runner usage?'), - }, - inject: ['groupId'], - data() { - return { - ciMinutesUsage: [], - }; - }, - apollo: { - ciMinutesUsage: { - query: getCiMinutesUsageByNamespace, - variables() { - return { - namespaceId: convertToGraphQLId(TYPE_GROUP, this.groupId), - }; - }, - update(res) { - return res?.ciMinutesUsage?.nodes; - }, - }, - }, - computed: { - chartOptions() { - return { - xAxis: { - name: this.$options.i18n.xAxisLabel, - type: 'category', - }, - yAxis: { - name: this.$options.i18n.yAxisLabel, - axisLabel: { - formatter: timeFormatter, - }, - }, - }; - }, - minutesUsageDataByMonth() { - return this.ciMinutesUsage - .slice() - .sort((a, b) => { - return new Date(a.monthIso8601) - new Date(b.monthIso8601); - }) - .map((cur) => [ - formatDate(cur.monthIso8601, 'mmm yyyy', formatWithUtc), - parseFloat((cur.sharedRunnersDuration / 60).toFixed(2)), - ]); - }, - isDataEmpty() { - return this.minutesUsageDataByMonth.length === 0; - }, - chartData() { - return [ - { - data: this.minutesUsageDataByMonth, - name: this.$options.i18n.seriesName, - }, - ]; - }, - }, -}; -</script> -<template> - <div class="gl-mt-4"> - <div class="gl-display-flex gl-align-items-center gl-mb-4"> - <div class="gl-display-flex"> - <h3 class="gl-mr-2 gl-my-0">{{ $options.i18n.sharedRunnersUsage }}</h3> - </div> - <div id="shared-runner-message-popover-container" class="gl-display-flex"> - <span id="shared-runner-question"> - <gl-icon class="gl-text-blue-500" name="question-o" /> - </span> - <gl-popover - target="shared-runner-question" - container="shared-runner-message-popover-container" - v-bind="$options.popoverOptions" - /> - </div> - </div> - <gl-area-chart - v-if="!isDataEmpty" - :data="chartData" - :option="chartOptions" - :width="0" - responsive - /> - </div> -</template> diff --git a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js b/ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js index 63bdab6c359549896bc74b0351180645602ee80d..f75738242ac7c3019a98135800afaebc9d96ce69 100644 --- a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js +++ b/ee/spec/frontend/analytics/group_ci_cd_analytics/components/app_spec.js @@ -3,7 +3,6 @@ import { merge } from 'lodash'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import CiCdAnalyticsApp from 'ee/analytics/group_ci_cd_analytics/components/app.vue'; import ReleaseStatsCard from 'ee/analytics/group_ci_cd_analytics/components/release_stats_card.vue'; -import SharedRunnersUsage from 'ee/analytics/group_ci_cd_analytics/components/shared_runner_usage.vue'; import DeploymentFrequencyCharts from 'ee/dora/components/deployment_frequency_charts.vue'; import LeadTimeCharts from 'ee/dora/components/lead_time_charts.vue'; import TimeToRestoreServiceCharts from 'ee/dora/components/time_to_restore_service_charts.vue'; @@ -58,7 +57,6 @@ describe('ee/analytics/group_ci_cd_analytics/components/app.vue', () => { 'Lead time', 'Time to restore service', 'Change failure rate', - 'Shared runner usage', ].forEach((tabName, index) => { expect(findGlTabAtIndex(index).attributes('title')).toBe(tabName); }); @@ -97,10 +95,6 @@ describe('ee/analytics/group_ci_cd_analytics/components/app.vue', () => { expect(wrapper.findComponent(ReleaseStatsCard).exists()).toBe(true); }); - it('renders the shared runner usage component', () => { - expect(wrapper.findComponent(SharedRunnersUsage).exists()).toBe(true); - }); - it('does not render the DORA chart components', () => { expect(wrapper.findComponent(DeploymentFrequencyCharts).exists()).toBe(false); expect(wrapper.findComponent(LeadTimeCharts).exists()).toBe(false); diff --git a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/mock_data.js b/ee/spec/frontend/analytics/group_ci_cd_analytics/components/mock_data.js index d52349c5992d211a84068638a7f3c6a391556771..fd712698a7fce0b578e01043ace8e2f5115253cc 100644 --- a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/mock_data.js +++ b/ee/spec/frontend/analytics/group_ci_cd_analytics/components/mock_data.js @@ -11,36 +11,3 @@ export const groupReleaseStatsQueryResponse = { }, }, }; - -export const ciMinutesUsageNamespace = { - data: { - ciMinutesUsage: { - nodes: [ - { - month: 'December', - monthIso8601: '2021-12-01', - sharedRunnersDuration: 110, - __typename: 'CiMinutesNamespaceMonthlyUsage', - }, - { - month: 'November', - monthIso8601: '2021-11-01', - sharedRunnersDuration: 95, - __typename: 'CiMinutesNamespaceMonthlyUsage', - }, - { - month: 'October', - monthIso8601: '2021-10-01', - sharedRunnersDuration: 85, - __typename: 'CiMinutesNamespaceMonthlyUsage', - }, - { - month: 'September', - monthIso8601: '2021-09-01', - sharedRunnersDuration: 85, - __typename: 'CiMinutesNamespaceMonthlyUsage', - }, - ], - }, - }, -}; diff --git a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/shared_runner_usage_spec.js b/ee/spec/frontend/analytics/group_ci_cd_analytics/components/shared_runner_usage_spec.js deleted file mode 100644 index e3051f1a05b26c0a0ce93b67e3f4c7500e2a4452..0000000000000000000000000000000000000000 --- a/ee/spec/frontend/analytics/group_ci_cd_analytics/components/shared_runner_usage_spec.js +++ /dev/null @@ -1,108 +0,0 @@ -import timezoneMock from 'timezone-mock'; -import { GlAreaChart } from '@gitlab/ui/dist/charts'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import VueApollo from 'vue-apollo'; -import SharedRunnerUsage from 'ee/analytics/group_ci_cd_analytics/components/shared_runner_usage.vue'; -import getCiMinutesUsageByNamespace from 'ee/analytics/group_ci_cd_analytics/graphql/ci_minutes.query.graphql'; -import createMockApollo from 'helpers/mock_apollo_helper'; -import waitForPromises from 'helpers/wait_for_promises'; -import { ciMinutesUsageNamespace } from './mock_data'; - -const localVue = createLocalVue(); -localVue.use(VueApollo); - -describe('Shared runner usage tab', () => { - let wrapper; - - const createComponent = ({ isLoading = false, options } = {}) => { - const mockApolloLoading = { - mocks: { - $apollo: { - queries: { - ciMinutesUsage: { - loading: isLoading, - }, - }, - }, - }, - }; - const mock = options?.apolloProvider ? {} : mockApolloLoading; - - wrapper = shallowMount(SharedRunnerUsage, { - provide: { - groupId: '1', - }, - ...mock, - ...options, - }); - }; - - const createComponentWithApollo = () => { - const ciMinutesMock = jest.fn().mockResolvedValue(ciMinutesUsageNamespace); - - const handlers = [[getCiMinutesUsageByNamespace, ciMinutesMock]]; - const apolloProvider = createMockApollo(handlers); - - createComponent({ - options: { - localVue, - apolloProvider, - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - }); - - const findAreaChart = () => wrapper.findComponent(GlAreaChart); - - describe('when the data has successfully loaded', () => { - beforeEach(async () => { - createComponentWithApollo(); - await waitForPromises(); - }); - - it('should display the chart', () => { - expect(findAreaChart().exists()).toBe(true); - }); - - it('should contain a responsive attribute for the area chart', () => { - expect(findAreaChart().attributes('responsive')).toBeDefined(); - }); - }); - - describe('when the component is loading data', () => { - beforeEach(() => { - createComponent({ isLoading: true }); - }); - - it('should not display the chart', () => { - expect(findAreaChart().exists()).toBe(false); - }); - }); - - describe.each` - timezone - ${'Europe/London'} - ${'US/Pacific'} - `('when viewing in timezone', ({ timezone }) => { - describe(timezone, () => { - beforeEach(async () => { - timezoneMock.register(timezone); - - createComponentWithApollo(); - - await waitForPromises(); - }); - - afterEach(() => { - timezoneMock.unregister(); - }); - - it('has the right start month', () => { - expect(findAreaChart().props('data')[0].data[0][0]).toEqual('Sep 2021'); - }); - }); - }); -}); diff --git a/locale/gitlab.pot b/locale/gitlab.pot index f289d58ea6c9bd9861c760fd5be088e6261a3929..16239f38215db9b78cb9cd0b4c5d0aa6f2db5ec3 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -7111,21 +7111,12 @@ msgstr "" msgid "CICDAnalytics|Releases" msgstr "" -msgid "CICDAnalytics|Shared Runners Usage" -msgstr "" - msgid "CICDAnalytics|Shared runner duration is the total runtime of all jobs that ran on shared runners" msgstr "" msgid "CICDAnalytics|Shared runner pipeline minute duration by month" msgstr "" -msgid "CICDAnalytics|Shared runner usage" -msgstr "" - -msgid "CICDAnalytics|Shared runner usage is the total runtime of all jobs that ran on shared runners" -msgstr "" - msgid "CICDAnalytics|Something went wrong while fetching release statistics" msgstr "" @@ -7135,9 +7126,6 @@ msgstr "" msgid "CICDAnalytics|What is shared runner duration?" msgstr "" -msgid "CICDAnalytics|What is shared runner usage?" -msgstr "" - msgid "CICD|Add a %{base_domain_link_start}base domain%{link_end} to your %{kubernetes_cluster_link_start}Kubernetes cluster%{link_end} for your deployment strategy to work." msgstr ""