diff --git a/src/components/TextReuseClusterMonitor.vue b/src/components/TextReuseClusterMonitor.vue index 6fc62cbe..7e22ba0d 100644 --- a/src/components/TextReuseClusterMonitor.vue +++ b/src/components/TextReuseClusterMonitor.vue @@ -11,9 +11,11 @@

([]) const orderBy = ref('-date') const limit = ref(10) const offset = ref(0) +const isLoading = ref(false) + const shouldUseSearchFilters = ref(false) const pagination = computed(() => ({ @@ -94,8 +98,18 @@ const changePage = (page: number) => { loadPassages() } +const query = computed(() => { + return { + filters: shouldUseSearchFilters.value ? props.filters : [], + offset: offset.value, + limit: limit.value, + order_by: orderBy.value + } +}) + const loadPassages = async () => { const filters = shouldUseSearchFilters.value ? props.filters : [] + isLoading.value = true const { data, total } = await textReusePassageService.find({ query: { filters: filters.concat([{ type: 'textReuseCluster', q: props.item.id }]), @@ -106,6 +120,7 @@ const loadPassages = async () => { }) totalItems.value = total items.value = data + isLoading.value = false } onMounted(async () => { diff --git a/src/components/TextReuseExplorerPage.vue b/src/components/TextReuseExplorerPage.vue index 1e1b3efa..6f48c76c 100644 --- a/src/components/TextReuseExplorerPage.vue +++ b/src/components/TextReuseExplorerPage.vue @@ -180,7 +180,6 @@ class="m-3 pb-4 border-bottom" v-for="item in passages" :key="item.id" - @click="handleTextReusePassageClick" /> @@ -391,29 +390,37 @@ export default { [CommonQueryParameters.SearchFilters]: serializeFilters(optimizeFilters(filters)) }) }, - handleTextReusePassageClick(passage) { - // eslint-disable-next-line - console.debug('[TextReuseExplorer] handleTextReusePassageClick', passage) - // filter exists, update it - const filterExists = this.filters.some(({ type }) => type === 'textReuseCluster') - const trcFilter = FilterFactory.create({ - type: 'textReuseCluster', - q: passage.textReuseCluster.id - }) - if (filterExists) { - this.handleFiltersChanged( - this.filters.map(filter => { - if (filter.type === 'textReuseCluster') { - return trcFilter - } - return filter - }) - ) - return - } else { - this.handleFiltersChanged([...this.filters, trcFilter]) - } - }, + // UNUSED CODE + // handleTextReusePassageClick(passage) { + // // eslint-disable-next-line + // console.debug('[TextReuseExplorer] handleTextReusePassageClick', passage) + // if (typeof passage.textReuseCluster?.id !== 'string') { + // console.warn( + // '[TextReuseExplorer] handleTextReusePassageClick \n - no textReuseCluster.id found in passage:', + // passage + // ) + // return + // } + // // filter exists, update it + // const filterExists = this.filters.some(({ type }) => type === 'textReuseCluster') + // const trcFilter = FilterFactory.create({ + // type: 'textReuseCluster', + // q: passage.textReuseCluster.id + // }) + // if (filterExists) { + // this.handleFiltersChanged( + // this.filters.map(filter => { + // if (filter.type === 'textReuseCluster') { + // return trcFilter + // } + // return filter + // }) + // ) + // return + // } else { + // this.handleFiltersChanged([...this.filters, trcFilter]) + // } + // }, handleAddToCollectionClick(item) { // eslint-disable-next-line console.debug('[TextReuseExplorer] handleAddToCollectionClick', item) diff --git a/src/components/modules/ItemSelector.vue b/src/components/modules/ItemSelector.vue index 9ae6aa2a..cce61332 100644 --- a/src/components/modules/ItemSelector.vue +++ b/src/components/modules/ItemSelector.vue @@ -1,5 +1,5 @@