diff options
Diffstat (limited to 'app/assets/javascripts/api')
-rw-r--r-- | app/assets/javascripts/api/harbor_registry.js | 49 | ||||
-rw-r--r-- | app/assets/javascripts/api/integrations_api.js | 21 | ||||
-rw-r--r-- | app/assets/javascripts/api/user_api.js | 6 |
3 files changed, 49 insertions, 27 deletions
diff --git a/app/assets/javascripts/api/harbor_registry.js b/app/assets/javascripts/api/harbor_registry.js new file mode 100644 index 00000000000..eb241342567 --- /dev/null +++ b/app/assets/javascripts/api/harbor_registry.js @@ -0,0 +1,49 @@ +import axios from '~/lib/utils/axios_utils'; +import { buildApiUrl } from '~/api/api_utils'; + +// the :request_path is loading API-like resources, not part of our REST API. +// https://gitlab.com/gitlab-org/gitlab/-/merge_requests/82784#note_1077703806 +const HARBOR_REPOSITORIES_PATH = '/:request_path.json'; +const HARBOR_ARTIFACTS_PATH = '/:request_path/:repo_name/artifacts.json'; +const HARBOR_TAGS_PATH = '/:request_path/:repo_name/artifacts/:digest/tags.json'; + +export function getHarborRepositoriesList({ requestPath, limit, page, sort, search = '' }) { + const url = buildApiUrl(HARBOR_REPOSITORIES_PATH).replace('/:request_path', requestPath); + + return axios.get(url, { + params: { + limit, + page, + search, + sort, + }, + }); +} + +export function getHarborArtifacts({ requestPath, repoName, limit, page, sort, search = '' }) { + const url = buildApiUrl(HARBOR_ARTIFACTS_PATH) + .replace('/:request_path', requestPath) + .replace(':repo_name', repoName); + + return axios.get(url, { + params: { + limit, + page, + search, + sort, + }, + }); +} + +export function getHarborTags({ requestPath, repoName, digest, page }) { + const url = buildApiUrl(HARBOR_TAGS_PATH) + .replace('/:request_path', requestPath) + .replace(':repo_name', repoName) + .replace(':digest', digest); + + return axios.get(url, { + params: { + page, + }, + }); +} diff --git a/app/assets/javascripts/api/integrations_api.js b/app/assets/javascripts/api/integrations_api.js deleted file mode 100644 index 692aae21a4f..00000000000 --- a/app/assets/javascripts/api/integrations_api.js +++ /dev/null @@ -1,21 +0,0 @@ -import axios from '../lib/utils/axios_utils'; -import { buildApiUrl } from './api_utils'; - -const JIRA_CONNECT_SUBSCRIPTIONS_PATH = '/api/:version/integrations/jira_connect/subscriptions'; - -export function addJiraConnectSubscription(namespacePath, { jwt, accessToken }) { - const url = buildApiUrl(JIRA_CONNECT_SUBSCRIPTIONS_PATH); - - return axios.post( - url, - { - jwt, - namespace_path: namespacePath, - }, - { - headers: { - Authorization: `Bearer ${accessToken}`, // eslint-disable-line @gitlab/require-i18n-strings - }, - }, - ); -} diff --git a/app/assets/javascripts/api/user_api.js b/app/assets/javascripts/api/user_api.js index c362253f52e..c743b18d572 100644 --- a/app/assets/javascripts/api/user_api.js +++ b/app/assets/javascripts/api/user_api.js @@ -12,7 +12,6 @@ const USER_PROJECTS_PATH = '/api/:version/users/:id/projects'; const USER_POST_STATUS_PATH = '/api/:version/user/status'; const USER_FOLLOW_PATH = '/api/:version/users/:id/follow'; const USER_UNFOLLOW_PATH = '/api/:version/users/:id/unfollow'; -const CURRENT_USER_PATH = '/api/:version/user'; export function getUsers(query, options) { const url = buildApiUrl(USERS_PATH); @@ -82,8 +81,3 @@ export function unfollowUser(userId) { const url = buildApiUrl(USER_UNFOLLOW_PATH).replace(':id', encodeURIComponent(userId)); return axios.post(url); } - -export function getCurrentUser(options) { - const url = buildApiUrl(CURRENT_USER_PATH); - return axios.get(url, { ...options }); -} |