diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-20 02:18:09 +0300 |
commit | 6ed4ec3e0b1340f96b7c043ef51d1b33bbe85fde (patch) | |
tree | dc4d20fe6064752c0bd323187252c77e0a89144b /app/assets/javascripts/api/harbor_registry.js | |
parent | 9868dae7fc0655bd7ce4a6887d4e6d487690eeed (diff) |
Add latest changes from gitlab-org/gitlab@15-4-stable-eev15.4.0-rc42
Diffstat (limited to 'app/assets/javascripts/api/harbor_registry.js')
-rw-r--r-- | app/assets/javascripts/api/harbor_registry.js | 49 |
1 files changed, 49 insertions, 0 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, + }, + }); +} |