From 32d0191b12df24d69a31aadc39ecb449650d6fee Mon Sep 17 00:00:00 2001 From: Ezekiel Kigbo <3397881-ekigbo@users.noreply.gitlab.com> Date: Wed, 17 Apr 2024 04:51:33 +0000 Subject: [PATCH] Minor AI impact utils improvements --- app/assets/javascripts/analytics/shared/constants.js | 2 +- .../dashboards/ai_impact/components/metric_table.vue | 4 ++-- .../analytics/dashboards/ai_impact/constants.js | 4 ++-- .../analytics/dashboards/ai_impact/utils.js | 8 ++++---- .../dashboards/components/metric_table_cell.vue | 2 +- locale/gitlab.pot | 12 ++++++------ 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/analytics/shared/constants.js b/app/assets/javascripts/analytics/shared/constants.js index 144f02582ef5..7cbb3e686508 100644 --- a/app/assets/javascripts/analytics/shared/constants.js +++ b/app/assets/javascripts/analytics/shared/constants.js @@ -234,7 +234,7 @@ export const METRIC_TOOLTIPS = { }, [AI_METRICS.CODE_SUGGESTIONS_USAGE_RATE]: { description: s__( - 'ValueStreamAnalytics|Monthly user engagement with AI Code Suggestions. Percentage ratio calculated as monthly unique Code Suggestions users / total monthly unique code contributors.', + 'AiImpactAnalytics|Monthly user engagement with AI Code Suggestions. Percentage ratio calculated as monthly unique Code Suggestions users / total monthly unique code contributors.', ), groupLink: '', projectLink: '', diff --git a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/components/metric_table.vue b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/components/metric_table.vue index e0ce5cafea57..dfc0e8428df8 100644 --- a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/components/metric_table.vue +++ b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/components/metric_table.vue @@ -18,7 +18,7 @@ import { generateTableRows, } from '../utils'; import { - TABLE_METRICS, + AI_IMPACT_TABLE_METRICS, SUPPORTED_DORA_METRICS, SUPPORTED_FLOW_METRICS, SUPPORTED_VULNERABILITY_METRICS, @@ -99,7 +99,7 @@ export default { // Return an array of the failed metric IDs return result .reduce((acc, { reason = [] }) => acc.concat(reason), []) - .map((metric) => TABLE_METRICS[metric].label); + .map((metric) => AI_IMPACT_TABLE_METRICS[metric].label); }, async fetchTableMetrics({ metrics, queryFn }) { diff --git a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/constants.js b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/constants.js index 80cbf9bb04f3..a3ad95a77707 100644 --- a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/constants.js +++ b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/constants.js @@ -20,14 +20,14 @@ export const SUPPORTED_VULNERABILITY_METRICS = [VULNERABILITY_METRICS.CRITICAL]; export const SUPPORTED_AI_METRICS = [AI_METRICS.CODE_SUGGESTIONS_USAGE_RATE]; -export const TABLE_METRICS = { +export const AI_IMPACT_TABLE_METRICS = { ...pick(VSD_TABLE_METRICS, [ ...SUPPORTED_FLOW_METRICS, ...SUPPORTED_DORA_METRICS, ...SUPPORTED_VULNERABILITY_METRICS, ]), [AI_METRICS.CODE_SUGGESTIONS_USAGE_RATE]: { - label: s__('DORA4Metrics|Code Suggestions usage'), + label: s__('AiImpactAnalytics|Code Suggestions usage'), units: UNITS.PERCENT, }, }; diff --git a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/utils.js b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/utils.js index e9dbba29371b..258f870de3a9 100644 --- a/ee/app/assets/javascripts/analytics/dashboards/ai_impact/utils.js +++ b/ee/app/assets/javascripts/analytics/dashboards/ai_impact/utils.js @@ -7,10 +7,10 @@ import { nSecondsBefore, } from '~/lib/utils/datetime_utility'; import { formatMetric, percentChange, isMetricInTimePeriods } from '../utils'; -import { TABLE_METRICS } from './constants'; +import { AI_IMPACT_TABLE_METRICS } from './constants'; -const getStartOfMonth = (now) => dateAtFirstDayOfMonth(getStartOfDay(now)); const getColumnKeyForMonth = (monthsAgo) => `${monthsAgo}-months-ago`; +const getStartOfMonth = (now) => dateAtFirstDayOfMonth(getStartOfDay(now)); /** * Generates the time period columns, from This month -> 5 months ago. @@ -76,7 +76,7 @@ export const generateTableColumns = (now) => [ * @returns {Array} array of data-less table rows */ export const generateSkeletonTableData = () => - Object.entries(TABLE_METRICS).map(([identifier, { label, invertTrendColor }]) => ({ + Object.entries(AI_IMPACT_TABLE_METRICS).map(([identifier, { label, invertTrendColor }]) => ({ metric: { identifier, value: label }, invertTrendColor, })); @@ -118,7 +118,7 @@ const buildTableRow = ({ identifier, units, timePeriods }) => { * @returns {Object} object containing the same data, formatted for the table */ export const generateTableRows = (timePeriods) => - Object.entries(TABLE_METRICS).reduce((acc, [identifier, { units }]) => { + Object.entries(AI_IMPACT_TABLE_METRICS).reduce((acc, [identifier, { units }]) => { if (!isMetricInTimePeriods(identifier, timePeriods)) return acc; return Object.assign(acc, { diff --git a/ee/app/assets/javascripts/analytics/dashboards/components/metric_table_cell.vue b/ee/app/assets/javascripts/analytics/dashboards/components/metric_table_cell.vue index 925b59838266..ffa11f2df5bb 100644 --- a/ee/app/assets/javascripts/analytics/dashboards/components/metric_table_cell.vue +++ b/ee/app/assets/javascripts/analytics/dashboards/components/metric_table_cell.vue @@ -4,7 +4,7 @@ import { joinPaths, mergeUrlParams } from '~/lib/utils/url_utility'; import { METRIC_TOOLTIPS } from '~/analytics/shared/constants'; import { s__ } from '~/locale'; import { TABLE_METRICS } from '../constants'; -import { TABLE_METRICS as AI_IMPACT_TABLE_METRICS } from '../ai_impact/constants'; +import { AI_IMPACT_TABLE_METRICS } from '../ai_impact/constants'; export default { name: 'MetricTableCell', diff --git a/locale/gitlab.pot b/locale/gitlab.pot index a0f8363796cf..7a22b15b2985 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4642,6 +4642,12 @@ msgstr "" msgid "AiAnalytics|the ClickHouse data store is not available" msgstr "" +msgid "AiImpactAnalytics|Code Suggestions usage" +msgstr "" + +msgid "AiImpactAnalytics|Monthly user engagement with AI Code Suggestions. Percentage ratio calculated as monthly unique Code Suggestions users / total monthly unique code contributors." +msgstr "" + msgid "Akismet" msgstr "" @@ -15970,9 +15976,6 @@ msgstr "" msgid "DORA4Metrics|Change failure rate (percentage)" msgstr "" -msgid "DORA4Metrics|Code Suggestions usage" -msgstr "" - msgid "DORA4Metrics|Contributor count" msgstr "" @@ -56215,9 +56218,6 @@ msgstr "" msgid "ValueStreamAnalytics|Merge request analytics" msgstr "" -msgid "ValueStreamAnalytics|Monthly user engagement with AI Code Suggestions. Percentage ratio calculated as monthly unique Code Suggestions users / total monthly unique code contributors." -msgstr "" - msgid "ValueStreamAnalytics|New Value Stream" msgstr "" -- GitLab