diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/snippets/components/snippet_blob_view.vue | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/snippets/components/snippet_blob_view.vue')
-rw-r--r-- | app/assets/javascripts/snippets/components/snippet_blob_view.vue | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/app/assets/javascripts/snippets/components/snippet_blob_view.vue b/app/assets/javascripts/snippets/components/snippet_blob_view.vue index afd038eef58..b38be5bb9a4 100644 --- a/app/assets/javascripts/snippets/components/snippet_blob_view.vue +++ b/app/assets/javascripts/snippets/components/snippet_blob_view.vue @@ -1,7 +1,6 @@ <script> import BlobHeader from '~/blob/components/blob_header.vue'; import BlobContent from '~/blob/components/blob_content.vue'; -import CloneDropdownButton from '~/vue_shared/components/clone_dropdown.vue'; import GetBlobContent from '../queries/snippet.blob.content.query.graphql'; @@ -16,7 +15,6 @@ export default { components: { BlobHeader, BlobContent, - CloneDropdownButton, }, apollo: { blobContent: { @@ -27,8 +25,9 @@ export default { rich: this.activeViewerType === RICH_BLOB_VIEWER, }; }, - update: data => - data.snippets.edges[0].node.blob.richData || data.snippets.edges[0].node.blob.plainData, + update(data) { + return this.onContentUpdate(data); + }, result() { if (this.activeViewerType === RICH_BLOB_VIEWER) { this.blob.richViewer.renderError = null; @@ -66,9 +65,6 @@ export default { const { richViewer, simpleViewer } = this.blob; return this.activeViewerType === RICH_BLOB_VIEWER ? richViewer : simpleViewer; }, - canBeCloned() { - return this.snippet.sshUrlToRepo || this.snippet.httpUrlToRepo; - }, hasRenderError() { return Boolean(this.viewer.renderError); }, @@ -81,6 +77,12 @@ export default { this.$apollo.queries.blobContent.skip = false; this.$apollo.queries.blobContent.refetch(); }, + onContentUpdate(data) { + const { path: blobPath } = this.blob; + const { blobs } = data.snippets.edges[0].node; + const updatedBlobData = blobs.find(blob => blob.path === blobPath); + return updatedBlobData.richData || updatedBlobData.plainData; + }, }, BLOB_RENDER_EVENT_LOAD, BLOB_RENDER_EVENT_SHOW_SOURCE, @@ -93,17 +95,7 @@ export default { :active-viewer-type="viewer.type" :has-render-error="hasRenderError" @viewer-changed="switchViewer" - > - <template #actions> - <clone-dropdown-button - v-if="canBeCloned" - class="gl-mr-3" - :ssh-link="snippet.sshUrlToRepo" - :http-link="snippet.httpUrlToRepo" - data-qa-selector="clone_button" - /> - </template> - </blob-header> + /> <blob-content :loading="isContentLoading" :content="blobContent" |