14
14
no-filter
15
15
v-model =" tags"
16
16
>
17
- <template v-slot : no-data >
17
+ <template # no-data >
18
18
<v-list-item >
19
19
<v-list-item-content >
20
20
<v-list-item-title >
47
47
</v-list-item-subtitle >
48
48
</v-list-item-content >
49
49
</template >
50
- <template v-slot : append-item >
50
+ <template # append-item >
51
51
<v-list-item v-if =" more" @click =" loadMore()" >
52
52
<v-list-item-content >
53
53
<v-list-item-subtitle > Load More </v-list-item-subtitle >
@@ -65,6 +65,7 @@ import TagApi from "@/tag/api"
65
65
66
66
export default {
67
67
name: " TagAutoComplete" ,
68
+
68
69
props: {
69
70
value: {
70
71
type: Array ,
@@ -89,6 +90,7 @@ export default {
89
90
default: null ,
90
91
},
91
92
},
93
+
92
94
data () {
93
95
return {
94
96
loading: false ,
@@ -136,47 +138,54 @@ export default {
136
138
this .error = null
137
139
this .loading = " error"
138
140
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
+ // }
152
156
153
157
let filterOptions = {
154
158
q: this .search ,
155
159
itemsPerPage: this .numItems ,
160
+ sortBy: [" tag_type.name" ],
161
+ descending: [false ],
156
162
}
157
163
164
+ let filters = {}
165
+
158
166
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 ]
165
169
}
166
170
167
- let tagTypeFilter = {}
171
+ // we add a filter to only retrun discoverable tags
172
+ filters[" tagFilter" ] = [{ model: " Tag" , field: " discoverable" , op: " ==" , value: " true" }]
173
+
168
174
if (filterOptions .q ) {
169
175
if (filterOptions .q .indexOf (" /" ) != - 1 ) {
176
+ // we modify the query and add a tag type filter
170
177
let [tagType, query] = filterOptions .q .split (" /" )
171
178
filterOptions .q = query
172
- tagTypeFilter = [{ model: " TagType" , field: " name" , op: " ==" , value: tagType }]
179
+ filters[ " tagTypeFilter" ] = [{ model: " TagType" , field: " name" , op: " ==" , value: tagType }]
173
180
}
174
181
}
175
182
176
- filterOptions = SearchUtils .createParametersFromTableOptions (
177
- { ... filterOptions },
178
- tagTypeFilter
179
- )
183
+ filterOptions = {
184
+ ... filterOptions,
185
+ filters: filters,
186
+ }
187
+
188
+ filterOptions = SearchUtils .createParametersFromTableOptions ({ ... filterOptions })
180
189
181
190
TagApi .getAll (filterOptions).then ((response ) => {
182
191
this .items = response .data .items
0 commit comments