|
@ -88,14 +88,14 @@ export default Vue.extend({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
computed: { |
|
|
computed: { |
|
|
headers() { |
|
|
|
|
|
|
|
|
headers(): { text: any; value: string; sortable?: boolean }[] { |
|
|
return [ |
|
|
return [ |
|
|
{ text: this.$t('generic.name'), value: 'name' }, |
|
|
{ text: this.$t('generic.name'), value: 'name' }, |
|
|
{ text: this.$t('generic.description'), value: 'description' }, |
|
|
|
|
|
|
|
|
{ text: this.$t('generic.description'), value: 'description', sortable: false }, |
|
|
{ text: this.$t('generic.type'), value: 'projectType' }, |
|
|
{ text: this.$t('generic.type'), value: 'projectType' }, |
|
|
{ text: 'Created', value: 'createdAt' }, |
|
|
{ text: 'Created', value: 'createdAt' }, |
|
|
{ text: 'Author', value: 'author' }, |
|
|
{ text: 'Author', value: 'author' }, |
|
|
{ text: 'Tags', value: 'tags' } |
|
|
|
|
|
|
|
|
{ text: 'Tags', value: 'tags', sortable: false } |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@ -103,32 +103,35 @@ export default Vue.extend({ |
|
|
watch: { |
|
|
watch: { |
|
|
options: { |
|
|
options: { |
|
|
handler() { |
|
|
handler() { |
|
|
const self: any = this |
|
|
|
|
|
self.updateQuery({ |
|
|
|
|
|
|
|
|
this.updateQuery({ |
|
|
query: { |
|
|
query: { |
|
|
limit: self.options.itemsPerPage.toString(), |
|
|
|
|
|
offset: ((self.options.page - 1) * self.options.itemsPerPage).toString(), |
|
|
|
|
|
q: self.search |
|
|
|
|
|
|
|
|
limit: this.options.itemsPerPage.toString(), |
|
|
|
|
|
offset: ((this.options.page - 1) * this.options.itemsPerPage).toString(), |
|
|
|
|
|
q: this.search |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
deep: true |
|
|
deep: true |
|
|
}, |
|
|
}, |
|
|
search() { |
|
|
search() { |
|
|
const self: any = this |
|
|
|
|
|
self.updateQuery({ |
|
|
|
|
|
|
|
|
this.updateQuery({ |
|
|
query: { |
|
|
query: { |
|
|
limit: self.options.itemsPerPage.toString(), |
|
|
|
|
|
|
|
|
limit: this.options.itemsPerPage.toString(), |
|
|
offset: '0', |
|
|
offset: '0', |
|
|
q: self.search |
|
|
|
|
|
|
|
|
q: this.search |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
self.options.page = 1 |
|
|
|
|
|
|
|
|
this.options.page = 1 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
updateQuery(payload: any) { |
|
|
updateQuery(payload: any) { |
|
|
|
|
|
const { sortBy, sortDesc } = this.options |
|
|
|
|
|
if (sortBy.length === 1 && sortDesc.length === 1) { |
|
|
|
|
|
payload.query.sortBy = sortBy[0] |
|
|
|
|
|
payload.query.sortDesc = sortDesc[0] |
|
|
|
|
|
} |
|
|
this.$emit('update:query', payload) |
|
|
this.$emit('update:query', payload) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|