Skip to content

Commit

Permalink
refactor: remove isLoadingNamedEntities from store
Browse files Browse the repository at this point in the history
  • Loading branch information
pirhoo committed Nov 5, 2024
1 parent b8aa34e commit af83224
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/store/modules/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export function initialState() {
idAndRouting: null,
isContentLoaded: false,
isTranslatedContentLoaded: false,
isLoadingNamedEntities: false,
isRecommended: false,
namedEntitiesPaginatedByCategories: {
PERSON: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ import { useWait } from '@/composables/wait'
import { getCategoryIcon } from '@/utils/entity'
const { document, documentRoute } = useDocument()
const { waitFor, loaderId } = useWait()
const { wait, waitFor, loaderId } = useWait()
const { core } = useCore()
const store = useStore()
const router = useRouter()
const filterToken = ref(null)
const mustExtractEntities = computed(() => core.config.is('manageDocuments') && !document.value.hasNerTags)
const loadingNamedEntities = computed(() => store.state.document.loadingNamedEntities)
const hasNamedEntities = computed(() => sumBy(categories.value, getCategoryTotal))
const mustExtractEntities = computed(() => canManageDocuments.value && !hasNerTags.value)
const canManageDocuments = computed(() => core.config.is('manageDocuments'))
const loadingNamedEntities = computed(() => wait.is(loaderId))
const hasNerTags = computed(() => document.value.hasNerTags)
const hasEntities = computed(() => sumBy(categories.value, getCategoryTotal))
const namedEntitiesPaginatedByCategories = computed(() => store.state.document.namedEntitiesPaginatedByCategories)
const namedEntitiesByCategories = computed(() => {
const namedEntitiesByCategories = mapValues(namedEntitiesPaginatedByCategories.value, (pages) => {
Expand Down Expand Up @@ -83,7 +86,7 @@ onMounted(getFirstPageInAllCategories)
</div>

<div v-if="mustExtractEntities" v-html="$t('document.namedEntitiesNotSearched', { indexingLink })"></div>
<div v-else-if="!hasNamedEntities && !loadingNamedEntities">
<div v-else-if="!hasEntities && !loadingNamedEntities">
{{ $t('document.namedEntitiesNotFound') }}
</div>

Expand Down
1 change: 0 additions & 1 deletion tests/unit/specs/store/modules/document.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe('DocumentStore', () => {
expect(store.state.document.idAndRouting).toEqual(initialState().idAndRouting)
expect(store.state.document.isContentLoaded).toEqual(initialState().isContentLoaded)
expect(store.state.document.isTranslatedContentLoaded).toEqual(initialState().isTranslatedContentLoaded)
expect(store.state.document.isLoadingNamedEntities).toEqual(initialState().isLoadingNamedEntities)
expect(store.state.document.isRecommended).toEqual(initialState().isRecommended)
})

Expand Down

0 comments on commit af83224

Please sign in to comment.