Browse Source

Update moving from dataset to annotation page

pull/341/head
Hironsan 5 years ago
parent
commit
1416eec878
9 changed files with 39 additions and 33 deletions
  1. 6
      frontend/components/containers/annotation/EntityItemBox.vue
  2. 14
      frontend/components/containers/annotation/Paginator.vue
  3. 6
      frontend/components/containers/annotation/Seq2seqContainer.vue
  4. 6
      frontend/components/containers/annotation/TextClassification.vue
  5. 21
      frontend/components/containers/documents/DocumentList.vue
  6. 4
      frontend/components/containers/members/MemberList.vue
  7. 4
      frontend/layouts/error.vue
  8. 7
      frontend/store/documents.js
  9. 4
      frontend/store/members.js

6
frontend/components/containers/annotation/EntityItemBox.vue

@ -28,11 +28,9 @@ export default {
},
created() {
const payload = {
this.getLabelList({
projectId: this.$route.params.id
}
this.getLabelList(payload)
this.getDocumentList(payload)
})
},
methods: {

14
frontend/components/containers/annotation/Paginator.vue

@ -31,7 +31,7 @@ export default {
data() {
return {
page: 1,
limit: 5
limit: 10
}
},
@ -54,11 +54,13 @@ export default {
localStorage.setItem('checkpoint', JSON.stringify(checkpoint))
},
offset() {
this.getDocumentList({
projectId: this.$route.params.id,
this.updateSearchOptions({
limit: this.limit,
offset: this.offset
})
this.getDocumentList({
projectId: this.$route.params.id
})
},
current() {
this.setCurrent(this.current)
@ -69,15 +71,13 @@ export default {
const checkpoint = JSON.parse(localStorage.getItem('checkpoint'))
this.page = checkpoint ? checkpoint[this.$route.params.id] : 1
this.getDocumentList({
projectId: this.$route.params.id,
limit: this.limit,
offset: this.offset
projectId: this.$route.params.id
})
},
methods: {
...mapActions('documents', ['getDocumentList']),
...mapMutations('documents', ['setCurrent']),
...mapMutations('documents', ['setCurrent', 'updateSearchOptions']),
prevPage() {
this.page -= 1
},

6
frontend/components/containers/annotation/Seq2seqContainer.vue

@ -32,12 +32,6 @@ export default {
...mapGetters('documents', ['currentDoc'])
},
created() {
this.getDocumentList({
projectId: this.$route.params.id
})
},
methods: {
...mapActions('documents', ['getDocumentList', 'deleteAnnotation', 'updateAnnotation', 'addAnnotation']),
_deleteAnnotation(annotationId) {

6
frontend/components/containers/annotation/TextClassification.vue

@ -30,11 +30,9 @@ export default {
},
created() {
const payload = {
this.getLabelList({
projectId: this.$route.params.id
}
this.getLabelList(payload)
this.getDocumentList(payload)
})
},
methods: {

21
frontend/components/containers/documents/DocumentList.vue

@ -71,23 +71,28 @@ export default {
watch: {
options: {
handler() {
this.getDocumentList({
projectId: this.$route.params.id,
this.updateSearchOptions({
limit: this.options.itemsPerPage,
offset: (this.options.page - 1) * this.options.itemsPerPage
})
this.getDocumentList({
projectId: this.$route.params.id
})
},
deep: true
},
search() {
this.getDocumentList({
projectId: this.$route.params.id,
this.updateSearchOptions({
q: this.search
})
this.getDocumentList({
projectId: this.$route.params.id
})
}
},
created() {
this.initSearchOptions()
this.getDocumentList({
projectId: this.$route.params.id
})
@ -95,7 +100,7 @@ export default {
methods: {
...mapActions('documents', ['getDocumentList', 'updateDocument']),
...mapMutations('documents', ['updateSelected', 'updateSearchOptions', 'setCurrent']),
...mapMutations('documents', ['updateSelected', 'updateSearchOptions', 'setCurrent', 'initSearchOptions']),
handleUpdateDocument(payload) {
const data = {
@ -113,9 +118,9 @@ export default {
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
// localStorage.setItem('checkpoint', JSON.stringify(checkpoint))
const checkpoint = {}
checkpoint[this.$route.params.id] = index + 1
localStorage.setItem('checkpoint', JSON.stringify(checkpoint))
}
}
}

4
frontend/components/containers/members/MemberList.vue

@ -70,7 +70,9 @@ export default {
},
created() {
this.getMemberList()
this.getMemberList({
projectId: this.$route.params.id
})
},
methods: {

4
frontend/layouts/error.vue

@ -6,7 +6,9 @@
>
<v-layout align-center>
<v-flex text-center>
<h1 class="display-2 primary--text">Whoops, 404</h1>
<h1 class="display-2 primary--text">
Whoops, 404
</h1>
<p>The page you were looking for does not exist</p>
<v-btn
to="/"

7
frontend/store/documents.js

@ -103,6 +103,13 @@ export const mutations = {
},
updateSearchOptions(state, payload) {
state.searchOptions = Object.assign(state.searchOptions, payload)
},
initSearchOptions(state) {
state.searchOptions = {
limit: 10,
offset: 0,
q: ''
}
}
}

4
frontend/store/members.js

@ -52,9 +52,9 @@ export const mutations = {
}
export const actions = {
getMemberList({ commit }, config) {
getMemberList({ commit }, payload) {
commit('setLoading', true)
return MemberService.getMemberList()
return MemberService.getMemberList(payload.projectId)
.then((response) => {
commit('setMemberList', response)
})

Loading…
Cancel
Save