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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ddc0f837
Commit
ddc0f837
authored
Oct 16, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made serializing generic
fixed previous directory showing when it shouldnt
parent
fa9e729a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
app/assets/javascripts/repo/components/repo_sidebar.vue
app/assets/javascripts/repo/components/repo_sidebar.vue
+3
-3
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+21
-23
app/assets/javascripts/repo/index.js
app/assets/javascripts/repo/index.js
+1
-0
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+1
-0
No files found.
app/assets/javascripts/repo/components/repo_sidebar.vue
View file @
ddc0f837
...
...
@@ -32,11 +32,11 @@ export default {
computed
:
{
flattendFiles
()
{
const
map
=
(
arr
)
=>
{
if
(
arr
&&
arr
.
tree
&&
arr
.
tree
.
length
===
0
)
{
if
(
arr
&&
arr
.
files
&&
arr
.
files
.
length
===
0
)
{
return
[];
}
return
_
.
map
(
arr
.
tree
,
a
=>
[
a
,
map
(
a
)]);
return
_
.
map
(
arr
.
files
,
a
=>
[
a
,
map
(
a
)]);
};
return
_
.
chain
(
this
.
files
)
...
...
@@ -100,7 +100,7 @@ export default {
goToPreviousDirectoryClicked
(
prevURL
)
{
Service
.
url
=
prevURL
;
Helper
.
getContent
(
null
)
Helper
.
getContent
(
null
,
true
)
.
then
(()
=>
Helper
.
scrollTabsRight
())
.
catch
(
Helper
.
loadingError
);
},
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
ddc0f837
...
...
@@ -66,7 +66,7 @@ const RepoHelper = {
const
dir
=
entry
;
dir
.
opened
=
false
;
dir
.
tree
=
[];
dir
.
files
=
[];
},
isRenderable
()
{
...
...
@@ -83,7 +83,7 @@ const RepoHelper = {
.
catch
(
RepoHelper
.
loadingError
);
},
getContent
(
treeOrFile
)
{
getContent
(
treeOrFile
,
emptyFiles
=
false
)
{
let
file
=
treeOrFile
;
if
(
!
Store
.
files
.
length
)
{
...
...
@@ -94,7 +94,10 @@ const RepoHelper = {
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
if
(
response
.
headers
&&
response
.
headers
[
'
page-title
'
])
data
.
pageTitle
=
response
.
headers
[
'
page-title
'
];
if
(
response
.
headers
&&
response
.
headers
[
'
is-root
'
]
&&
Store
.
isRoot
===
null
)
Store
.
isRoot
=
convertPermissionToBoolean
(
response
.
headers
[
'
is-root
'
]);
if
(
response
.
headers
&&
response
.
headers
[
'
is-root
'
]
&&
!
Store
.
isInitialRoot
)
{
Store
.
isRoot
=
convertPermissionToBoolean
(
response
.
headers
[
'
is-root
'
]);
Store
.
isInitialRoot
=
Store
.
isRoot
;
}
if
(
file
&&
file
.
type
===
'
blob
'
)
{
if
(
!
file
)
file
=
data
;
...
...
@@ -120,17 +123,24 @@ const RepoHelper = {
Store
.
loading
.
tree
=
false
;
RepoHelper
.
setDirectoryOpen
(
file
,
data
.
pageTitle
||
data
.
name
);
if
(
!
file
)
{
Store
.
files
=
this
.
dataToListOfFiles
(
data
);
}
else
{
file
.
tree
=
this
.
dataToListOfFiles
(
data
,
file
.
level
+
1
);
if
(
emptyFiles
)
{
Store
.
files
=
[];
}
this
.
addToDirectory
(
file
,
data
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
}
}).
catch
(
RepoHelper
.
loadingError
);
},
addToDirectory
(
file
,
data
)
{
const
tree
=
file
||
Store
;
const
files
=
tree
.
files
.
concat
(
this
.
dataToListOfFiles
(
data
,
file
?
file
.
level
+
1
:
0
));
tree
.
files
=
files
;
},
setFile
(
data
,
file
)
{
const
newFile
=
data
;
newFile
.
url
=
file
.
url
||
Service
.
url
;
// Grab the URL from service, happens on page refresh.
...
...
@@ -144,18 +154,6 @@ const RepoHelper = {
Store
.
setActiveFiles
(
newFile
);
},
serializeBlob
(
blob
,
level
)
{
return
RepoHelper
.
serializeRepoEntity
(
'
blob
'
,
blob
,
level
);
},
serializeTree
(
tree
,
level
)
{
return
RepoHelper
.
serializeRepoEntity
(
'
tree
'
,
tree
,
level
);
},
serializeSubmodule
(
submodule
,
level
)
{
return
RepoHelper
.
serializeRepoEntity
(
'
submodule
'
,
submodule
,
level
);
},
serializeRepoEntity
(
type
,
entity
,
level
=
0
)
{
const
{
url
,
name
,
icon
,
last_commit
}
=
entity
;
const
returnObj
=
{
...
...
@@ -164,7 +162,7 @@ const RepoHelper = {
url
,
level
,
icon
:
`fa-
${
icon
}
`
,
tree
:
[],
files
:
[],
loading
:
false
,
opened
:
false
,
};
...
...
@@ -192,9 +190,9 @@ const RepoHelper = {
dataToListOfFiles
(
data
,
level
)
{
const
{
blobs
,
trees
,
submodules
}
=
data
;
return
[
...
trees
.
map
(
tree
=>
RepoHelper
.
serialize
Tree
(
tree
,
level
)),
...
blobs
.
map
(
blob
=>
RepoHelper
.
serializeBlob
(
blob
,
level
)),
...
submodules
.
map
(
submodule
=>
RepoHelper
.
serializeSubmodule
(
submodule
,
level
)),
...
trees
.
map
(
tree
=>
RepoHelper
.
serialize
RepoEntity
(
'
tree
'
,
tree
,
level
)),
...
submodules
.
map
(
submodule
=>
RepoHelper
.
serializeRepoEntity
(
'
submodule
'
,
submodule
,
level
)),
...
blobs
.
map
(
blob
=>
RepoHelper
.
serializeRepoEntity
(
'
blob
'
,
blob
,
level
)),
];
},
...
...
app/assets/javascripts/repo/index.js
View file @
ddc0f837
...
...
@@ -35,6 +35,7 @@ function setInitialStore(data) {
Store
.
newMrTemplateUrl
=
decodeURIComponent
(
data
.
newMrTemplateUrl
);
Store
.
customBranchURL
=
decodeURIComponent
(
data
.
blobUrl
);
Store
.
isRoot
=
convertPermissionToBoolean
(
data
.
root
);
Store
.
isInitialRoot
=
convertPermissionToBoolean
(
data
.
root
);
Store
.
currentBranch
=
$
(
'
button.dropdown-menu-toggle
'
).
attr
(
'
data-ref
'
);
Store
.
checkIsCommitable
();
Store
.
setBranchHash
();
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
ddc0f837
...
...
@@ -8,6 +8,7 @@ const RepoStore = {
onTopOfBranch
:
false
,
editMode
:
false
,
isRoot
:
null
,
isInitialRoot
:
null
,
prevURL
:
''
,
projectId
:
''
,
projectName
:
''
,
...
...
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