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
Hide 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() {
...
@@ -28,8 +28,8 @@ export default function setupVueRepositoryList() {
},
},
});
});
router
.
afterEach
(({
params
:
{
path
Match
}
})
=>
{
router
.
afterEach
(({
params
:
{
path
}
})
=>
{
setTitle
(
path
Match
,
ref
,
fullName
);
setTitle
(
path
,
ref
,
fullName
);
});
});
const
breadcrumbEl
=
document
.
getElementById
(
'
js-repo-breadcrumb
'
);
const
breadcrumbEl
=
document
.
getElementById
(
'
js-repo-breadcrumb
'
);
...
@@ -48,9 +48,9 @@ export default function setupVueRepositoryList() {
...
@@ -48,9 +48,9 @@ export default function setupVueRepositoryList() {
newDirPath
,
newDirPath
,
}
=
breadcrumbEl
.
dataset
;
}
=
breadcrumbEl
.
dataset
;
router
.
afterEach
(({
params
:
{
path
Match
=
'
/
'
}
})
=>
{
router
.
afterEach
(({
params
:
{
path
=
'
/
'
}
})
=>
{
updateFormAction
(
'
.js-upload-blob-form
'
,
uploadPath
,
path
Match
);
updateFormAction
(
'
.js-upload-blob-form
'
,
uploadPath
,
path
);
updateFormAction
(
'
.js-create-dir-form
'
,
newDirPath
,
path
Match
);
updateFormAction
(
'
.js-create-dir-form
'
,
newDirPath
,
path
);
});
});
// eslint-disable-next-line no-new
// eslint-disable-next-line no-new
...
@@ -61,7 +61,7 @@ export default function setupVueRepositoryList() {
...
@@ -61,7 +61,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
render
(
h
)
{
return
h
(
Breadcrumbs
,
{
return
h
(
Breadcrumbs
,
{
props
:
{
props
:
{
currentPath
:
this
.
$route
.
params
.
path
Match
,
currentPath
:
this
.
$route
.
params
.
path
,
canCollaborate
:
parseBoolean
(
canCollaborate
),
canCollaborate
:
parseBoolean
(
canCollaborate
),
canEditTree
:
parseBoolean
(
canEditTree
),
canEditTree
:
parseBoolean
(
canEditTree
),
newBranchPath
,
newBranchPath
,
...
@@ -84,7 +84,7 @@ export default function setupVueRepositoryList() {
...
@@ -84,7 +84,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
render
(
h
)
{
return
h
(
LastCommit
,
{
return
h
(
LastCommit
,
{
props
:
{
props
:
{
currentPath
:
this
.
$route
.
params
.
path
Match
,
currentPath
:
this
.
$route
.
params
.
path
,
},
},
});
});
},
},
...
@@ -100,7 +100,7 @@ export default function setupVueRepositoryList() {
...
@@ -100,7 +100,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
render
(
h
)
{
return
h
(
TreeActionLink
,
{
return
h
(
TreeActionLink
,
{
props
:
{
props
:
{
path
:
historyLink
+
(
this
.
$route
.
params
.
pathMatch
||
'
/
'
)
,
path
:
`
${
historyLink
}
/
${
this
.
$route
.
params
.
path
||
''
}
`
,
text
:
__
(
'
History
'
),
text
:
__
(
'
History
'
),
},
},
});
});
...
@@ -117,7 +117,7 @@ export default function setupVueRepositoryList() {
...
@@ -117,7 +117,7 @@ export default function setupVueRepositoryList() {
render
(
h
)
{
render
(
h
)
{
return
h
(
TreeActionLink
,
{
return
h
(
TreeActionLink
,
{
props
:
{
props
:
{
path
:
webIDEUrl
(
`/
${
projectPath
}
/edit/
${
ref
}
/-
${
this
.
$route
.
params
.
pathMatch
||
'
/
'
}
`
),
path
:
webIDEUrl
(
`/
${
projectPath
}
/edit/
${
ref
}
/-
/
${
this
.
$route
.
params
.
path
||
'
'
}
`
),
text
:
__
(
'
Web IDE
'
),
text
:
__
(
'
Web IDE
'
),
cssClass
:
'
qa-web-ide-button
'
,
cssClass
:
'
qa-web-ide-button
'
,
},
},
...
@@ -134,7 +134,7 @@ export default function setupVueRepositoryList() {
...
@@ -134,7 +134,7 @@ export default function setupVueRepositoryList() {
el
:
directoryDownloadLinks
,
el
:
directoryDownloadLinks
,
router
,
router
,
render
(
h
)
{
render
(
h
)
{
const
currentPath
=
this
.
$route
.
params
.
path
Match
||
'
/
'
;
const
currentPath
=
this
.
$route
.
params
.
path
||
'
/
'
;
if
(
currentPath
!==
'
/
'
)
{
if
(
currentPath
!==
'
/
'
)
{
return
h
(
DirectoryDownloadLinks
,
{
return
h
(
DirectoryDownloadLinks
,
{
...
...
app/assets/javascripts/repository/mixins/preload.js
View file @
74f459ea
...
@@ -13,10 +13,10 @@ export default {
...
@@ -13,10 +13,10 @@ export default {
return
{
projectPath
:
''
,
loadingPath
:
null
};
return
{
projectPath
:
''
,
loadingPath
:
null
};
},
},
beforeRouteUpdate
(
to
,
from
,
next
)
{
beforeRouteUpdate
(
to
,
from
,
next
)
{
this
.
preload
(
to
.
params
.
path
Match
,
next
);
this
.
preload
(
to
.
params
.
path
,
next
);
},
},
methods
:
{
methods
:
{
preload
(
path
,
next
)
{
preload
(
path
=
'
/
'
,
next
)
{
this
.
loadingPath
=
path
.
replace
(
/^
\/
/
,
''
);
this
.
loadingPath
=
path
.
replace
(
/^
\/
/
,
''
);
return
this
.
$apollo
return
this
.
$apollo
...
...
app/assets/javascripts/repository/router.js
View file @
74f459ea
...
@@ -12,11 +12,11 @@ export default function createRouter(base, baseRef) {
...
@@ -12,11 +12,11 @@ export default function createRouter(base, baseRef) {
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
base
),
base
:
joinPaths
(
gon
.
relative_url_root
||
''
,
base
),
routes
:
[
routes
:
[
{
{
path
:
`
/-/tree/
${
escape
(
baseRef
)}
(/.*)?
`
,
path
:
`
(/-)?/tree/
${
escape
(
baseRef
)}
/:path*
`
,
name
:
'
treePath
'
,
name
:
'
treePath
'
,
component
:
TreePage
,
component
:
TreePage
,
props
:
route
=>
({
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 () => {
...
@@ -18,7 +18,7 @@ export default () => {
axios
axios
.
post
(
data
.
pathLocksToggle
,
{
.
post
(
data
.
pathLocksToggle
,
{
path
:
router
.
currentRoute
.
params
.
path
Match
.
replace
(
/^
\/
/
,
''
),
path
:
router
.
currentRoute
.
params
.
path
.
replace
(
/^
\/
/
,
''
),
})
})
.
then
(()
=>
window
.
location
.
reload
())
.
then
(()
=>
window
.
location
.
reload
())
.
catch
(()
=>
{
.
catch
(()
=>
{
...
...
spec/frontend/repository/router_spec.js
View file @
74f459ea
...
@@ -6,6 +6,7 @@ describe('Repository router spec', () => {
...
@@ -6,6 +6,7 @@ describe('Repository router spec', () => {
it
.
each
`
it
.
each
`
path | component | componentName
path | component | componentName
${
'
/
'
}
|
${
IndexPage
}
|
${
'
IndexPage
'
}
${
'
/
'
}
|
${
IndexPage
}
|
${
'
IndexPage
'
}
${
'
/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master/app/assets
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/master/app/assets
'
}
|
${
TreePage
}
|
${
'
TreePage
'
}
${
'
/-/tree/123/app/assets
'
}
|
${
null
}
|
${
'
null
'
}
${
'
/-/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