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
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 {
...
@@ -32,11 +32,11 @@ export default {
computed
:
{
computed
:
{
flattendFiles
()
{
flattendFiles
()
{
const
map
=
(
arr
)
=>
{
const
map
=
(
arr
)
=>
{
if
(
arr
&&
arr
.
tree
&&
arr
.
tree
.
length
===
0
)
{
if
(
arr
&&
arr
.
files
&&
arr
.
files
.
length
===
0
)
{
return
[];
return
[];
}
}
return
_
.
map
(
arr
.
tree
,
a
=>
[
a
,
map
(
a
)]);
return
_
.
map
(
arr
.
files
,
a
=>
[
a
,
map
(
a
)]);
};
};
return
_
.
chain
(
this
.
files
)
return
_
.
chain
(
this
.
files
)
...
@@ -100,7 +100,7 @@ export default {
...
@@ -100,7 +100,7 @@ export default {
goToPreviousDirectoryClicked
(
prevURL
)
{
goToPreviousDirectoryClicked
(
prevURL
)
{
Service
.
url
=
prevURL
;
Service
.
url
=
prevURL
;
Helper
.
getContent
(
null
)
Helper
.
getContent
(
null
,
true
)
.
then
(()
=>
Helper
.
scrollTabsRight
())
.
then
(()
=>
Helper
.
scrollTabsRight
())
.
catch
(
Helper
.
loadingError
);
.
catch
(
Helper
.
loadingError
);
},
},
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
ddc0f837
...
@@ -66,7 +66,7 @@ const RepoHelper = {
...
@@ -66,7 +66,7 @@ const RepoHelper = {
const
dir
=
entry
;
const
dir
=
entry
;
dir
.
opened
=
false
;
dir
.
opened
=
false
;
dir
.
tree
=
[];
dir
.
files
=
[];
},
},
isRenderable
()
{
isRenderable
()
{
...
@@ -83,7 +83,7 @@ const RepoHelper = {
...
@@ -83,7 +83,7 @@ const RepoHelper = {
.
catch
(
RepoHelper
.
loadingError
);
.
catch
(
RepoHelper
.
loadingError
);
},
},
getContent
(
treeOrFile
)
{
getContent
(
treeOrFile
,
emptyFiles
=
false
)
{
let
file
=
treeOrFile
;
let
file
=
treeOrFile
;
if
(
!
Store
.
files
.
length
)
{
if
(
!
Store
.
files
.
length
)
{
...
@@ -94,7 +94,10 @@ const RepoHelper = {
...
@@ -94,7 +94,10 @@ const RepoHelper = {
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
const
data
=
response
.
data
;
if
(
response
.
headers
&&
response
.
headers
[
'
page-title
'
])
data
.
pageTitle
=
response
.
headers
[
'
page-title
'
];
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
.
type
===
'
blob
'
)
{
if
(
!
file
)
file
=
data
;
if
(
!
file
)
file
=
data
;
...
@@ -120,17 +123,24 @@ const RepoHelper = {
...
@@ -120,17 +123,24 @@ const RepoHelper = {
Store
.
loading
.
tree
=
false
;
Store
.
loading
.
tree
=
false
;
RepoHelper
.
setDirectoryOpen
(
file
,
data
.
pageTitle
||
data
.
name
);
RepoHelper
.
setDirectoryOpen
(
file
,
data
.
pageTitle
||
data
.
name
);
if
(
!
file
)
{
if
(
emptyFiles
)
{
Store
.
files
=
this
.
dataToListOfFiles
(
data
);
Store
.
files
=
[];
}
else
{
file
.
tree
=
this
.
dataToListOfFiles
(
data
,
file
.
level
+
1
);
}
}
this
.
addToDirectory
(
file
,
data
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
}
}
}).
catch
(
RepoHelper
.
loadingError
);
}).
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
)
{
setFile
(
data
,
file
)
{
const
newFile
=
data
;
const
newFile
=
data
;
newFile
.
url
=
file
.
url
||
Service
.
url
;
// Grab the URL from service, happens on page refresh.
newFile
.
url
=
file
.
url
||
Service
.
url
;
// Grab the URL from service, happens on page refresh.
...
@@ -144,18 +154,6 @@ const RepoHelper = {
...
@@ -144,18 +154,6 @@ const RepoHelper = {
Store
.
setActiveFiles
(
newFile
);
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
)
{
serializeRepoEntity
(
type
,
entity
,
level
=
0
)
{
const
{
url
,
name
,
icon
,
last_commit
}
=
entity
;
const
{
url
,
name
,
icon
,
last_commit
}
=
entity
;
const
returnObj
=
{
const
returnObj
=
{
...
@@ -164,7 +162,7 @@ const RepoHelper = {
...
@@ -164,7 +162,7 @@ const RepoHelper = {
url
,
url
,
level
,
level
,
icon
:
`fa-
${
icon
}
`
,
icon
:
`fa-
${
icon
}
`
,
tree
:
[],
files
:
[],
loading
:
false
,
loading
:
false
,
opened
:
false
,
opened
:
false
,
};
};
...
@@ -192,9 +190,9 @@ const RepoHelper = {
...
@@ -192,9 +190,9 @@ const RepoHelper = {
dataToListOfFiles
(
data
,
level
)
{
dataToListOfFiles
(
data
,
level
)
{
const
{
blobs
,
trees
,
submodules
}
=
data
;
const
{
blobs
,
trees
,
submodules
}
=
data
;
return
[
return
[
...
trees
.
map
(
tree
=>
RepoHelper
.
serialize
Tree
(
tree
,
level
)),
...
trees
.
map
(
tree
=>
RepoHelper
.
serialize
RepoEntity
(
'
tree
'
,
tree
,
level
)),
...
blobs
.
map
(
blob
=>
RepoHelper
.
serializeBlob
(
blob
,
level
)),
...
submodules
.
map
(
submodule
=>
RepoHelper
.
serializeRepoEntity
(
'
submodule
'
,
submodule
,
level
)),
...
submodules
.
map
(
submodule
=>
RepoHelper
.
serializeSubmodule
(
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) {
...
@@ -35,6 +35,7 @@ function setInitialStore(data) {
Store
.
newMrTemplateUrl
=
decodeURIComponent
(
data
.
newMrTemplateUrl
);
Store
.
newMrTemplateUrl
=
decodeURIComponent
(
data
.
newMrTemplateUrl
);
Store
.
customBranchURL
=
decodeURIComponent
(
data
.
blobUrl
);
Store
.
customBranchURL
=
decodeURIComponent
(
data
.
blobUrl
);
Store
.
isRoot
=
convertPermissionToBoolean
(
data
.
root
);
Store
.
isRoot
=
convertPermissionToBoolean
(
data
.
root
);
Store
.
isInitialRoot
=
convertPermissionToBoolean
(
data
.
root
);
Store
.
currentBranch
=
$
(
'
button.dropdown-menu-toggle
'
).
attr
(
'
data-ref
'
);
Store
.
currentBranch
=
$
(
'
button.dropdown-menu-toggle
'
).
attr
(
'
data-ref
'
);
Store
.
checkIsCommitable
();
Store
.
checkIsCommitable
();
Store
.
setBranchHash
();
Store
.
setBranchHash
();
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
ddc0f837
...
@@ -8,6 +8,7 @@ const RepoStore = {
...
@@ -8,6 +8,7 @@ const RepoStore = {
onTopOfBranch
:
false
,
onTopOfBranch
:
false
,
editMode
:
false
,
editMode
:
false
,
isRoot
:
null
,
isRoot
:
null
,
isInitialRoot
:
null
,
prevURL
:
''
,
prevURL
:
''
,
projectId
:
''
,
projectId
:
''
,
projectName
:
''
,
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