Skip to content

Commit

Permalink
- ADD: Added option to export multi-trait data in non-aggregated form…
Browse files Browse the repository at this point in the history
… to Germinate templates.
  • Loading branch information
sebastian-raubach committed Jan 23, 2023
1 parent 8832f56 commit 49057db
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/plugins/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
"formLabelExportFieldPlanTrait": "Merkmal",
"formLabelExportFieldPlan": "Feldplan",
"formLabelExportTraits": "Merkmalübersicht",
"formLabelExportGerminateAggregation": "Mehrfachmessungen zusammenrechnen?",
"formDescriptionExportGerminateAggregation": "Falls ausgewählt, werden Mehrfachmessungen zusammengerechnet um einen einzigen Wert pro Merkmal und Beet zu erstellen.",
"formLabelFieldLayoutRowCol": "Reihe {row}, Spalte {col}",
"formLabelGermplasm": "Keimplasma/Sorten",
"formLabelMarkersUse": "Markierungen auf Feldplan anzeigen",
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/i18n/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
"formLabelExportFieldPlanTrait": "Trait",
"formLabelExportFieldPlan": "Field plan",
"formLabelExportTraits": "Trait overview",
"formLabelExportGerminateAggregation": "Aggregate multi-traits?",
"formDescriptionExportGerminateAggregation": "If selected, multi-traits will be aggregated to generate a single value per trait for each plot.",
"formLabelFieldLayoutRowCol": "Row {row}, Column {col}",
"formLabelGermplasm": "Germplasm/varieties",
"formLabelMarkersUse": "Show markers on field plan",
Expand Down
56 changes: 33 additions & 23 deletions src/views/Export.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,38 @@
</template>
<p v-html="$t('modalTextExportGerminate')" />
<div>
<p v-if="hasMultiTrait">{{ $t('modalTextExportGerminateMultiSelection') }}</p>

<b-form @submit.prevent v-if="storeTraits && storeTraits.length > 0">
<template v-for="(trait, index) in storeTraits">
<b-form-group :label="trait.name"
:label-for="`trait-select-${trait.name}`"
:key="`trait-select-${trait.name}`"
:content-cols="12"
:label-cols="12"
:content-cols-lg="10"
:label-cols-lg="2"
class="align-items-center"
v-if="trait.mType === 'multi'">
<template #label>
<TraitHeading :trait="trait" mode="full" />
</template>
<b-form-radio-group
:id="`trait-select-${trait.name}`"
v-model="multiTraitSelection[index]"
:options="multiTraitOptions[index]" />
<div v-if="hasMultiTrait && storeTraits && storeTraits.length > 0">
<b-form @submit.prevent>

<b-form-group :label="$t('formLabelExportGerminateAggregation')" label-for="aggregation" :description="$t('formDescriptionExportGerminateAggregation')">
<b-form-checkbox id="aggregation" switch v-model="multiTraitAggregation">{{ $t(multiTraitAggregation ? 'buttonYes' : 'buttonNo') }}</b-form-checkbox>
</b-form-group>
</template>
</b-form>

<div v-if="multiTraitAggregation">
<p>{{ $t('modalTextExportGerminateMultiSelection') }}</p>

<template v-for="(trait, index) in storeTraits">
<b-form-group :label="trait.name"
:label-for="`trait-select-${trait.name}`"
:key="`trait-select-${trait.name}`"
:content-cols="12"
:label-cols="12"
:content-cols-lg="10"
:label-cols-lg="2"
class="align-items-center"
v-if="trait.mType === 'multi'">
<template #label>
<TraitHeading :trait="trait" mode="full" />
</template>
<b-form-radio-group
:id="`trait-select-${trait.name}`"
v-model="multiTraitSelection[index]"
:options="multiTraitOptions[index]" />
</b-form-group>
</template>
</div>
</b-form>
</div>

<b-button @click="exportToGerminateFormat"><BIconFileEarmarkSpreadsheet /> {{ $t('buttonExportGerminateFormat') }}</b-button>

Expand Down Expand Up @@ -157,6 +166,7 @@ export default {
return {
selectedTrait: null,
germinateTemplateFile: null,
multiTraitAggregation: false,
shapeFile: null,
multiTraitOptions: [],
multiTraitSelection: []
Expand Down Expand Up @@ -487,7 +497,7 @@ export default {
this.synchronizeDataset(this.storeDatasetId)
.then(dataset => {
emitter.emit('set-loading', true)
return this.axios(`config/${dataset.uuid}/export-g8`, this.multiTraitSelection, 'post')
return this.axios(`config/${dataset.uuid}/export-g8`, this.multiTraitAggregation ? this.multiTraitSelection : [], 'post')
})
.then(result => {
emitter.emit('set-loading', true)
Expand Down

0 comments on commit 49057db

Please sign in to comment.