Skip to content

Commit

Permalink
Merge branch 'development' of github.com:SpeciesFileGroup/taxonworks …
Browse files Browse the repository at this point in the history
…into development
  • Loading branch information
mjy committed Mar 9, 2024
2 parents 8f3cafa + 8656ea2 commit 25cdbcd
Show file tree
Hide file tree
Showing 15 changed files with 174 additions and 152 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,32 @@ jobs:
echo "year_week=$(date -u +'%Y-%U')" >> $GITHUB_OUTPUT
- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1

- name: Set up Ruby Bundler gems cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('.ruby-version', '**/Gemfile', '**/Gemfile.lock', 'exe/install-imagemagick7.sh') }}

- name: Set up Node 18 LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Set up Node packages cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-node-18-${{ hashFiles('**/package-lock.json') }}

- name: Set up assets cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
tmp/cache/shakapacker
Expand All @@ -91,7 +91,7 @@ jobs:
${{ runner.os }}-assets-${{ steps.datetime.outputs.iso_date }}
- name: Set up VCR cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: spec/fixtures/vcr_cassettes
key: ${{ runner.os }}-vcr-rev2-${{ steps.datetime.outputs.year_week }}-${{ hashFiles('**/Gemfile.lock') }}-${{ matrix.worker }}
Expand All @@ -106,7 +106,7 @@ jobs:
run: sudo chown $(id -u) /usr/src

- name: Set up imagemagick cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
/usr/src/libheif-*
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deliver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
run: echo "year_week=$(date -u +'%Y-%U')" >> $GITHUB_OUTPUT

- name: Git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Docker images cache
id: docker_cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .github/.docker-cache
key: ${{ runner.os }}-docker-${{ steps.datetime.outputs.year_week }}-${{ hashFiles('**/package-lock.json', '**/Gemfile.lock') }}
Expand All @@ -56,7 +56,7 @@ jobs:

- name: Wait build workflow to complete successfully
if: ${{ github.event_name != 'pull_request' }}
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const suiteId = (
Expand Down Expand Up @@ -92,14 +92,14 @@ jobs:
- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get tag for docker image
id: docker_tag
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
result-encoding: string
script: |
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ This project <em>does not yet</em> adheres to [Semantic Versioning](https://semv
### Added

- Add taxon name autocomplete to Type specimen facet
- DwC Dashboard: Use the same DwC download of collection object filter task
- DwC-A Workbench: Add pagination for created imports

### Changed

- Filter images: Remove quick forms for Depictions [#3869]

### Fixed

- Browse OTUs: headers do not link to correct panel [#3868]
- DwC-A importer crashing on hybrid formula scientific names.
- Crash when georeferencing with zero meters of uncertainty.

[#3868]: https://github.com/SpeciesFileGroup/taxonworks/issues/3868
[#3869]: https://github.com/SpeciesFileGroup/taxonworks/issues/3869

## [0.39.0] - 2024-03-01

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/tasks/dwca_import/dwca_import_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class Tasks::DwcaImport::DwcaImportController < ApplicationController
include TaskControllerConfiguration

after_action -> { set_pagination_headers(:datasets) }, only: [:index], if: :json_request?

# GET
def index
respond_to do |format|
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/vue/tasks/collection_objects/filter/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ const extendDownload = computed(() => [
bind: {
params: parameters.value,
total: pagination.value?.total,
selectedIds: selectedIds.value
selectedIds: selectedIds.value,
nestParameter: 'collection_object_query'
}
}
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
</div>
</template>
<script setup>
import { computed, reactive, ref, onBeforeMount, watch } from 'vue'
import { computed, reactive, ref, watch } from 'vue'
import { RouteNames } from '@/routes/routes.js'
import { DwcOcurrence } from '@/routes/endpoints'
import ConfirmationModal from '@/components/ConfirmationModal.vue'
Expand Down Expand Up @@ -218,12 +218,20 @@ const props = defineProps({
selectedIds: {
type: Array,
default: () => []
},
nestParameter: {
type: String,
default: null
}
})
const emit = defineEmits(['create'])
const confirmationModalRef = ref()
const showModal = ref(false)
const isLoading = ref(false)
const predicatesLoaded = ref(false)
const collectingEvents = ref([])
const collectionObjects = ref([])
const includeParameters = ref({})
Expand Down Expand Up @@ -286,14 +294,20 @@ function download() {
? { collection_object_id: props.selectedIds }
: getFilterParams(props.params)
DwcOcurrence.generateDownload({
collection_object_query: {
...downloadParams
},
const payload = {
...includeParameters.value,
...predicateParams,
...selectedExtensionMethods
}).then((_) => {
}
if (props.nestParameter) {
Object.assign(payload, { [props.nestParameter]: downloadParams })
} else {
Object.assign(payload, downloadParams)
}
DwcOcurrence.generateDownload(payload).then(({ body }) => {
emit('create', body)
openGenerateDownloadModal()
})
}
Expand All @@ -317,27 +331,29 @@ async function openGenerateDownloadModal() {
setModalView(false)
}
onBeforeMount(async () => {
isLoading.value = true
const [predicates, extensions] = await Promise.all([
DwcOcurrence.predicates(),
DwcOcurrence.taxonworksExtensionMethods()
])
isLoading.value = false
collectingEvents.value = predicates.body.collecting_event
collectionObjects.value = predicates.body.collection_object
extensionMethodNames.value = extensions.body
})
watch(showModal, (newVal) => {
watch(showModal, async (newVal) => {
if (newVal) {
predicateParams.collection_object_predicate_id = []
predicateParams.collecting_event_predicate_id = []
selectedExtensionMethods.taxonworks_extension_methods = []
if (!predicatesLoaded.value && !isLoading.value) {
try {
isLoading.value = true
const [predicates, extensions] = await Promise.all([
DwcOcurrence.predicates(),
DwcOcurrence.taxonworksExtensionMethods()
])
collectingEvents.value = predicates.body.collecting_event
collectionObjects.value = predicates.body.collection_object
extensionMethodNames.value = extensions.body
predicatesLoaded.value = true
} catch (e) {}
isLoading.value = false
}
}
})
</script>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,55 @@
<h2>Download Darwin Core Archive</h2>
<i>Includes only records stored as DwC occurrences.</i>
<div class="field label-above margin-medium-top">
<v-btn
color="create"
medium
:disabled="!downloadCount"
@click="download({ per: downloadCount })"
<DwcDownload
:params="{ per: downloadCount }"
v-slot="{ action }"
@create="actions.addDownloadRecord"
>
All ({{ downloadCount }})
</v-btn>
<VBtn
class="capitalize"
color="create"
:total="downloadCount"
medium
:disabled="!downloadCount"
@click="action"
>
All ({{ downloadCount }})
</VBtn>
</DwcDownload>
</div>
<div class="field label-above">
<label>Past</label>
<download-date-button
v-for="(days, label) in DATE_BUTTONS"
class="margin-small-right capitalize"
:key="label"
:label="label"
:days="days"
:count="getTotal(label)"
@onDate="download"
>
{{ label }}
</download-date-button>
<div class="horizontal-left-content gap-small">
<DwcDownload
v-for="(days, key) in DATE_BUTTONS"
:key="key"
:params="makeParameters(days)"
v-slot="{ action }"
@create="actions.addDownloadRecord"
>
<VBtn
class="capitalize"
color="create"
medium
:disabled="!getTotal(key)"
@click="action"
>
{{ key }} ({{ getTotal(key) }})
</VBtn>
</DwcDownload>
</div>
</div>
<filter-link>
Create DwC Archive by filtered collection object result
</filter-link>
</div>
</template>
<script setup>
import { DwcOcurrence } from '@/routes/endpoints'
import { getPastDateByDays } from '@/helpers/dates.js'
import { inject, computed } from 'vue'
import DownloadDateButton from './DownloadDateButton.vue'
import VBtn from '@/components/ui/VBtn/index.vue'
import DwcDownload from '@/tasks/collection_objects/filter/components/dwcDownload.vue'
import FilterLink from '../FilterLink.vue'
const DATE_BUTTONS = {
Expand All @@ -45,20 +61,19 @@ const DATE_BUTTONS = {
year: 365
}
const useAction = inject('actions')
const useState = inject('state')
const downloadCount = computed(() => useState?.metadata?.index?.record_total)
const actions = inject('actions')
const state = inject('state')
const downloadCount = computed(() => state?.metadata?.index?.record_total)
const getTotal = (date) => useState?.metadata?.index.freshness[`one_${date}`]
function getTotal(date) {
return state?.metadata?.index.freshness[`one_${date}`]
}
const download = async (downloadParams) => {
useAction.addDownloadRecord(
(
await DwcOcurrence.generateDownload({
...downloadParams,
dwc_indexed: true
})
).body
)
function makeParameters(days) {
return {
user_date_start: getPastDateByDays(Number(days)),
user_date_end: getPastDateByDays(0),
dwc_indexed: true
}
}
</script>
Loading

0 comments on commit 25cdbcd

Please sign in to comment.