diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 15:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 15:09:01 +0300 |
commit | 2c2dd5e36c4ed5f09f488be288882d98f9124d12 (patch) | |
tree | ad4c478bb1c588387a881b26a7db7c3237b9d4f3 /app/assets/javascripts/repository | |
parent | 2ff184ad761fbfbe25a3d827c8f704349963a8d2 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/repository')
4 files changed, 26 insertions, 11 deletions
diff --git a/app/assets/javascripts/repository/components/breadcrumbs.vue b/app/assets/javascripts/repository/components/breadcrumbs.vue index f6b9ea5d30d..5917c96990e 100644 --- a/app/assets/javascripts/repository/components/breadcrumbs.vue +++ b/app/assets/javascripts/repository/components/breadcrumbs.vue @@ -34,7 +34,10 @@ export default { projectPath: this.projectPath, }; }, - update: data => data.project.userPermissions, + update: data => data.project?.userPermissions, + error(error) { + throw error; + }, }, }, mixins: [getRefMixin], @@ -172,7 +175,7 @@ export default { ); } - if (this.userPermissions.pushCode) { + if (this.userPermissions?.pushCode) { items.push( { type: ROW_TYPES.divider, diff --git a/app/assets/javascripts/repository/components/last_commit.vue b/app/assets/javascripts/repository/components/last_commit.vue index fe1724acf89..573b0c4963e 100644 --- a/app/assets/javascripts/repository/components/last_commit.vue +++ b/app/assets/javascripts/repository/components/last_commit.vue @@ -40,16 +40,19 @@ export default { }; }, update: data => { - const pipelines = data.project.repository.tree.lastCommit.pipelines.edges; + const pipelines = data.project?.repository?.tree?.lastCommit?.pipelines?.edges; return { - ...data.project.repository.tree.lastCommit, - pipeline: pipelines.length && pipelines[0].node, + ...data.project?.repository?.tree?.lastCommit, + pipeline: pipelines?.length && pipelines[0].node, }; }, context: { isSingleRequest: true, }, + error(error) { + throw error; + }, }, }, props: { @@ -62,7 +65,7 @@ export default { data() { return { projectPath: '', - commit: {}, + commit: null, showDescription: false, }; }, @@ -79,6 +82,11 @@ export default { return this.commit.sha.substr(0, 8); }, }, + watch: { + currentPath() { + this.commit = null; + }, + }, methods: { toggleShowDescription() { this.showDescription = !this.showDescription; @@ -91,7 +99,7 @@ export default { <template> <div class="info-well d-none d-sm-flex project-last-commit commit p-3"> <gl-loading-icon v-if="isLoading" size="md" color="dark" class="m-auto" /> - <template v-else> + <template v-else-if="commit"> <user-avatar-link v-if="commit.author" :link-href="commit.author.webUrl" diff --git a/app/assets/javascripts/repository/components/tree_content.vue b/app/assets/javascripts/repository/components/tree_content.vue index 92e33b013c3..7b34e9ef60d 100644 --- a/app/assets/javascripts/repository/components/tree_content.vue +++ b/app/assets/javascripts/repository/components/tree_content.vue @@ -86,7 +86,8 @@ export default { }, }) .then(({ data }) => { - if (!data) return; + if (data.errors) throw data.errors; + if (!data?.project?.repository) return; const pageInfo = this.hasNextPage(data.project.repository.tree); @@ -99,12 +100,15 @@ export default { {}, ); - if (pageInfo && pageInfo.hasNextPage) { + if (pageInfo?.hasNextPage) { this.nextPageCursor = pageInfo.endCursor; this.fetchFiles(); } }) - .catch(() => createFlash(__('An error occurred while fetching folder content.'))); + .catch(error => { + createFlash(__('An error occurred while fetching folder content.')); + throw error; + }); }, normalizeData(key, data) { return this.entries[key].concat(data.map(({ node }) => node)); diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js index 2ef0c078f13..a26acbbe301 100644 --- a/app/assets/javascripts/repository/index.js +++ b/app/assets/javascripts/repository/index.js @@ -23,7 +23,7 @@ export default function setupVueRepositoryList() { projectPath, projectShortPath, ref, - vueFileListLfsBadge: gon?.features?.vueFileListLfsBadge, + vueFileListLfsBadge: gon.features?.vueFileListLfsBadge || false, commits: [], }, }); |