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

harbor_registry.js « api « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb24134256729cdecd7bd92f9d86201438d89fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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,
    },
  });
}