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
74f459ea
Commit
74f459ea
authored
Feb 05, 2020
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix repository Vue router not working for routes without /-/
Closes
https://gitlab.com/gitlab-org/gitlab/issues/202049
parent
95edb274
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
15 deletions
+16
-15
app/assets/javascripts/repository/index.js
app/assets/javascripts/repository/index.js
+10
-10
app/assets/javascripts/repository/mixins/preload.js
app/assets/javascripts/repository/mixins/preload.js
+2
-2
app/assets/javascripts/repository/router.js
app/assets/javascripts/repository/router.js
+2
-2
ee/app/assets/javascripts/repository/index.js
ee/app/assets/javascripts/repository/index.js
+1
-1
spec/frontend/repository/router_spec.js
spec/frontend/repository/router_spec.js
+1
-0
No files found.
app/assets/javascripts/repository/index.js
View file @
74f459ea
...
...
@@ -28,8 +28,8 @@ export default function setupVueRepositoryList() {
},
});
router
.
afterEach
(({
params
:
{
path
Match
}
})
=>
{
setTitle
(
path
Match
,
ref
,
fullName
);
router
.
afterEach
(({
params
:
{
path
}
})
=>
{
setTitle
(
path
,
ref
,
fullName
);
});
const
breadcrumbEl
=
document
.
getElementById
(
'
js-repo-breadcrumb
'
);
...
...
@@ -48,9 +48,9 @@ export default function setupVueRepositoryList() {
newDirPath
,
}
=
breadcrumbEl
.
dataset
;
router
.
afterEach
(({
params
:
{
path
Match
=
'
/
'
}
})
=>
{
updateFormAction
(
'
.js-upload-blob-form
'
,
uploadPath
,
path
Match
);
updateFormAction
(
'
.js-create-dir-form
'
,
newDirPath
,
path
Match
);
router
.
afterEach
(({
params
:
{
path
=
'
/
'
}
})
=>
{
updateFormAction
(
'
.js-upload-blob-form
'
,
uploadPath
,
path
);
updateFormAction
(
'
.js-create-dir-form
'
,
newDirPath
,
path
);
});
// eslint-disable-next-line no-new
...
...
@@ -61,7 +61,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
return
h
(
Breadcrumbs
,
{
props
:
{
currentPath
:
this
.
$route
.
params
.
path
Match
,
currentPath
:
this
.
$route
.
params
.
path
,
canCollaborate
:
parseBoolean
(
canCollaborate
),
canEditTree
:
parseBoolean
(
canEditTree
),
newBranchPath
,
...
...
@@ -84,7 +84,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
return
h
(
LastCommit
,
{
props
:
{
currentPath
:
this
.
$route
.
params
.
path
Match
,
currentPath
:
this
.
$route
.
params
.
path
,
},
});
},
...
...
@@ -100,7 +100,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
return
h
(
TreeActionLink
,
{
props
:
{
path
:
historyLink
+
(
this
.
$route
.
params
.
pathMatch
||
'
/
'
)
,
path
:
`
${
historyLink
}
/
${
this
.
$route
.
params
.
path
||
''
}
`
,
text
:
__
(
'
History
'
),
},
});
...
...
@@ -117,7 +117,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
return
h
(
TreeActionLink
,
{
props
:
{
path
:
webIDEUrl
(
`/
${
projectPath
}
/edit/
${
ref
}
/-
${
this
.
$route
.
params
.
pathMatch
||
'
/
'
}
`
),
path
:
webIDEUrl
(
`/
${
projectPath
}
/edit/
${
ref
}
/-
/
${
this
.
$route
.
params
.
path
||
'
'
}
`
),
text
:
__
(
'
Web IDE
'
),
cssClass
:
'
qa-web-ide-button
'
,
},
...
...
@@ -134,7 +134,7 @@ export default function setupVueRepositoryList() {
el
:
directoryDownloadLinks
,
router
,
render
(
h
)
{
const
currentPath
=
this
.
$route
.
params
.
path
Match
||
'
/
'
;
const
currentPath
=
this
.
$route
.
params
.
path
||
'
/
'
;
if
(
currentPath
!==
'
/
'
)
{
return
h
(
DirectoryDownloadLinks
,
{
...
...
app/assets/javascripts/repository/mixins/preload.js
View file @
74f459ea
...
...
@@ -13,10 +13,10 @@ export default {
return
{
projectPath
:
''
,
loadingPath
:
null
};
},
beforeRouteUpdate
(
to
,
from
,
next
)
{
this
.
preload
(
to
.
params
.
path
Match
,
next
);
this
.
preload
(
to
.
params
.
path
,
next
);
},
methods
:
{
preload
(
path
,
next
)
{
preload
(
path
=
'
/
'
,
next
)
{
this
.
loadingPath
=
path
.
replace
(
/^
\/
/
,
''
);
return
this
.
$apollo
...
...
app/assets/javascripts/repository/router.js
View file @
74f459ea
...
...
@@ -12,11 +12,11 @@ export default function createRouter(base, baseRef) {
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
base
),
routes
:
[
{
path
:
`
/-/tree/
${
escape
(
baseRef
)}
(/.*)?
`
,
path
:
`
(/-)?/tree/
${
escape
(
baseRef
)}
/:path*
`
,
name
:
'
treePath
'
,
component
:
TreePage
,
props
:
route
=>
({
path
:
route
.
params
.
path
Match
&&
(
route
.
params
.
pathMatch
.
replace
(
/^
\/
/
,
''
)
||
'
/
'
)
,
path
:
route
.
params
.
path
?.
replace
(
/^
\/
/
,
''
)
||
'
/
'
,
}),
},
{
...
...
ee/app/assets/javascripts/repository/index.js
View file @
74f459ea
...
...
@@ -18,7 +18,7 @@ export default () => {
axios
.
post
(
data
.
pathLocksToggle
,
{
path
:
router
.
currentRoute
.
params
.
path
Match
.
replace
(
/^
\/
/
,
''
),
path
:
router
.
currentRoute
.
params
.
path
.
replace
(
/^
\/
/
,
''
),
})
.
then
(()
=>
window
.
location
.
reload
())
.
catch
(()
=>
{
...
...
spec/frontend/repository/router_spec.js
View file @
74f459ea
...
...
@@ -6,6 +6,7 @@ describe('Repository router spec', () => {
it
.
each
`
path | component | componentName
${
'
/
'
}
|
${
IndexPage
}
|
${
'
IndexPage
'
}
${
'
/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master/app/assets
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/123/app/assets
'
}
|
${
null
}
|
${
'
null
'
}
...
...
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