diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-12 18:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-12 18:09:09 +0300 |
commit | 6cf30e964d54d536b0ff861916745f0a4bb31ebb (patch) | |
tree | c29ef6911c9c8347cbcd5195583462e91121506a /app/assets/javascripts/registry | |
parent | 4a31b8786892820e8029844c34fd5296c52c37c0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/registry')
3 files changed, 14 insertions, 6 deletions
diff --git a/app/assets/javascripts/registry/explorer/components/list_page/image_list_row.vue b/app/assets/javascripts/registry/explorer/components/list_page/image_list_row.vue index 8308ac7e327..b0a7c4824bd 100644 --- a/app/assets/javascripts/registry/explorer/components/list_page/image_list_row.vue +++ b/app/assets/javascripts/registry/explorer/components/list_page/image_list_row.vue @@ -72,7 +72,7 @@ export default { <template #left-primary> <router-link class="gl-text-body gl-font-weight-bold" - data-testid="detailsLink" + data-testid="details-link" :to="{ name: 'details', params: { id: item.id } }" > {{ item.path }} diff --git a/app/assets/javascripts/registry/explorer/stores/actions.js b/app/assets/javascripts/registry/explorer/stores/actions.js index abc0bc8ce8c..c1883095097 100644 --- a/app/assets/javascripts/registry/explorer/stores/actions.js +++ b/app/assets/javascripts/registry/explorer/stores/actions.js @@ -56,7 +56,7 @@ export const requestTagsList = ({ commit, dispatch, state: { imageDetails } }, p dispatch('receiveTagsListSuccess', { data, headers }); }) .catch(() => { - createFlash(FETCH_TAGS_LIST_ERROR_MESSAGE); + createFlash({ message: FETCH_TAGS_LIST_ERROR_MESSAGE }); }) .finally(() => { commit(types.SET_MAIN_LOADING, false); @@ -71,7 +71,7 @@ export const requestImageDetailsAndTagsList = ({ dispatch, commit }, id) => { dispatch('requestTagsList'); }) .catch(() => { - createFlash(FETCH_IMAGE_DETAILS_ERROR_MESSAGE); + createFlash({ message: FETCH_IMAGE_DETAILS_ERROR_MESSAGE }); commit(types.SET_MAIN_LOADING, false); }); }; diff --git a/app/assets/javascripts/registry/explorer/utils.js b/app/assets/javascripts/registry/explorer/utils.js index ff86a6b807d..2c89d508c31 100644 --- a/app/assets/javascripts/registry/explorer/utils.js +++ b/app/assets/javascripts/registry/explorer/utils.js @@ -1,8 +1,16 @@ export const pathGenerator = (imageDetails, ending = '?format=json') => { // this method is a temporary workaround, to be removed with graphql implementation // https://gitlab.com/gitlab-org/gitlab/-/issues/276432 - const basePath = imageDetails.name - ? imageDetails.path.replace(`/${imageDetails.name}`, '') - : imageDetails.path; + + const splitPath = imageDetails.path.split('/').reverse(); + const splitName = imageDetails.name ? imageDetails.name.split('/').reverse() : []; + const basePath = splitPath + .reduce((acc, curr, index) => { + if (splitPath[index] !== splitName[index]) { + acc.unshift(curr); + } + return acc; + }, []) + .join('/'); return `/${basePath}/registry/repository/${imageDetails.id}/tags${ending}`; }; |