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:
Diffstat (limited to 'app/assets/javascripts/api/analytics_api.js')
-rw-r--r--app/assets/javascripts/api/analytics_api.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/api/analytics_api.js b/app/assets/javascripts/api/analytics_api.js
new file mode 100644
index 00000000000..58494c5a2b8
--- /dev/null
+++ b/app/assets/javascripts/api/analytics_api.js
@@ -0,0 +1,32 @@
+import axios from '~/lib/utils/axios_utils';
+import { buildApiUrl } from './api_utils';
+
+const PROJECT_VSA_PATH_BASE = '/:project_path/-/analytics/value_stream_analytics/value_streams';
+const PROJECT_VSA_STAGES_PATH = `${PROJECT_VSA_PATH_BASE}/:value_stream_id/stages`;
+
+const buildProjectValueStreamPath = (projectPath, valueStreamId = null) => {
+ if (valueStreamId) {
+ return buildApiUrl(PROJECT_VSA_STAGES_PATH)
+ .replace(':project_path', projectPath)
+ .replace(':value_stream_id', valueStreamId);
+ }
+ return buildApiUrl(PROJECT_VSA_PATH_BASE).replace(':project_path', projectPath);
+};
+
+export const getProjectValueStreams = (projectPath) => {
+ const url = buildProjectValueStreamPath(projectPath);
+ return axios.get(url);
+};
+
+export const getProjectValueStreamStages = (projectPath, valueStreamId) => {
+ const url = buildProjectValueStreamPath(projectPath, 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 });
+
+export const getProjectValueStreamMetrics = (requestPath, params) =>
+ axios.get(requestPath, { params });