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
39bf8b82
Commit
39bf8b82
authored
Jun 11, 2021
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to use more GraphQL blob info
parent
d164e450
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
28 deletions
+27
-28
app/assets/javascripts/pages/projects/blob/show/index.js
app/assets/javascripts/pages/projects/blob/show/index.js
+1
-11
app/assets/javascripts/repository/components/blob_content_viewer.vue
...javascripts/repository/components/blob_content_viewer.vue
+7
-1
app/assets/javascripts/repository/components/blob_replace.vue
...assets/javascripts/repository/components/blob_replace.vue
+12
-8
app/assets/javascripts/repository/mixins/get_ref.js
app/assets/javascripts/repository/mixins/get_ref.js
+1
-1
app/assets/javascripts/repository/queries/blob_info.query.graphql
...ts/javascripts/repository/queries/blob_info.query.graphql
+1
-0
app/views/projects/blob/_blob.html.haml
app/views/projects/blob/_blob.html.haml
+1
-3
spec/frontend/repository/components/blob_replace_spec.js
spec/frontend/repository/components/blob_replace_spec.js
+4
-4
No files found.
app/assets/javascripts/pages/projects/blob/show/index.js
View file @
39bf8b82
...
...
@@ -5,7 +5,6 @@ import PipelineTourSuccessModal from '~/blob/pipeline_tour_success_modal.vue';
import
BlobViewer
from
'
~/blob/viewer/index
'
;
import
GpgBadges
from
'
~/gpg_badges
'
;
import
createDefaultClient
from
'
~/lib/graphql
'
;
import
{
parseBoolean
}
from
'
~/lib/utils/common_utils
'
;
import
initBlob
from
'
~/pages/projects/init_blob
'
;
import
initWebIdeLink
from
'
~/pages/projects/shared/web_ide_link
'
;
import
commitPipelineStatus
from
'
~/projects/tree/components/commit_pipeline_status_component.vue
'
;
...
...
@@ -21,14 +20,7 @@ const apolloProvider = new VueApollo({
const
viewBlobEl
=
document
.
querySelector
(
'
#js-view-blob-app
'
);
if
(
viewBlobEl
)
{
const
{
blobPath
,
projectPath
,
targetBranch
,
originalBranch
,
canPushCode
,
replacePath
,
}
=
viewBlobEl
.
dataset
;
const
{
blobPath
,
projectPath
,
targetBranch
,
originalBranch
}
=
viewBlobEl
.
dataset
;
// eslint-disable-next-line no-new
new
Vue
({
...
...
@@ -37,8 +29,6 @@ if (viewBlobEl) {
provide
:
{
targetBranch
,
originalBranch
,
canPushCode
:
parseBoolean
(
canPushCode
),
replacePath
,
},
render
(
createElement
)
{
return
createElement
(
BlobContentViewer
,
{
...
...
app/assets/javascripts/repository/components/blob_content_viewer.vue
View file @
39bf8b82
...
...
@@ -135,7 +135,13 @@ export default {
:edit-path=
"blobInfo.editBlobPath"
:web-ide-path=
"blobInfo.ideEditPath"
/>
<blob-replace
v-if=
"isLoggedIn"
:name=
"blobInfo.name"
:path=
"path"
/>
<blob-replace
v-if=
"isLoggedIn"
:path=
"path"
:name=
"blobInfo.name"
:replace-path=
"blobInfo.replacePath"
:can-push-code=
"blobInfo.canModifyBlob"
/>
</
template
>
</blob-header>
<blob-content
...
...
app/assets/javascripts/repository/components/blob_replace.vue
View file @
39bf8b82
...
...
@@ -2,6 +2,7 @@
import
{
GlButton
,
GlModalDirective
}
from
'
@gitlab/ui
'
;
import
{
uniqueId
}
from
'
lodash
'
;
import
{
sprintf
,
__
}
from
'
~/locale
'
;
import
getRefMixin
from
'
../mixins/get_ref
'
;
import
UploadBlobModal
from
'
./upload_blob_modal.vue
'
;
export
default
{
...
...
@@ -16,6 +17,7 @@ export default {
directives
:
{
GlModal
:
GlModalDirective
,
},
mixins
:
[
getRefMixin
],
inject
:
{
targetBranch
:
{
default
:
''
,
...
...
@@ -23,12 +25,6 @@ export default {
originalBranch
:
{
default
:
''
,
},
canPushCode
:
{
default
:
false
,
},
replacePath
:
{
default
:
null
,
},
},
props
:
{
name
:
{
...
...
@@ -39,6 +35,14 @@ export default {
type
:
String
,
required
:
true
,
},
replacePath
:
{
type
:
String
,
required
:
true
,
},
canPushCode
:
{
type
:
Boolean
,
required
:
true
,
},
},
computed
:
{
replaceModalId
()
{
...
...
@@ -60,8 +64,8 @@ export default {
:modal-id=
"replaceModalId"
:modal-title=
"title"
:commit-message=
"title"
:target-branch=
"targetBranch"
:original-branch=
"originalBranch"
:target-branch=
"targetBranch
|| ref
"
:original-branch=
"originalBranch
|| ref
"
:can-push-code=
"canPushCode"
:path=
"path"
:replace-path=
"replacePath"
...
...
app/assets/javascripts/repository/mixins/get_ref.js
View file @
39bf8b82
...
...
@@ -6,7 +6,7 @@ export default {
query
:
refQuery
,
manual
:
true
,
result
({
data
,
loading
})
{
if
(
!
loading
)
{
if
(
data
&&
!
loading
)
{
this
.
ref
=
data
.
ref
;
this
.
escapedRef
=
data
.
escapedRef
;
}
...
...
app/assets/javascripts/repository/queries/blob_info.query.graphql
View file @
39bf8b82
...
...
@@ -15,6 +15,7 @@ query getBlobInfo($projectPath: ID!, $filePath: String!) {
storedExternally
rawPath
replacePath
canModifyBlob
simpleViewer
{
fileType
tooLarge
...
...
app/views/projects/blob/_blob.html.haml
View file @
39bf8b82
...
...
@@ -19,9 +19,7 @@
#js-view-blob-app
{
data:
{
blob_path:
blob
.
path
,
project_path:
@project
.
full_path
,
target_branch:
project
.
empty_repo?
?
ref
:
@ref
,
original_branch:
@ref
,
can_push_code:
can?
(
current_user
,
:push_code
,
@project
).
to_s
,
replace_path:
project_update_blob_path
(
@project
,
@id
)
}
}
original_branch:
@ref
}
}
.gl-spinner-container
=
loading_icon
(
size:
'md'
)
-
else
...
...
spec/frontend/repository/components/blob_replace_spec.js
View file @
39bf8b82
...
...
@@ -5,13 +5,13 @@ import UploadBlobModal from '~/repository/components/upload_blob_modal.vue';
const
DEFAULT_PROPS
=
{
name
:
'
some name
'
,
path
:
'
some/path
'
,
canPushCode
:
true
,
replacePath
:
'
some/replace/path
'
,
};
const
DEFAULT_INJECT
=
{
targetBranch
:
'
master
'
,
originalBranch
:
'
master
'
,
canPushCode
:
true
,
replacePath
:
'
some/replace/path
'
,
};
describe
(
'
BlobReplace component
'
,
()
=>
{
...
...
@@ -49,8 +49,8 @@ describe('BlobReplace component', () => {
it
(
'
renders UploadBlobModal
'
,
()
=>
{
createComponent
();
const
{
targetBranch
,
originalBranch
,
canPushCode
,
replacePath
}
=
DEFAULT_INJECT
;
const
{
name
,
path
}
=
DEFAULT_PROPS
;
const
{
targetBranch
,
originalBranch
}
=
DEFAULT_INJECT
;
const
{
name
,
path
,
canPushCode
,
replacePath
}
=
DEFAULT_PROPS
;
const
title
=
`Replace
${
name
}
`
;
expect
(
findUploadBlobModal
().
props
()).
toMatchObject
({
...
...
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