diff --git a/frontend/components/containers/documents/DocumentList.vue b/frontend/components/containers/documents/DocumentList.vue
index 4f5eaaed..bcc776a3 100644
--- a/frontend/components/containers/documents/DocumentList.vue
+++ b/frontend/components/containers/documents/DocumentList.vue
@@ -10,10 +10,10 @@
:footer-props="{
'items-per-page-options': [10, 50, 100]
}"
- @input="updateSelected"
item-key="id"
loading-text="Loading... Please wait"
show-select
+ @input="updateSelected"
>
Annotate
@@ -55,6 +55,13 @@
import { mapState, mapActions, mapMutations, mapGetters } from 'vuex'
export default {
+ async fetch() {
+ await this.getDocumentList({
+ projectId: this.$route.params.id,
+ ...this.$route.query
+ })
+ },
+
data() {
return {
search: '',
@@ -88,38 +95,34 @@ export default {
},
watch: {
+ '$route.query': '$fetch',
options: {
- handler() {
- this.updateSearchOptions({
- limit: this.options.itemsPerPage,
- offset: (this.options.page - 1) * this.options.itemsPerPage
- })
- this.getDocumentList({
- projectId: this.$route.params.id
+ handler(newvalue, oldvalue) {
+ this.$router.push({
+ query: {
+ limit: this.options.itemsPerPage,
+ offset: (this.options.page - 1) * this.options.itemsPerPage,
+ q: this.search
+ }
})
},
deep: true
},
search() {
- this.updateSearchOptions({
- q: this.search
- })
- this.getDocumentList({
- projectId: this.$route.params.id
+ this.$router.push({
+ query: {
+ limit: this.options.itemsPerPage,
+ offset: 0,
+ q: this.search
+ }
})
+ this.options.page = 1
}
},
- created() {
- this.initSearchOptions()
- this.getDocumentList({
- projectId: this.$route.params.id
- })
- },
-
methods: {
...mapActions('documents', ['getDocumentList', 'updateDocument']),
- ...mapMutations('documents', ['updateSelected', 'updateSearchOptions', 'setCurrent', 'initSearchOptions']),
+ ...mapMutations('documents', ['updateSelected']),
handleUpdateDocument(payload) {
const data = {
@@ -129,17 +132,17 @@ export default {
this.updateDocument(data)
},
- goToAnnotationPage(doc) {
+ toLabeling(doc) {
const index = this.items.findIndex(item => item.id === doc.id)
- const limit = this.options.itemsPerPage
- const offset = (this.options.page - 1) * limit
- const q = this.search
- this.updateSearchOptions({ limit, offset, q })
- this.$router.push('/projects/' + this.$route.params.id + '/' + this.getLink)
- this.setCurrent(index)
- const checkpoint = {}
- checkpoint[this.$route.params.id] = index + 1
- localStorage.setItem('checkpoint', JSON.stringify(checkpoint))
+ const offset = (this.options.page - 1) * this.options.itemsPerPage
+ const page = offset + index + 1
+ this.$router.push({
+ path: `/projects/${this.$route.params.id}/${this.getLink}`,
+ query: {
+ page,
+ q: this.search
+ }
+ })
}
}
}
diff --git a/frontend/pages/projects/_id/dataset/index.vue b/frontend/pages/projects/_id/dataset/index.vue
index 009923d9..36312a8f 100644
--- a/frontend/pages/projects/_id/dataset/index.vue
+++ b/frontend/pages/projects/_id/dataset/index.vue
@@ -22,8 +22,9 @@ export default {
DocumentDeletionButton
},
- validate({ params }) {
- return /^\d+$/.test(params.id)
+ validate({ params, query }) {
+ console.log(query)
+ return /^\d+$/.test(params.id) && /^\d+|$/.test(query.limit) && /^\d+|$/.test(query.offset)
}
}
diff --git a/frontend/services/document.service.js b/frontend/services/document.service.js
index 11ac3b28..8f72d8f0 100644
--- a/frontend/services/document.service.js
+++ b/frontend/services/document.service.js
@@ -5,7 +5,7 @@ class DocumentService {
this.request = ApiService
}
- getDocumentList({ projectId, limit, offset, q = '', isChecked = '', filterName = '' }) {
+ getDocumentList({ projectId, limit = 10, offset = 0, q = '', isChecked = '', filterName = '' }) {
return this.request.get(`/projects/${projectId}/docs?limit=${limit}&offset=${offset}&q=${q}&${filterName}=${isChecked}`)
}
diff --git a/frontend/store/documents.js b/frontend/store/documents.js
index 20fbaad8..141afe42 100644
--- a/frontend/store/documents.js
+++ b/frontend/store/documents.js
@@ -88,7 +88,7 @@ export const mutations = {
export const actions = {
getDocumentList({ commit, state }, payload) {
commit('setLoading', true)
- payload = Object.assign(payload, state.searchOptions)
+ // payload = Object.assign(payload, state.searchOptions)
return DocumentService.getDocumentList(payload)
.then((response) => {
commit('setDocumentList', response.data.results)