Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/assets/javascripts/api
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/api')
-rw-r--r--app/assets/javascripts/api/analytics_api.js72
1 files changed, 52 insertions, 20 deletions
diff --git a/app/assets/javascripts/api/analytics_api.js b/app/assets/javascripts/api/analytics_api.js
index fd9b0160b0d..c7a53288ae4 100644
--- a/app/assets/javascripts/api/analytics_api.js
+++ b/app/assets/javascripts/api/analytics_api.js
@@ -1,51 +1,83 @@
import axios from '~/lib/utils/axios_utils';
+import { joinPaths } from '~/lib/utils/url_utility';
import { buildApiUrl } from './api_utils';
-const GROUP_VSA_PATH_BASE =
- '/groups/:id/-/analytics/value_stream_analytics/value_streams/:value_stream_id/stages/:stage_id';
-const PROJECT_VSA_PATH_BASE = '/:project_path/-/analytics/value_stream_analytics/value_streams';
+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_STAGES_PATH = `${PROJECT_VSA_PATH_BASE}/:value_stream_id/stages`;
+const PROJECT_VSA_STAGE_DATA_PATH = `${PROJECT_VSA_STAGES_PATH}/:stage_id`;
-const buildProjectValueStreamPath = (projectPath, valueStreamId = null) => {
+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 buildProjectValueStreamPath = (requestPath, valueStreamId = null) => {
if (valueStreamId) {
return buildApiUrl(PROJECT_VSA_STAGES_PATH)
- .replace(':project_path', projectPath)
+ .replace(':request_path', requestPath)
.replace(':value_stream_id', valueStreamId);
}
- return buildApiUrl(PROJECT_VSA_PATH_BASE).replace(':project_path', projectPath);
+ return buildApiUrl(PROJECT_VSA_PATH_BASE).replace(':request_path', requestPath);
};
-const buildGroupValueStreamPath = ({ groupId, valueStreamId = null, stageId = null }) =>
- buildApiUrl(GROUP_VSA_PATH_BASE)
- .replace(':id', groupId)
+const buildValueStreamStageDataPath = ({ requestPath, valueStreamId = null, stageId = null }) =>
+ buildApiUrl(PROJECT_VSA_STAGE_DATA_PATH)
+ .replace(':request_path', requestPath)
.replace(':value_stream_id', valueStreamId)
.replace(':stage_id', stageId);
-export const getProjectValueStreams = (projectPath) => {
- const url = buildProjectValueStreamPath(projectPath);
+export const getProjectValueStreams = (requestPath) => {
+ const url = buildProjectValueStreamPath(requestPath);
return axios.get(url);
};
-export const getProjectValueStreamStages = (projectPath, valueStreamId) => {
- const url = buildProjectValueStreamPath(projectPath, valueStreamId);
+export const getProjectValueStreamStages = (requestPath, valueStreamId) => {
+ const url = buildProjectValueStreamPath(requestPath, 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(`${requestPath}/events/${stageId}`, { params });
+ axios.get(joinPaths(requestPath, 'events', stageId), { params });
export const getProjectValueStreamMetrics = (requestPath, params) =>
axios.get(requestPath, { params });
/**
- * Shared group VSA paths
- * We share some endpoints across and group and project level VSA
- * When used for project level VSA, requests should include the `project_id` in the params object
+ * Dedicated project VSA paths
*/
-export const getValueStreamStageMedian = ({ groupId, valueStreamId, stageId }, params = {}) => {
- const stageBase = buildGroupValueStreamPath({ groupId, valueStreamId, stageId });
- return axios.get(`${stageBase}/median`, { params });
+export const getValueStreamStageMedian = ({ requestPath, valueStreamId, stageId }, params = {}) => {
+ const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId });
+ return axios.get(joinPaths(stageBase, 'median'), { params });
+};
+
+export const getValueStreamStageRecords = (
+ { requestPath, valueStreamId, stageId },
+ params = {},
+) => {
+ const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId });
+ return axios.get(joinPaths(stageBase, 'records'), { params });
+};
+
+export const getValueStreamStageCounts = ({ requestPath, valueStreamId, stageId }, params = {}) => {
+ const stageBase = buildValueStreamStageDataPath({ requestPath, valueStreamId, stageId });
+ return axios.get(joinPaths(stageBase, 'count'), { params });
+};
+
+export const getValueStreamMetrics = ({
+ endpoint = METRIC_TYPE_SUMMARY,
+ requestPath,
+ params = {},
+}) => {
+ const metricBase = buildProjectMetricsPath(requestPath);
+ return axios.get(joinPaths(metricBase, endpoint), { params });
+};
+
+export const getValueStreamSummaryMetrics = (requestPath, params = {}) => {
+ const metricBase = buildProjectMetricsPath(requestPath);
+ return axios.get(joinPaths(metricBase, 'summary'), { params });
};