Skip to content

Commit

Permalink
Fix #2917
Browse files Browse the repository at this point in the history
  • Loading branch information
jlpereira committed Apr 19, 2022
1 parent b2b763d commit 6c2754e
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
### Added
- Tag panel for images in New images task [#2919]
- Repository section for Collection object match task [#2918]
- Match collection object button in Filter collection object [#2917]

### Changed
- Improvements for taxon determinations in comprehensive task
Expand All @@ -26,6 +27,7 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
[#2899]: https://github.com/SpeciesFileGroup/taxonworks/issues/2899
[#2912]: https://github.com/SpeciesFileGroup/taxonworks/issues/2912
[#2904]: https://github.com/SpeciesFileGroup/taxonworks/issues/2904
[#2917]: https://github.com/SpeciesFileGroup/taxonworks/issues/2917
[#2918]: https://github.com/SpeciesFileGroup/taxonworks/issues/2918
[#2919]: https://github.com/SpeciesFileGroup/taxonworks/issues/2919
[#2920]: https://github.com/SpeciesFileGroup/taxonworks/issues/2920
Expand Down
11 changes: 6 additions & 5 deletions app/javascript/vue/routes/routes.js
Expand Up @@ -4,24 +4,25 @@ const RouteNames = {
BrowseOtu: '/tasks/otus/browse',
ContentEditorTask: '/tasks/content/editor/index',
DigitizeTask: '/tasks/accessions/comprehensive',
DwcDashboard: '/tasks/dwc/dashboard',
DwcImport: '/tasks/dwca_import/index',
FilterCollectionObjects: '/tasks/collection_objects/filter',
ImageMatrix: '/tasks/matrix_image/matrix_image/index',
InteractiveKeys: '/tasks/observation_matrices/interactive_key',
ManageBiocurationTask: '/tasks/controlled_vocabularies/biocuration/build_collection',
ManageControlledVocabularyTask: '/tasks/controlled_vocabularies/manage',
MatchCollectionObject: '/tasks/collection_objects/match',
MatrixRowCoder: '/tasks/observation_matrices/row_coder/index',
NewCollectingEvent: '/tasks/collecting_events/new_collecting_event',
NewExtract: '/tasks/extracts/new_extract',
NewNamespace: '/tasks/namespaces/new_namespace',
NewTaxonName: '/tasks/nomenclature/new_taxon_name',
NomenclatureBySource: '/tasks/nomenclature/by_source',
NomenclatureStats: '/tasks/nomenclature/stats',
ObservationMatricesDashboard: '/tasks/observation_matrices/dashboard',
ObservationMatricesHub: '/tasks/observation_matrices/observation_matrix_hub',
PrintLabel: '/tasks/labels/print_labels',
TypeMaterial: '/tasks/type_material/edit_type_material',
NewExtract: '/tasks/extracts/new_extract',
NewNamespace: '/tasks/namespaces/new_namespace',
DwcDashboard: '/tasks/dwc/dashboard',
FilterCollectionObjects: '/tasks/collection_objects/filter'
TypeMaterial: '/tasks/type_material/edit_type_material'
}

export {
Expand Down
35 changes: 26 additions & 9 deletions app/javascript/vue/tasks/collection_objects/filter/app.vue
Expand Up @@ -60,37 +60,50 @@
<span class="separate-left separate-right">|</span>
<csv-button
:url="urlRequest"
:options="{ fields: csvFields }"/>
:options="{ fields: csvFields }"
/>
<dwc-download
class="margin-small-left"
:params="$refs.filterComponent.parseParams"
:total="pagination.total"/>
:total="pagination.total"
/>
<dwc-reindex
class="margin-small-left"
:params="$refs.filterComponent.parseParams"
:total="pagination.total"
/>
<match-button
:ids="ids"
:url="urlRequest"
class="margin-small-left"
/>
</div>
</div>
<div
v-if="pagination"
class="flex-separate margin-medium-bottom"
v-if="pagination">
>
<pagination-component
v-if="pagination"
@nextPage="loadPage"
:pagination="pagination"/>
@next-page="loadPage"
:pagination="pagination"
/>
<pagination-count
:pagination="pagination"
v-model="per"/>
v-model="per"
/>
</div>
<list-component
v-if="Object.keys(list).length"
v-model="ids"
:list="list"
@onSort="list.data = $event"/>
@on-sort="list.data = $event"
/>
<h2
v-if="alreadySearch && !list"
class="subtle middle horizontal-center-content no-found-message">No records found.
class="subtle middle horizontal-center-content no-found-message"
>
No records found.
</h2>
</div>
</div>
Expand All @@ -108,8 +121,11 @@ import GetPagination from 'helpers/getPagination'
import DwcDownload from './components/dwcDownload.vue'
import DwcReindex from './components/dwcReindex.vue'
import SelectAll from './components/selectAll.vue'
import MatchButton from './components/matchButton.vue'
export default {
name: 'FilterCollectionObjects',
components: {
PaginationComponent,
FilterComponent,
Expand All @@ -118,7 +134,8 @@ export default {
PaginationCount,
DwcDownload,
DwcReindex,
SelectAll
SelectAll,
MatchButton
},
computed: {
Expand Down
@@ -0,0 +1,37 @@
<template>
<v-btn
color="primary"
medium
:disabled="!urlParams"
@click="openTask"
>
Send this filter to Match collection object
</v-btn>
</template>
<script setup>
import VBtn from 'components/ui/VBtn/index.vue'
import { computed } from 'vue'
import { RouteNames } from 'routes/routes'
const props = defineProps({
url: {
type: String,
required: true
},
ids: {
type: Array,
default: () => []
}
})
const urlParams = computed(() =>
props.ids.length
? props.ids.map(id => `collection_object_ids[]=${id}`).join('&')
: props.url.split('?')[1]
)
const openTask = () => {
window.open(RouteNames.MatchCollectionObject + '?' + urlParams.value)
}
</script>
34 changes: 30 additions & 4 deletions app/javascript/vue/tasks/collection_objects/match/app.vue
Expand Up @@ -18,12 +18,16 @@
Match
</button>
<ul class="no_bullets context-menu">
<li v-for="option in searchParams">
<li
v-for="option in searchParams"
:key="option.value"
>
<label>
<input
v-model="paramSelected"
:value="option.value"
type="radio">
type="radio"
>
{{ option.label }}
</label>
</li>
Expand Down Expand Up @@ -88,8 +92,17 @@ export default {
const coIds = urlParams.collection_object_ids || []
const identifierIds = urlParams.identifier_ids || []
this.GetMatchesById(coIds)
this.GetMatchesByIdentifier(identifierIds)
if (Object.keys(urlParams).length) {
if (
identifierIds.length ||
coIds.length
) {
this.GetMatchesById(coIds)
this.GetMatchesByIdentifier(identifierIds)
} else {
this.GetMatchByParams(urlParams)
}
}
},
methods: {
Expand All @@ -103,6 +116,8 @@ export default {
})
)
this.isLoading = true
Promise.allSettled(promises).then(() => {
if (arrayIds.length) {
this.GetMatchesById(arrayIds)
Expand All @@ -125,6 +140,8 @@ export default {
})
)
this.isLoading = true
Promise.allSettled(promises).then(() => {
if (arrayIdentifiers.length) {
this.GetMatchesByIdentifier(arrayIdentifiers)
Expand All @@ -134,6 +151,15 @@ export default {
})
},
GetMatchByParams (params) {
this.isLoading = true
CollectionObject.where(params).then(({ body }) => {
this.matches = Object.fromEntries(body.map(co => [co.id, [co]]))
this.isLoading = false
})
},
processList () {
this.matches = {}
this.isLoading = true
Expand Down

0 comments on commit 6c2754e

Please sign in to comment.