diff --git a/app/controllers/tasks/field_occurrences/browse_controller.rb b/app/controllers/tasks/field_occurrences/browse_controller.rb new file mode 100644 index 0000000000..b910e4c906 --- /dev/null +++ b/app/controllers/tasks/field_occurrences/browse_controller.rb @@ -0,0 +1,4 @@ +class Tasks::FieldOccurrences::BrowseController < ApplicationController + include TaskControllerConfiguration + +end \ No newline at end of file diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 7bd8e3c1fb..23d3b98d54 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -105,7 +105,7 @@ import '../vue/tasks/biological_associations/network/main.js' import '../vue/tasks/collecting_events/stepwise/collectors/main.js' import '../vue/tasks/leads/new_lead/main.js' import '../vue/tasks/leads/show/main.js' -import '../vue/tasks/field_occurrences/new_field_occurrences/main.js' +import '../vue/tasks/field_occurrences/new/main.js' import '../vue/tasks/metadata/vocabulary/project_vocabulary/main.js' import '../vue/tasks/otus/new_otu/main.js' import '../vue/tasks/leads/hub/main.js' @@ -117,4 +117,5 @@ import '../vue/tasks/unify/objects/main.js' import '../vue/tasks/images/new_filename_depicting_image/main.js' import '../vue/tasks/biological_associations/new/main.js' import '../vue/tasks/otus/duplicates/main.js' -import '../vue/tasks/data_attributes/multi_update/main.js' \ No newline at end of file +import '../vue/tasks/field_occurrences/browse/main.js' +import '../vue/tasks/data_attributes/multi_update/main.js' diff --git a/app/javascript/vue/components/radials/object/components/collecting_event/main.vue b/app/javascript/vue/components/radials/object/components/collecting_event/main.vue index 23721669de..d78f330693 100644 --- a/app/javascript/vue/components/radials/object/components/collecting_event/main.vue +++ b/app/javascript/vue/components/radials/object/components/collecting_event/main.vue @@ -71,12 +71,14 @@ import { LABEL_CODE_128, IDENTIFIER_LOCAL_CATALOG_NUMBER, COLLECTION_OBJECT, - COLLECTING_EVENT + COLLECTING_EVENT, + FIELD_OCCURRENCE } from '@/constants/index.js' import { Label, Identifier, CollectionObject, + FieldOccurrence, CollectingEvent } from '@/routes/endpoints' import { onBeforeMount, ref, watch } from 'vue' @@ -87,6 +89,17 @@ const LABEL_TYPES = { [LABEL_CODE_128]: QRCodeComponent } +const TYPES = { + [FIELD_OCCURRENCE]: { + service: FieldOccurrence, + property: 'field_occurrence' + }, + [COLLECTION_OBJECT]: { + service: CollectionObject, + property: 'collection_object' + } +} + const props = defineProps({ objectId: { type: Number, @@ -123,12 +136,12 @@ watch(collectingEvent, (newVal) => { }) onBeforeMount(async () => { - const ceId = (await CollectionObject.find(props.objectId)).body - .collecting_event_id + const ceId = (await TYPES[props.objectType].service.find(props.objectId)).body + ?.collecting_event_id Identifier.where({ identifier_object_id: props.objectId, - identifier_object_type: COLLECTION_OBJECT, + identifier_object_type: props.objectType, type: IDENTIFIER_LOCAL_CATALOG_NUMBER }).then(({ body }) => { identifier.value = body[0] @@ -180,10 +193,12 @@ function removeLabel(label) { } function addCollectingEvent(ce) { - CollectionObject.update(props.objectId, { - collection_object: { collecting_event_id: ce.id || null } - }).then((_) => { - collectingEvent.value = ce.id ? ce : undefined - }) + TYPES[props.objectType].service + .update(props.objectId, { + [TYPES[props.objectType].property]: { collecting_event_id: ce.id || null } + }) + .then(() => { + collectingEvent.value = ce.id ? ce : undefined + }) } diff --git a/app/javascript/vue/routes/routes.js b/app/javascript/vue/routes/routes.js index 7774b4d02a..4f7862f241 100644 --- a/app/javascript/vue/routes/routes.js +++ b/app/javascript/vue/routes/routes.js @@ -19,6 +19,7 @@ const RouteNames = { BiologicalRelationshipComposer: '/tasks/biological_relationships/composer', BrowseAssertedDistribution: '/tasks/otus/browse_asserted_distributions', BrowseCollectionObject: '/tasks/collection_objects/browse', + BrowseFieldOccurrence: '/tasks/field_occurrences/browse', BrowseNomenclature: '/tasks/nomenclature/browse', BrowseOtu: '/tasks/otus/browse', ContentEditorTask: '/tasks/content/editor/index', @@ -57,6 +58,7 @@ const RouteNames = { NewCombination: '/tasks/nomenclature/new_combination', NewDescriptor: '/tasks/descriptors/new_descriptor', NewExtract: '/tasks/extracts/new_extract', + NewFieldOccurrence: '/tasks/field_occurrences/new_field_occurrences', NewLead: '/tasks/leads/new_lead', NewNamespace: '/tasks/namespaces/new_namespace', NewObservationMatrix: '/tasks/observation_matrices/new_matrix', diff --git a/app/javascript/vue/tasks/collection_objects/browse/components/Panel/PanelIdentifier.vue b/app/javascript/vue/tasks/collection_objects/browse/components/Panel/PanelIdentifier.vue index d03904ab43..8b812b8da7 100644 --- a/app/javascript/vue/tasks/collection_objects/browse/components/Panel/PanelIdentifier.vue +++ b/app/javascript/vue/tasks/collection_objects/browse/components/Panel/PanelIdentifier.vue @@ -1,9 +1,27 @@ @@ -12,7 +30,6 @@ import { useStore } from 'vuex' import { computed } from 'vue' import { GetterNames } from '../../store/getters/getters' import PanelContainer from './PanelContainer.vue' -import TableAttributes from '../Table/TableAttributes.vue' const store = useStore() const identifiers = computed(() => { @@ -20,7 +37,7 @@ const identifiers = computed(() => { const newlist = {} for (const key in list) { - list[key].forEach(identifier => { + list[key].forEach((identifier) => { newlist[identifier.objectTag] = key }) } @@ -28,3 +45,25 @@ const identifiers = computed(() => { return newlist }) + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/app.vue b/app/javascript/vue/tasks/field_occurrences/browse/app.vue new file mode 100644 index 0000000000..e591555a10 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/app.vue @@ -0,0 +1,134 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/ColumnThree.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/ColumnThree.vue new file mode 100644 index 0000000000..869eb137b1 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/ColumnThree.vue @@ -0,0 +1,22 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/FOHeader.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/FOHeader.vue new file mode 100644 index 0000000000..289ca78983 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/FOHeader.vue @@ -0,0 +1,112 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiocurations.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiocurations.vue new file mode 100644 index 0000000000..a53e800566 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiocurations.vue @@ -0,0 +1,20 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiologicalAssociations.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiologicalAssociations.vue new file mode 100644 index 0000000000..d975a4fd39 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelBiologicalAssociations.vue @@ -0,0 +1,18 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelContainer.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelContainer.vue new file mode 100644 index 0000000000..f8a6a3f31a --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelContainer.vue @@ -0,0 +1,15 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDepictions.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDepictions.vue new file mode 100644 index 0000000000..a3dbd071bc --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDepictions.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDeterminations.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDeterminations.vue new file mode 100644 index 0000000000..580c5a6923 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelDeterminations.vue @@ -0,0 +1,27 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFO.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFO.vue new file mode 100644 index 0000000000..b0f3032ecc --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFO.vue @@ -0,0 +1,27 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFieldOccurrence.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFieldOccurrence.vue new file mode 100644 index 0000000000..b399425090 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelFieldOccurrence.vue @@ -0,0 +1,23 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelIdentifier.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelIdentifier.vue new file mode 100644 index 0000000000..190bc943cb --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelIdentifier.vue @@ -0,0 +1,23 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelMap.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelMap.vue new file mode 100644 index 0000000000..961178107b --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Panel/PanelMap.vue @@ -0,0 +1,24 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCE.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCE.vue new file mode 100644 index 0000000000..59d728ed08 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCE.vue @@ -0,0 +1,29 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCEAttributes.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCEAttributes.vue new file mode 100644 index 0000000000..762899c4f1 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/PanelCE/PanelCEAttributes.vue @@ -0,0 +1,34 @@ + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableAttributes.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableAttributes.vue new file mode 100644 index 0000000000..f7f81f0db8 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableAttributes.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableData.vue b/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableData.vue new file mode 100644 index 0000000000..954bd431f0 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/components/Table/TableData.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/app/javascript/vue/tasks/field_occurrences/browse/constants/collectingEvents.js b/app/javascript/vue/tasks/field_occurrences/browse/constants/collectingEvents.js new file mode 100644 index 0000000000..47bd6afa5c --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/constants/collectingEvents.js @@ -0,0 +1,26 @@ +export const PRIORITIZE_ATTRIBUTES = [ + 'id', + 'verbatim_label', + 'verbatim_collectors', + 'verbatim_method', + 'verbatim_habitat', + 'verbatim_locality', + 'verbatim_latitude', + 'verbatim_longitude', + 'verbatim_date' +] +export const HIDE_ATTRIBUTES = [ + 'global_id', + 'geographic_area_id', + 'identifiers', + 'url_for', + 'project_id', + 'object_url', + 'object_label', + 'object_tag', + 'cached', + 'created_by_id', + 'updated_by_id', + 'base_class', + 'md5_of_verbatim_label' +] diff --git a/app/javascript/vue/tasks/field_occurrences/browse/main.js b/app/javascript/vue/tasks/field_occurrences/browse/main.js new file mode 100644 index 0000000000..82bfb95636 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/main.js @@ -0,0 +1,18 @@ +import { createApp } from 'vue' +import { createPinia } from 'pinia' +import App from './app.vue' + +function initApp(element) { + const app = createApp(App) + + app.use(createPinia()) + app.mount(element) +} + +document.addEventListener('turbolinks:load', () => { + const el = document.querySelector('#field-occurrences-browse-task') + + if (el) { + initApp(el) + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/biocurations.js b/app/javascript/vue/tasks/field_occurrences/browse/store/biocurations.js new file mode 100644 index 0000000000..5c78eecd5d --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/biocurations.js @@ -0,0 +1,61 @@ +import { + BiocurationClassification, + ControlledVocabularyTerm, + Tag +} from '@/routes/endpoints' +import { BIOCURATION_GROUP } from '@/constants/index.js' +import { defineStore } from 'pinia' + +async function makeGroup(groups, biocurations) { + const newGroups = {} + + for (const groupId in groups) { + await Tag.where({ keyword_id: groupId }).then(({ body }) => { + body.forEach((item) => { + biocurations.forEach((klass) => { + if (klass.biocuration_class_id === item.tag_object_id) { + if (groupId in newGroups) { + newGroups[groupId].items.push(klass) + } else { + newGroups[groupId] = { + groupName: groups[groupId].name, + items: [klass] + } + } + } + }) + }) + }) + } + + return newGroups +} + +export default defineStore('biocurations', { + state: () => ({ + biocurations: [] + }), + + actions: { + async load({ objectId, objectType }) { + const { body: biocurationGroups } = await ControlledVocabularyTerm.where({ + type: [BIOCURATION_GROUP] + }) + const { body: biocurations } = await BiocurationClassification.where({ + biocuration_classification_object_id: objectId, + biocuration_classification_object_type: objectType + }) + const groups = Object.assign( + {}, + ...biocurationGroups.map((item) => ({ + [item.id]: { + name: item.name, + items: [] + } + })) + ) + + this.biocurations = await makeGroup(groups, biocurations) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/biologicalAssociations.js b/app/javascript/vue/tasks/field_occurrences/browse/store/biologicalAssociations.js new file mode 100644 index 0000000000..06d27a4f0a --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/biologicalAssociations.js @@ -0,0 +1,21 @@ +import { BiologicalAssociation } from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('biologicalAssociations', { + state: () => ({ + biologicalAssociations: [] + }), + + actions: { + async load({ objectId, objectType }) { + return BiologicalAssociation.where({ + biological_association_subject_id: [objectId], + biological_association_subject_type: [objectType] + }) + .then(({ body }) => { + this.biologicalAssociations = body + }) + .catch(() => {}) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/collectingEvent.js b/app/javascript/vue/tasks/field_occurrences/browse/store/collectingEvent.js new file mode 100644 index 0000000000..f0eedbfdd7 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/collectingEvent.js @@ -0,0 +1,38 @@ +import { + CollectingEvent, + GeographicArea, + Georeference +} from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('collectingEvent', { + state: () => ({ + collectingEvent: null, + geographicArea: null, + georeferences: [] + }), + + actions: { + async load(collectingEventId) { + try { + CollectingEvent.find(collectingEventId).then(({ body }) => { + this.collectingEvent = body + + if (body.geographic_area_id) { + GeographicArea.find(body.geographic_area_id, { + embed: ['shape'] + }).then(({ body }) => { + this.geographicArea = body + }) + } + }) + + Georeference.where({ collecting_event_id: collectingEventId }).then( + ({ body }) => { + this.georeferences = body + } + ) + } catch {} + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/depictions.js b/app/javascript/vue/tasks/field_occurrences/browse/store/depictions.js new file mode 100644 index 0000000000..eb0014b7f7 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/depictions.js @@ -0,0 +1,22 @@ +import { Depiction } from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('depictions', { + state: () => ({ + depictions: [] + }), + + actions: { + async load({ objectId, objectType }) { + return Depiction.where({ + depiction_object_id: objectId, + depiction_object_type: objectType, + per: 100 + }) + .then(({ body }) => { + this.depictions = body + }) + .catch(() => {}) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/determinations.js b/app/javascript/vue/tasks/field_occurrences/browse/store/determinations.js new file mode 100644 index 0000000000..f2451de61c --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/determinations.js @@ -0,0 +1,21 @@ +import { TaxonDetermination } from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('determinations', { + state: () => ({ + determinations: [] + }), + + actions: { + async load({ objectId, objectType }) { + return TaxonDetermination.where({ + taxon_determination_object_id: [objectId], + taxon_determination_object_type: [objectType] + }) + .then(({ body }) => { + this.determinations = body + }) + .catch(() => {}) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/identifiers.js b/app/javascript/vue/tasks/field_occurrences/browse/store/identifiers.js new file mode 100644 index 0000000000..509386d237 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/identifiers.js @@ -0,0 +1,21 @@ +import { Identifier } from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('identifiers', { + state: () => ({ + identifiers: [] + }), + + actions: { + async load({ objectId, objectType }) { + return Identifier.where({ + identifier_object_id: [objectId], + identifier_object_type: [objectType] + }) + .then(({ body }) => { + this.identifiers.push(...body) + }) + .catch(() => {}) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/browse/store/store.js b/app/javascript/vue/tasks/field_occurrences/browse/store/store.js new file mode 100644 index 0000000000..51cff25754 --- /dev/null +++ b/app/javascript/vue/tasks/field_occurrences/browse/store/store.js @@ -0,0 +1,18 @@ +import { FieldOccurrence } from '@/routes/endpoints' +import { defineStore } from 'pinia' + +export default defineStore('browseFieldOccurrence', { + state: () => ({ + fieldOccurrence: null + }), + + actions: { + async load(fieldOccurrenceId) { + return FieldOccurrence.find(fieldOccurrenceId) + .then(({ body }) => { + this.fieldOccurrence = body + }) + .catch(() => {}) + } + } +}) diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/App.vue b/app/javascript/vue/tasks/field_occurrences/new/App.vue similarity index 91% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/App.vue rename to app/javascript/vue/tasks/field_occurrences/new/App.vue index 73499c7211..841c52f83e 100644 --- a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/App.vue +++ b/app/javascript/vue/tasks/field_occurrences/new/App.vue @@ -10,7 +10,6 @@ - @@ -23,7 +22,6 @@ import TaxonDeterminationForm from './components/TaxonDeterminationForm.vue' import FieldOccurrenceForm from './components/FieldOccurenceForm/FieldOccurrenceForm.vue' import HeaderBar from './components/HeaderBar.vue' import CollectingEventForm from './components/CollectingEventForm.vue' -import IdentifierForm from './components/FieldOccurenceForm/Identifier/IdentifierForm.vue' import CitationForm from './components/CitationForm.vue' import BiocurationForm from './components/BiocurationForm.vue' import BiologicalAssociation from './components/BiologicalAssociation.vue' diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiocurationForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiocurationForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiocurationForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiocurationForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation.vue similarity index 98% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation.vue index e7423958ac..bd2e63c1a0 100644 --- a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation.vue +++ b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation.vue @@ -27,7 +27,7 @@ import { useTemplateRef } from 'vue' import useSettingStore from '../store/settings.js' import BlockLayout from '@/components/layout/BlockLayout.vue' import BiologicalAssociationForm from './BiologicalAssociation/BiologicalAssociation.vue' -import useBiologicalAssociationStore from '../store/biologicalAssociations' +import useBiologicalAssociationStore from '../store/biologicalAssociations.js' import BiologicalAssociationList from './BiologicalAssociation/BiologicalAssociationList.vue' const settings = useSettingStore() diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociation.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociation.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociation.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociation.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationList.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationList.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationList.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationList.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationObject.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationObject.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationObject.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationObject.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationRelated.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationRelated.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationRelated.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationRelated.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationRelationship.vue b/app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationRelationship.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/BiologicalAssociation/BiologicalAssociationRelationship.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/BiologicalAssociation/BiologicalAssociationRelationship.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/CitationForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/CitationForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/CitationForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/CitationForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/CollectingEventForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/CollectingEventForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/CollectingEventForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/CollectingEventForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/Depiction/Depiction.vue b/app/javascript/vue/tasks/field_occurrences/new/components/Depiction/Depiction.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/Depiction/Depiction.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/Depiction/Depiction.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldIsAbsent.vue b/app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldIsAbsent.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldIsAbsent.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldIsAbsent.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldOccurrenceForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldOccurrenceForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldOccurrenceForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldOccurrenceForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldTotal.vue b/app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldTotal.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/FieldTotal.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/FieldTotal.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/Identifier/IdentifierForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/Identifier/IdentifierForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/Identifier/IdentifierForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/Identifier/IdentifierForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/Identifier/NamespaceForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/Identifier/NamespaceForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/FieldOccurenceForm/Identifier/NamespaceForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/FieldOccurenceForm/Identifier/NamespaceForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/HeaderBar.vue b/app/javascript/vue/tasks/field_occurrences/new/components/HeaderBar.vue similarity index 95% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/HeaderBar.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/HeaderBar.vue index 1fe7930023..1b44e02e83 100644 --- a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/HeaderBar.vue +++ b/app/javascript/vue/tasks/field_occurrences/new/components/HeaderBar.vue @@ -148,14 +148,20 @@ async function save() { biologicalAssociationStore.save(args) ] - return Promise.all(requests).then(() => { - settings.isSaving = false - TW.workbench.alert.create( - 'Field occurrence was successfully saved.', - 'notice' - ) - }) - } catch {} + return Promise.all(requests) + .then(() => { + TW.workbench.alert.create( + 'Field occurrence was successfully saved.', + 'notice' + ) + }) + .catch(() => {}) + .finally(() => { + settings.isSaving = false + }) + } catch { + settings.isSaving = false + } } function reset() { diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/Recent.vue b/app/javascript/vue/tasks/field_occurrences/new/components/Recent.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/Recent.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/Recent.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/TaxonDeterminationForm.vue b/app/javascript/vue/tasks/field_occurrences/new/components/TaxonDeterminationForm.vue similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/components/TaxonDeterminationForm.vue rename to app/javascript/vue/tasks/field_occurrences/new/components/TaxonDeterminationForm.vue diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/main.js b/app/javascript/vue/tasks/field_occurrences/new/main.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/main.js rename to app/javascript/vue/tasks/field_occurrences/new/main.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/biocurations.js b/app/javascript/vue/tasks/field_occurrences/new/store/biocurations.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/biocurations.js rename to app/javascript/vue/tasks/field_occurrences/new/store/biocurations.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/biologicalAssociations.js b/app/javascript/vue/tasks/field_occurrences/new/store/biologicalAssociations.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/biologicalAssociations.js rename to app/javascript/vue/tasks/field_occurrences/new/store/biologicalAssociations.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/citations.js b/app/javascript/vue/tasks/field_occurrences/new/store/citations.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/citations.js rename to app/javascript/vue/tasks/field_occurrences/new/store/citations.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/depictions.js b/app/javascript/vue/tasks/field_occurrences/new/store/depictions.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/depictions.js rename to app/javascript/vue/tasks/field_occurrences/new/store/depictions.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/determinations.js b/app/javascript/vue/tasks/field_occurrences/new/store/determinations.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/determinations.js rename to app/javascript/vue/tasks/field_occurrences/new/store/determinations.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/fieldOccurrence.js b/app/javascript/vue/tasks/field_occurrences/new/store/fieldOccurrence.js similarity index 85% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/fieldOccurrence.js rename to app/javascript/vue/tasks/field_occurrences/new/store/fieldOccurrence.js index 64cb9506e5..e00598e5e7 100644 --- a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/fieldOccurrence.js +++ b/app/javascript/vue/tasks/field_occurrences/new/store/fieldOccurrence.js @@ -1,7 +1,7 @@ import { defineStore } from 'pinia' import { makeFieldOccurrence } from '@/factory' import { FieldOccurrence } from '@/routes/endpoints' -import useDeterminationStore from '../store/determinations.js' +import useDeterminationStore from './determinations.js' export default defineStore('fieldOccurrences', { state: () => ({ @@ -36,9 +36,11 @@ export default defineStore('fieldOccurrences', { ? FieldOccurrence.update(this.fieldOccurrence.id, payload) : FieldOccurrence.create(payload) - request.then(({ body }) => { - this.fieldOccurrence = body - }) + request + .then(({ body }) => { + this.fieldOccurrence = body + }) + .catch(() => {}) return request } diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/identifier.js b/app/javascript/vue/tasks/field_occurrences/new/store/identifier.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/identifier.js rename to app/javascript/vue/tasks/field_occurrences/new/store/identifier.js diff --git a/app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/settings.js b/app/javascript/vue/tasks/field_occurrences/new/store/settings.js similarity index 100% rename from app/javascript/vue/tasks/field_occurrences/new_field_occurrences/store/settings.js rename to app/javascript/vue/tasks/field_occurrences/new/store/settings.js diff --git a/app/models/field_occurrence.rb b/app/models/field_occurrence.rb index bd2edf315b..c3943b5393 100644 --- a/app/models/field_occurrence.rb +++ b/app/models/field_occurrence.rb @@ -43,6 +43,8 @@ class FieldOccurrence < ApplicationRecord include Shared::BiologicalExtensions include Shared::IsDwcOccurrence + GRAPH_ENTRY_POINTS = [:biological_associations, :taxon_determinations, :biocuration_classifications, :collecting_event] + is_origin_for 'Specimen', 'Lot', 'Extract', 'AssertedDistribution', 'Sequence' belongs_to :collecting_event, inverse_of: :field_occurrences diff --git a/app/views/tasks/field_occurrences/browse/index.html.erb b/app/views/tasks/field_occurrences/browse/index.html.erb new file mode 100644 index 0000000000..ff04a87f8d --- /dev/null +++ b/app/views/tasks/field_occurrences/browse/index.html.erb @@ -0,0 +1 @@ +
diff --git a/config/interface/hub/user_tasks.yml b/config/interface/hub/user_tasks.yml index b6c445f3ae..71700be552 100644 --- a/config/interface/hub/user_tasks.yml +++ b/config/interface/hub/user_tasks.yml @@ -1006,6 +1006,13 @@ summarize_projects_controlled_vocabulary_terms_task: categories: status: prototype description: 'Visualize controlled vocabulary terms across the projects you are a member of.' +browse_field_occurrence_task: + hub: true + name: 'Browse field occurrences' + related: + categories: + status: prototype + description: 'TODO: Task description' index_multi_update_task: hub: false name: 'Multi-update data attributes' diff --git a/config/interface/object_radials.yml b/config/interface/object_radials.yml index 6af4f25ed5..5b18e41bf1 100644 --- a/config/interface/object_radials.yml +++ b/config/interface/object_radials.yml @@ -105,6 +105,7 @@ Extract: recent: true FieldOccurrence: tasks: + - browse_field_occurrence_task - new_field_occurrence_task - unify_objects_task edit: new_field_occurrence_task diff --git a/config/routes/tasks.rb b/config/routes/tasks.rb index b5d807cd88..263dca37c8 100644 --- a/config/routes/tasks.rb +++ b/config/routes/tasks.rb @@ -111,6 +111,10 @@ end scope :field_occurrences do + scope :browse, controller: 'tasks/field_occurrences/browse' do + get '/', as: 'browse_field_occurrence_task', action: :index + end + scope :new_field_occurrences, controller: 'tasks/field_occurrences/new_field_occurrences' do get '/', as: 'new_field_occurrence_task', action: :index end