Skip to content

Commit bffccb5

Browse files
authored
Disables tag recommendations in TagFilterAutoComplete UI component (#3357)
* Disables tag recommendations in TagFilterAutoComplete UI component * Adds a filter for the tag discoverable column
1 parent b2f3898 commit bffccb5

File tree

6 files changed

+50
-34
lines changed

6 files changed

+50
-34
lines changed

src/dispatch/static/dispatch/src/tag/DeleteDialog.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</v-card-title>
77
<v-card-text>
88
<v-container grid-list-md>
9-
<v-layout wrap> Are you sure you would like to delete this tag? </v-layout>
9+
<v-layout wrap> Are you sure you want to delete this tag? </v-layout>
1010
</v-container>
1111
</v-card-text>
1212
<v-card-actions>
@@ -21,11 +21,14 @@
2121
<script>
2222
import { mapActions } from "vuex"
2323
import { mapFields } from "vuex-map-fields"
24+
2425
export default {
2526
name: "TagDeleteDialog",
27+
2628
data() {
2729
return {}
2830
},
31+
2932
computed: {
3033
...mapFields("tag", ["dialogs.showRemove"]),
3134
},

src/dispatch/static/dispatch/src/tag/List.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<v-divider />
55
<v-list>
66
<v-list-group prepend-icon="label" no-action color="info">
7-
<template v-slot:activator>
7+
<template #activator>
88
<v-list-item>
99
<v-list-item-content>
1010
<v-list-item-title>Tags ({{ items.length }})</v-list-item-title>
@@ -29,6 +29,7 @@
2929
import { mapActions } from "vuex"
3030
3131
import NewEditSheet from "@/tag/NewEditSheet.vue"
32+
3233
export default {
3334
name: "TagList",
3435

src/dispatch/static/dispatch/src/tag/NewEditSheet.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<ValidationObserver v-slot="{ invalid, validated }">
33
<v-navigation-drawer v-model="showCreateEdit" app clipped right width="500">
4-
<template v-slot:prepend>
4+
<template #prepend>
55
<v-list-item two-line>
66
<v-list-item-content>
77
<v-list-item-title v-if="id" class="title"> Edit </v-list-item-title>
@@ -117,10 +117,11 @@
117117
</template>
118118

119119
<script>
120-
import { mapFields } from "vuex-map-fields"
121-
import { mapActions } from "vuex"
122120
import { ValidationObserver, ValidationProvider, extend } from "vee-validate"
121+
import { mapActions } from "vuex"
122+
import { mapFields } from "vuex-map-fields"
123123
import { required } from "vee-validate/dist/rules"
124+
124125
import TagTypeSelect from "@/tag_type/TagTypeSelect.vue"
125126
126127
extend("required", {

src/dispatch/static/dispatch/src/tag/Table.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</template>
4545
<template v-slot:item.data-table-actions="{ item }">
4646
<v-menu bottom left>
47-
<template v-slot:activator="{ on }">
47+
<template #activator="{ on }">
4848
<v-btn icon v-on="on">
4949
<v-icon>mdi-dots-vertical</v-icon>
5050
</v-btn>
@@ -70,9 +70,9 @@
7070
import { mapFields } from "vuex-map-fields"
7171
import { mapActions } from "vuex"
7272
73-
import SettingsBreadcrumbs from "@/components/SettingsBreadcrumbs.vue"
7473
import DeleteDialog from "@/tag/DeleteDialog.vue"
7574
import NewEditSheet from "@/tag/NewEditSheet.vue"
75+
import SettingsBreadcrumbs from "@/components/SettingsBreadcrumbs.vue"
7676
7777
export default {
7878
name: "TagTable",

src/dispatch/static/dispatch/src/tag/TagFilterAutoComplete.vue

+36-27
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
no-filter
1515
v-model="tags"
1616
>
17-
<template v-slot:no-data>
17+
<template #no-data>
1818
<v-list-item>
1919
<v-list-item-content>
2020
<v-list-item-title>
@@ -47,7 +47,7 @@
4747
</v-list-item-subtitle>
4848
</v-list-item-content>
4949
</template>
50-
<template v-slot:append-item>
50+
<template #append-item>
5151
<v-list-item v-if="more" @click="loadMore()">
5252
<v-list-item-content>
5353
<v-list-item-subtitle> Load More </v-list-item-subtitle>
@@ -65,6 +65,7 @@ import TagApi from "@/tag/api"
6565
6666
export default {
6767
name: "TagAutoComplete",
68+
6869
props: {
6970
value: {
7071
type: Array,
@@ -89,6 +90,7 @@ export default {
8990
default: null,
9091
},
9192
},
93+
9294
data() {
9395
return {
9496
loading: false,
@@ -136,47 +138,54 @@ export default {
136138
this.error = null
137139
this.loading = "error"
138140
139-
// fetch recommendations model and ID are provided
140-
if (!this.search) {
141-
if (this.model && this.modelId) {
142-
TagApi.getRecommendations(this.model, this.modelId).then((response) => {
143-
this.items = response.data.items
144-
this.total = response.data.total
145-
// we don't support more for suggestions (limited)
146-
this.more = false
147-
this.loading = false
148-
})
149-
return
150-
}
151-
}
141+
// NOTE: Disabled until loading more is supported
142+
//
143+
// Fetch recommendations model and ID are provided
144+
// if (!this.search) {
145+
// if (this.model && this.modelId) {
146+
// TagApi.getRecommendations(this.model, this.modelId).then((response) => {
147+
// this.items = response.data.items
148+
// this.total = response.data.total
149+
// // we don't support more for suggestions (limited)
150+
// this.more = false
151+
// this.loading = false
152+
// })
153+
// return
154+
// }
155+
// }
152156
153157
let filterOptions = {
154158
q: this.search,
155159
itemsPerPage: this.numItems,
160+
sortBy: ["tag_type.name"],
161+
descending: [false],
156162
}
157163
164+
let filters = {}
165+
158166
if (this.project) {
159-
filterOptions = {
160-
...filterOptions,
161-
filters: {
162-
project: [this.project],
163-
},
164-
}
167+
// we add a project filter
168+
filters["project"] = [this.project]
165169
}
166170
167-
let tagTypeFilter = {}
171+
// we add a filter to only retrun discoverable tags
172+
filters["tagFilter"] = [{ model: "Tag", field: "discoverable", op: "==", value: "true" }]
173+
168174
if (filterOptions.q) {
169175
if (filterOptions.q.indexOf("/") != -1) {
176+
// we modify the query and add a tag type filter
170177
let [tagType, query] = filterOptions.q.split("/")
171178
filterOptions.q = query
172-
tagTypeFilter = [{ model: "TagType", field: "name", op: "==", value: tagType }]
179+
filters["tagTypeFilter"] = [{ model: "TagType", field: "name", op: "==", value: tagType }]
173180
}
174181
}
175182
176-
filterOptions = SearchUtils.createParametersFromTableOptions(
177-
{ ...filterOptions },
178-
tagTypeFilter
179-
)
183+
filterOptions = {
184+
...filterOptions,
185+
filters: filters,
186+
}
187+
188+
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })
180189
181190
TagApi.getAll(filterOptions).then((response) => {
182191
this.items = response.data.items

src/dispatch/static/dispatch/src/tag/TagSummaryTable.vue

+2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
<script>
3838
import { mapActions } from "vuex"
3939
import NewEditSheet from "@/tag/NewEditSheet.vue"
40+
4041
export default {
4142
name: "TagSummaryTable",
4243
4344
components: {
4445
NewEditSheet,
4546
},
47+
4648
data() {
4749
return {
4850
headers: [

0 commit comments

Comments
 (0)