Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Frontend
Commits
cf9a44b4
Commit
cf9a44b4
authored
3 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add explicit top-level filters
parent
44388bf9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1019
Add explicit top-level filters
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vue/Navigation/ElementList.vue
+13
-3
13 additions, 3 deletions
vue/Navigation/ElementList.vue
with
13 additions
and
3 deletions
vue/Navigation/ElementList.vue
+
13
−
3
View file @
cf9a44b4
...
...
@@ -311,16 +311,26 @@ export default {
// We cannot use the normal vue-router navigation guards because those only work on the main component of a route
$route
:
{
immediate
:
true
,
handler
({
query
},
oldValue
)
{
async
handler
({
query
},
oldValue
)
{
this
.
parseQuery
(
query
)
/*
* When the handler is run due to `immediate: true`, `oldValue` will be undefined.
* We can use this to detect when the component first loads, and when there are no filters at all
* we can add default filters for top-level elements on projects.
*/
if
(
oldValue
===
undefined
&&
!
query
.
page
&&
!
Object
.
keys
(
this
.
selectedFilters
).
length
&&
!
this
.
useSelection
&&
this
.
corpusId
)
{
// TODO: Also include folder=yes / top level type once those are removed from the backend
if
(
oldValue
===
undefined
&&
!
query
.
page
&&
!
Object
.
keys
(
this
.
selectedFilters
).
length
&&
!
this
.
useSelection
&&
this
.
corpusId
&&
!
this
.
elementId
)
{
// Ensure we have a corpus available
const
corpus
=
await
this
.
$store
.
dispatch
(
'
corpora/get
'
,
{
id
:
this
.
corpusId
})
this
.
selectedFilters
=
{
top_level
:
true
}
if
(
corpus
.
top_level_type
)
this
.
selectedFilters
.
type
=
corpus
.
top_level_type
else
this
.
selectedFilters
.
folder
=
true
}
this
.
onFilterUpdate
()
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment