Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a settings filter for project settings #2659

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/dispatch/static/dispatch/src/components/AppDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
</template>
</v-navigation-drawer>
<v-list dense nav class="grow">
<v-text-field v-model="q" append-icon="search" label="Filter" single-line hide-details>
</v-text-field>
<span v-for="(subRoutes, group, idx) in children" :key="group">
<v-subheader>
{{ group | capitalize }}
Expand Down Expand Up @@ -144,6 +146,7 @@ export default {
maxScrollbarLength: 160,
},
mini: false,
q: "",
}),

created() {
Expand Down Expand Up @@ -176,7 +179,10 @@ export default {
},
showChildPane() {
if (Object.keys(this.children).length) {
return Object.values(this.children)[0].length > 1
return Object.values(this.children)[0].length || this.q.length
}
if (this.q.length) {
return true
}
return false
},
Expand All @@ -198,9 +204,22 @@ export default {
return child.meta.group
})

return groupBy(children, function (child) {
// Filter children if we have a filter string
let q = this.q
if (q.length) {
children = children.filter(function (item) {
let metadata =
item.meta.group.toLowerCase() +
item.meta.subMenu.toLowerCase() +
item.meta.title.toLowerCase()
return metadata.includes(q.toLowerCase())
})
}

children = groupBy(children, function (child) {
return child.meta.group
})
return children
},
...mapState("app", ["toggleDrawer"]),
},
Expand Down