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
854bcedd
Commit
854bcedd
authored
May 05, 2021
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add suggestion patch
- Use computed hasRichViewer instead as a data - Update date to suit
parent
56ffe743
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
app/assets/javascripts/repository/components/blob_content_viewer.vue
...javascripts/repository/components/blob_content_viewer.vue
+8
-14
spec/frontend/repository/components/blob_content_viewer_spec.js
...rontend/repository/components/blob_content_viewer_spec.js
+1
-1
No files found.
app/assets/javascripts/repository/components/blob_content_viewer.vue
View file @
854bcedd
...
...
@@ -23,18 +23,10 @@ export default {
filePath
:
this
.
path
,
};
},
result
({
data
})
{
const
[
blob
]
=
data
?.
project
?.
repository
?.
blobs
?.
nodes
;
if
(
!
blob
)
{
return
;
}
const
hasRichViewer
=
blob
?.
richViewer
!==
null
;
this
.
hasRichViewer
=
hasRichViewer
;
this
.
activeViewerType
=
hasRichViewer
&&
!
window
.
location
.
hash
?
RICH_BLOB_VIEWER
:
SIMPLE_BLOB_VIEWER
;
result
()
{
this
.
switchViewer
(
this
.
hasRichViewer
&&
!
window
.
location
.
hash
?
RICH_BLOB_VIEWER
:
SIMPLE_BLOB_VIEWER
,
);
},
error
()
{
createFlash
({
message
:
__
(
'
An error occurred while loading the file. Please try again.
'
)
});
...
...
@@ -58,7 +50,6 @@ export default {
},
data
()
{
return
{
hasRichViewer
:
false
,
activeViewerType
:
SIMPLE_BLOB_VIEWER
,
project
:
{
repository
:
{
...
...
@@ -85,7 +76,7 @@ export default {
canModifyBlob
:
true
,
forkPath
:
''
,
simpleViewer
:
{},
richViewer
:
{}
,
richViewer
:
null
,
},
],
},
...
...
@@ -106,6 +97,9 @@ export default {
const
{
richViewer
,
simpleViewer
}
=
this
.
blobInfo
;
return
this
.
activeViewerType
===
RICH_BLOB_VIEWER
?
richViewer
:
simpleViewer
;
},
hasRichViewer
()
{
return
Boolean
(
this
.
blobInfo
.
richViewer
);
},
hasRenderError
()
{
return
Boolean
(
this
.
viewer
.
renderError
);
},
...
...
spec/frontend/repository/components/blob_content_viewer_spec.js
View file @
854bcedd
...
...
@@ -108,7 +108,7 @@ describe('Blob content viewer component', () => {
describe
(
'
rich viewer
'
,
()
=>
{
beforeEach
(()
=>
{
factory
({
mockData
:
{
blobInfo
:
richMockData
,
hasRichViewer
:
true
,
activeViewerType
:
'
rich
'
},
mockData
:
{
blobInfo
:
richMockData
,
activeViewerType
:
'
rich
'
},
});
});
...
...
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