diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 03:07:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 03:07:49 +0300 |
commit | de19091107816cd08b0b83f7d908776e71a43606 (patch) | |
tree | f63ae746b17fe5f95f72f111494e949a12acf6db /app/assets/javascripts/api | |
parent | 6cb5b3a92d526e8b675aba2d1455e7e00b8656f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/api')
-rw-r--r-- | app/assets/javascripts/api/analytics_api.js | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/app/assets/javascripts/api/analytics_api.js b/app/assets/javascripts/api/analytics_api.js index 66ed30130bb..35c9fa20e56 100644 --- a/app/assets/javascripts/api/analytics_api.js +++ b/app/assets/javascripts/api/analytics_api.js @@ -2,8 +2,8 @@ import axios from '~/lib/utils/axios_utils'; import { joinPaths } from '~/lib/utils/url_utility'; import { buildApiUrl } from './api_utils'; -const PROJECT_VSA_METRICS_BASE = '/:request_path/-/analytics/value_stream_analytics'; -const PROJECT_VSA_PATH_BASE = '/:request_path/-/analytics/value_stream_analytics/value_streams'; +const PROJECT_VSA_METRICS_BASE = '/:namespace_path/-/analytics/value_stream_analytics'; +const PROJECT_VSA_PATH_BASE = '/:namespace_path/-/analytics/value_stream_analytics/value_streams'; const PROJECT_VSA_STAGES_PATH = `${PROJECT_VSA_PATH_BASE}/:value_stream_id/stages`; const PROJECT_VSA_STAGE_DATA_PATH = `${PROJECT_VSA_STAGES_PATH}/:stage_id`; @@ -15,71 +15,77 @@ export const DEPLOYS_METRIC_TYPE = 'deploys'; export const METRIC_TYPE_SUMMARY = 'summary'; export const METRIC_TYPE_TIME_SUMMARY = 'time_summary'; -const buildProjectMetricsPath = (requestPath) => - buildApiUrl(PROJECT_VSA_METRICS_BASE).replace(':request_path', requestPath); +const buildProjectMetricsPath = (namespacePath) => + buildApiUrl(PROJECT_VSA_METRICS_BASE).replace(':namespace_path', namespacePath); -const buildProjectValueStreamPath = (requestPath, valueStreamId = null) => { +const buildProjectValueStreamPath = (namespacePath, valueStreamId = null) => { if (valueStreamId) { return buildApiUrl(PROJECT_VSA_STAGES_PATH) - .replace(':request_path', requestPath) + .replace(':namespace_path', namespacePath) .replace(':value_stream_id', valueStreamId); } - return buildApiUrl(PROJECT_VSA_PATH_BASE).replace(':request_path', requestPath); + return buildApiUrl(PROJECT_VSA_PATH_BASE).replace(':namespace_path', namespacePath); }; -const buildValueStreamStageDataPath = ({ requestPath, valueStreamId = null, stageId = null }) => +const buildValueStreamStageDataPath = ({ namespacePath, valueStreamId = null, stageId = null }) => buildApiUrl(PROJECT_VSA_STAGE_DATA_PATH) - .replace(':request_path', requestPath) + .replace(':namespace_path', namespacePath) .replace(':value_stream_id', valueStreamId) .replace(':stage_id', stageId); -export const getProjectValueStreams = (requestPath) => { - const url = buildProjectValueStreamPath(requestPath); +export const getProjectValueStreams = (namespacePath) => { + const url = buildProjectValueStreamPath(namespacePath); return axios.get(url); }; -export const getProjectValueStreamStages = (requestPath, valueStreamId) => { - const url = buildProjectValueStreamPath(requestPath, valueStreamId); +export const getProjectValueStreamStages = (namespacePath, valueStreamId) => { + const url = buildProjectValueStreamPath(namespacePath, valueStreamId); return axios.get(url); }; // NOTE: legacy VSA request use a different path -// the `requestPath` provides a full url for the request -export const getProjectValueStreamStageData = ({ requestPath, stageId, params }) => - axios.get(joinPaths(requestPath, 'events', stageId), { params }); +// the `namespacePath` provides a full url for the request +export const getProjectValueStreamStageData = ({ namespacePath, stageId, params }) => + axios.get(joinPaths(namespacePath, 'events', stageId), { params }); /** * Dedicated project VSA paths */ -export const getValueStreamStageMedian = ({ requestPath, valueStreamId, stageId }, params = {}) => { - const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId }); +export const getValueStreamStageMedian = ( + { namespacePath, valueStreamId, stageId }, + params = {}, +) => { + const stageBase = buildValueStreamStageDataPath({ namespacePath, valueStreamId, stageId }); return axios.get(joinPaths(stageBase, 'median'), { params }); }; export const getValueStreamStageRecords = ( - { requestPath, valueStreamId, stageId }, + { namespacePath, valueStreamId, stageId }, params = {}, ) => { - const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId }); + const stageBase = buildValueStreamStageDataPath({ namespacePath, valueStreamId, stageId }); return axios.get(joinPaths(stageBase, 'records'), { params }); }; -export const getValueStreamStageCounts = ({ requestPath, valueStreamId, stageId }, params = {}) => { - const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId }); +export const getValueStreamStageCounts = ( + { namespacePath, valueStreamId, stageId }, + params = {}, +) => { + const stageBase = buildValueStreamStageDataPath({ namespacePath, valueStreamId, stageId }); return axios.get(joinPaths(stageBase, 'count'), { params }); }; export const getValueStreamMetrics = ({ endpoint = METRIC_TYPE_SUMMARY, - requestPath, + requestPath: namespacePath, params = {}, }) => { - const metricBase = buildProjectMetricsPath(requestPath); + const metricBase = buildProjectMetricsPath(namespacePath); return axios.get(joinPaths(metricBase, endpoint), { params }); }; -export const getValueStreamSummaryMetrics = (requestPath, params = {}) => { - const metricBase = buildProjectMetricsPath(requestPath); +export const getValueStreamSummaryMetrics = (namespacePath, params = {}) => { + const metricBase = buildProjectMetricsPath(namespacePath); return axios.get(joinPaths(metricBase, 'summary'), { params }); }; |