Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1554e73e
Commit
1554e73e
authored
Oct 26, 2020
by
Denys Mishunov
Committed by
Natalia Tepluhina
Oct 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pre-fetch GraphQL requests with startupJS
parent
5e565772
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
91 additions
and
22 deletions
+91
-22
app/assets/javascripts/snippets/components/snippet_blob_view.vue
...ets/javascripts/snippets/components/snippet_blob_view.vue
+3
-3
app/assets/javascripts/snippets/components/snippet_header.vue
...assets/javascripts/snippets/components/snippet_header.vue
+2
-2
app/assets/javascripts/snippets/mixins/snippets.js
app/assets/javascripts/snippets/mixins/snippets.js
+2
-2
app/assets/javascripts/snippets/queries/snippet.query.graphql
...assets/javascripts/snippets/queries/snippet.query.graphql
+0
-15
app/graphql/queries/snippet/project_permissions.query.graphql
...graphql/queries/snippet/project_permissions.query.graphql
+2
-0
app/graphql/queries/snippet/snippet.query.graphql
app/graphql/queries/snippet/snippet.query.graphql
+65
-0
app/graphql/queries/snippet/snippet_blob_content.query.graphql
...raphql/queries/snippet/snippet_blob_content.query.graphql
+4
-0
app/graphql/queries/snippet/user_permissions.query.graphql
app/graphql/queries/snippet/user_permissions.query.graphql
+2
-0
app/views/snippets/show.html.haml
app/views/snippets/show.html.haml
+6
-0
changelogs/unreleased/271542-prefetch-requests-link.yml
changelogs/unreleased/271542-prefetch-requests-link.yml
+5
-0
No files found.
app/assets/javascripts/snippets/components/snippet_blob_view.vue
View file @
1554e73e
<
script
>
import
GetBlobContent
from
'
shared_queries/snippet/snippet_blob_content.query.graphql
'
;
import
BlobHeader
from
'
~/blob/components/blob_header.vue
'
;
import
BlobContent
from
'
~/blob/components/blob_content.vue
'
;
import
GetBlobContent
from
'
../queries/snippet.blob.content.query.graphql
'
;
import
{
SIMPLE_BLOB_VIEWER
,
RICH_BLOB_VIEWER
,
...
...
@@ -21,7 +21,7 @@ export default {
query
:
GetBlobContent
,
variables
()
{
return
{
ids
:
this
.
snippet
.
id
,
ids
:
[
this
.
snippet
.
id
]
,
rich
:
this
.
activeViewerType
===
RICH_BLOB_VIEWER
,
paths
:
[
this
.
blob
.
path
],
};
...
...
app/assets/javascripts/snippets/components/snippet_header.vue
View file @
1554e73e
...
...
@@ -11,12 +11,12 @@ import {
GlButton
,
GlTooltipDirective
,
}
from
'
@gitlab/ui
'
;
import
CanCreatePersonalSnippet
from
'
shared_queries/snippet/user_permissions.query.graphql
'
;
import
CanCreateProjectSnippet
from
'
shared_queries/snippet/project_permissions.query.graphql
'
;
import
{
__
}
from
'
~/locale
'
;
import
TimeAgoTooltip
from
'
~/vue_shared/components/time_ago_tooltip.vue
'
;
import
DeleteSnippetMutation
from
'
../mutations/deleteSnippet.mutation.graphql
'
;
import
CanCreatePersonalSnippet
from
'
../queries/userPermissions.query.graphql
'
;
import
CanCreateProjectSnippet
from
'
../queries/projectPermissions.query.graphql
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
{
fetchPolicies
}
from
'
~/lib/graphql
'
;
...
...
app/assets/javascripts/snippets/mixins/snippets.js
View file @
1554e73e
import
GetSnippetQuery
from
'
../queries
/snippet.query.graphql
'
;
import
GetSnippetQuery
from
'
shared_queries/snippet
/snippet.query.graphql
'
;
const
blobsDefault
=
[];
...
...
@@ -8,7 +8,7 @@ export const getSnippetMixin = {
query
:
GetSnippetQuery
,
variables
()
{
return
{
ids
:
this
.
snippetGid
,
ids
:
[
this
.
snippetGid
]
,
};
},
update
:
data
=>
{
...
...
app/assets/javascripts/snippets/queries/snippet.query.graphql
deleted
100644 → 0
View file @
5e565772
#import '../fragments/snippetBase.fragment.graphql'
#import '../fragments/project.fragment.graphql'
#import "~/graphql_shared/fragments/author.fragment.graphql"
query
GetSnippetQuery
(
$ids
:
[
ID
!])
{
snippets
(
ids
:
$ids
)
{
nodes
{
...
SnippetBase
...
SnippetProject
author
{
...
Author
}
}
}
}
app/
assets/javascripts/snippets/queries/projectP
ermissions.query.graphql
→
app/
graphql/queries/snippet/project_p
ermissions.query.graphql
View file @
1554e73e
query
CanCreateProjectSnippet
(
$fullPath
:
ID
!)
{
project
(
fullPath
:
$fullPath
)
{
__typename
userPermissions
{
__typename
createSnippet
}
}
...
...
app/graphql/queries/snippet/snippet.query.graphql
0 → 100644
View file @
1554e73e
query
GetSnippetQuery
(
$ids
:
[
ID
!])
{
snippets
(
ids
:
$ids
)
{
__typename
nodes
{
__typename
id
title
description
descriptionHtml
createdAt
updatedAt
visibilityLevel
webUrl
httpUrlToRepo
sshUrlToRepo
blobs
{
__typename
nodes
{
__typename
binary
name
path
rawPath
size
externalStorage
renderedAsText
simpleViewer
{
__typename
collapsed
renderError
tooLarge
type
fileType
}
richViewer
{
__typename
collapsed
renderError
tooLarge
type
fileType
}
}
}
userPermissions
{
__typename
adminSnippet
updateSnippet
}
project
{
__typename
fullPath
webUrl
}
author
{
__typename
id
avatarUrl
name
username
webUrl
}
}
}
}
app/
assets/javascripts/snippets/queries/snippet.blob.
content.query.graphql
→
app/
graphql/queries/snippet/snippet_blob_
content.query.graphql
View file @
1554e73e
query
SnippetBlobContent
(
$ids
:
[
ID
!],
$rich
:
Boolean
!,
$paths
:
[
String
!])
{
snippets
(
ids
:
$ids
)
{
__typename
nodes
{
__typename
id
blobs
(
paths
:
$paths
)
{
__typename
nodes
{
__typename
path
richData
@include
(
if
:
$rich
)
plainData
@skip
(
if
:
$rich
)
...
...
app/
assets/javascripts/snippets/queries/userP
ermissions.query.graphql
→
app/
graphql/queries/snippet/user_p
ermissions.query.graphql
View file @
1554e73e
query
CanCreatePersonalSnippet
{
currentUser
{
__typename
userPermissions
{
__typename
createSnippet
}
}
...
...
app/views/snippets/show.html.haml
View file @
1554e73e
-
add_page_startup_graphql_call
(
'snippet/snippet'
,
{
ids:
[
@snippet
.
to_global_id
.
uri
]
})
-
add_page_startup_graphql_call
(
'snippet/snippet_blob_content'
,
{
ids:
[
@snippet
.
to_global_id
.
uri
],
rich:
false
,
paths:
[
@snippet
.
file_name
]
})
-
if
@snippet
.
project_id?
-
add_page_startup_graphql_call
(
'snippet/project_permissions'
,
{
fullPath:
@snippet
.
project_id
})
-
else
-
add_page_startup_graphql_call
(
'snippet/user_permissions'
)
-
@hide_top_links
=
true
-
@content_class
=
"limit-container-width limited-inner-width-container"
unless
fluid_layout
-
add_to_breadcrumbs
_
(
"Snippets"
),
dashboard_snippets_path
...
...
changelogs/unreleased/271542-prefetch-requests-link.yml
0 → 100644
View file @
1554e73e
---
title
:
Pre-fetched GraphQL queries for snippet view
merge_request
:
46130
author
:
type
:
changed
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment