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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2019-06-10 11:05:16 +0300
committerPhil Hughes <me@iamphill.com>2019-06-10 11:05:44 +0300
commit522c01972c7f46dbe8a2cd7569784fa255997c91 (patch)
treeab726ad68410c1c69d12bf8dc2aa527f2a05bd20 /app
parent25420de654b5581ccf6254be769a5e031446eced (diff)
Add LFS blob ID to GraphQL blob type
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/repository/components/table/index.vue1
-rw-r--r--app/assets/javascripts/repository/components/table/row.vue12
-rw-r--r--app/assets/javascripts/repository/queries/getFiles.graphql1
-rw-r--r--app/graphql/types/tree/blob_type.rb3
-rw-r--r--app/presenters/blob_presenter.rb2
5 files changed, 18 insertions, 1 deletions
diff --git a/app/assets/javascripts/repository/components/table/index.vue b/app/assets/javascripts/repository/components/table/index.vue
index d2198bcccfe..0357a0e44c3 100644
--- a/app/assets/javascripts/repository/components/table/index.vue
+++ b/app/assets/javascripts/repository/components/table/index.vue
@@ -135,6 +135,7 @@ export default {
:path="entry.flatPath"
:type="entry.type"
:url="entry.webUrl"
+ :lfs-oid="entry.lfsOid"
/>
</template>
</tbody>
diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue
index 764882a7936..e24a5e2c447 100644
--- a/app/assets/javascripts/repository/components/table/row.vue
+++ b/app/assets/javascripts/repository/components/table/row.vue
@@ -1,8 +1,12 @@
<script>
+import { GlBadge } from '@gitlab/ui';
import { getIconName } from '../../utils/icon';
import getRefMixin from '../../mixins/get_ref';
export default {
+ components: {
+ GlBadge,
+ },
mixins: [getRefMixin],
props: {
id: {
@@ -26,6 +30,11 @@ export default {
required: false,
default: null,
},
+ lfsOid: {
+ type: String,
+ required: false,
+ default: null,
+ },
},
computed: {
routerLinkTo() {
@@ -67,6 +76,9 @@ export default {
<component :is="linkComponent" :to="routerLinkTo" :href="url" class="str-truncated">
{{ fullPath }}
</component>
+ <gl-badge v-if="lfsOid" variant="default" class="label-lfs ml-1">
+ LFS
+ </gl-badge>
<template v-if="isSubmodule">
@ <a href="#" class="commit-sha">{{ shortSha }}</a>
</template>
diff --git a/app/assets/javascripts/repository/queries/getFiles.graphql b/app/assets/javascripts/repository/queries/getFiles.graphql
index 7d92bc46455..ef924fde556 100644
--- a/app/assets/javascripts/repository/queries/getFiles.graphql
+++ b/app/assets/javascripts/repository/queries/getFiles.graphql
@@ -45,6 +45,7 @@ query getFiles(
node {
...TreeEntry
webUrl
+ lfsOid
}
}
pageInfo {
diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb
index f2b7d5df2b2..ba191b59132 100644
--- a/app/graphql/types/tree/blob_type.rb
+++ b/app/graphql/types/tree/blob_type.rb
@@ -9,6 +9,9 @@ module Types
graphql_name 'Blob'
field :web_url, GraphQL::STRING_TYPE, null: true
+ field :lfs_oid, GraphQL::STRING_TYPE, null: true, resolve: -> (blob, args, ctx) do
+ Gitlab::Graphql::Loaders::BatchCommitLoader.new(blob.repository, blob.id).find
+ end
end
end
end
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb
index c5675ef3ea3..91c9abe750b 100644
--- a/app/presenters/blob_presenter.rb
+++ b/app/presenters/blob_presenter.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-class BlobPresenter < Gitlab::View::Presenter::Simple
+class BlobPresenter < Gitlab::View::Presenter::Delegated
presents :blob
def highlight(plain: nil)