Skip to content

Commit

Permalink
[ICIJ/datashare#349] Delete unused actions and clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Mar 10, 2020
1 parent 8c89580 commit 9bbc3be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
6 changes: 1 addition & 5 deletions src/components/document/DocumentTabNamedEntities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<script>
import capitalize from 'lodash/capitalize'
import get from 'lodash/get'
import keys from 'lodash/keys'
import sumBy from 'lodash/sumBy'
import { mapState } from 'vuex'
Expand All @@ -68,10 +67,7 @@ export default {
return sumBy(this.categories, category => this.getCategoryTotal(category))
},
categories () {
return keys(this.namedEntitiesPaginatedByCategories)
},
namedEntities () {
return this.$store.getters['document/namedEntities']
return this.$store.getters['document/categories']
}
},
async mounted () {
Expand Down
13 changes: 2 additions & 11 deletions src/store/modules/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export const getters = {
return category => {
const pages = get(state, ['namedEntitiesPaginatedByCategories', category], [])
// Sum up all page size
return sumBy(pages, page => {
return get(page, 'hits.length', 0)
})
return sumBy(pages, page => get(page, 'hits.length', 0))
}
},
namedEntities (state) {
Expand Down Expand Up @@ -167,18 +165,11 @@ export const actions = {
const { id, routing } = state.idAndRouting
const raw = await elasticsearch.getDocumentNamedEntitiesInCategory(index, id, routing, from, 50, category)
const page = new EsDocList(raw)
commit('namedEntitiesPageInCategory', { category, page })
return page
return commit('namedEntitiesPageInCategory', { category, page })
} catch (_) {
return null
}
},
async loadingNamedEntities ({ commit }, callbackWithPromise) {
commit('toggleIsLoadingNamedEntities', true)
const result = await callbackWithPromise()
commit('toggleIsLoadingNamedEntities', false)
return result
},
async getTags ({ state, commit }) {
try {
const tags = await api.getTags(state.doc.index, state.doc.id)
Expand Down

0 comments on commit 9bbc3be

Please sign in to comment.