Skip to content

Commit

Permalink
- FIX: Fixed issues with adding comments and the box not clearing.
Browse files Browse the repository at this point in the history
- ADD: Added the option to reorder the home page widgets.
- ADD: Added option to not average values across sets and the same day when exporting to Germinate Excel templates.
  • Loading branch information
sebastian-raubach committed Sep 22, 2023
1 parent b01f650 commit 9d06c86
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 55 deletions.
57 changes: 57 additions & 0 deletions src/components/HomeBanners.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<b-row>
<b-col cols=6 md=3 class="mb-4" v-for="banner in homeBanners" :key="`home-banner-${banner.id}`">
<b-card class="home-card h-100" no-body>
<b-card-img class="p-2 p-md-4 p-lg-5" :top="true" :src="require(`@/assets/img/${banner.image}`)" />
<b-card-body>
<b-card-title>{{ banner.title }}</b-card-title>
<b-card-sub-title>{{ banner.subtitle }}</b-card-sub-title>
</b-card-body>
<b-button variant="primary" class="stretched-link" :to="banner.to"><BIconCaretRight /> {{ $t('buttonSelect') }}</b-button>
</b-card>
</b-col>
</b-row>
</template>

<script>
import { BIconCaretRight } from 'bootstrap-vue'
export default {
components: {
BIconCaretRight
},
computed: {
homeBanners: function () {
return [{
id: 'setup',
title: this.$t('pageHomeCardTitleSetup'),
subtitle: this.$t('pageHomeCardSubtitleSetup'),
image: 'banner-setup.svg',
to: { name: 'trial-setup' }
}, {
id: 'share',
title: this.$t('pageHomeCardTitleShareData'),
subtitle: this.$t('pageHomeCardSubtitleShareData'),
image: 'banner-share.svg',
to: { name: 'trial-import' }
}, {
id: 'example',
title: this.$t('pageHomeCardTitleLoadExample'),
subtitle: this.$t('pageHomeCardSubtitleLoadExample'),
image: 'banner-load-example.svg',
to: { name: 'load-example' }
}, {
id: 'settings',
title: this.$t('pageHomeCardTitleSettings'),
subtitle: this.$t('pageHomeCardSubtitleSettings'),
image: 'banner-settings.svg',
to: { name: 'settings' }
}]
}
}
}
</script>

<style>
</style>
3 changes: 3 additions & 0 deletions src/components/SpeechRecognitionTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export default {
}
},
methods: {
reset: function () {
this.value = null
},
focus: function () {
this.$refs.textarea.focus()
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/TraitDefinitionComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
</div>
<p>{{ $t('pageTrialTraitListText') }}</p>
<draggable v-model="traits" tag="b-list-group" v-if="traits && traits.length > 0" handle=".drag-handle" class="trait-list">
<b-list-group-item :active="newTrait.id === trait.id" href="#" @click="toggleTrait(index)" class="flex-column align-items-start" v-for="(trait, index) in traits" :key="`trait-list-${trait.id}`">
<b-list-group-item :active="newTrait.id === trait.id" href="#" @click.prevent="toggleTrait(index)" class="flex-column align-items-start" v-for="(trait, index) in traits" :key="`trait-list-${trait.id}`">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ trait.name }}</h5>
<span>
Expand Down
1 change: 1 addition & 0 deletions src/components/modals/PlotCommentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export default {
createComment: function () {
addPlotComment(this.cell.trialId, this.cell.row, this.cell.column, this.newCommentContent)
.then(() => {
this.$refs.input.reset()
this.newCommentContent = null
this.commentFormVisible = false
emitter.emit('plot-comments-changed', this.cell.row, this.cell.column, this.cell.trialId)
Expand Down
7 changes: 6 additions & 1 deletion src/components/modals/SettingsShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
'storeCanvasShape',
'storeCanvasSize',
'storeDisplayMinCellWidth',
'storeHomeWidgetOrder',
'storeGpsEnabled',
'storeVoiceFeedbackEnabled',
'storeRestrictInputToMarked',
Expand All @@ -88,6 +89,9 @@ export default {
this.$store.commit('ON_LOCALE_CHANGED', parsed.lc)
loadLanguageAsync(parsed.lc)
}
if (parsed.hw) {
this.$store.commit('ON_HOME_WIDGET_ORDER_CHANGED', parsed.hw)
}
if (parsed.dm === 1) {
this.$store.commit('ON_DARK_MODE_CHANGED', true)
} else if (parsed.dm === 0) {
Expand All @@ -99,7 +103,7 @@ export default {
this.$store.commit('ON_DISPLAY_MARKER_INDICATORS_CHANGED', false)
}
if (parsed.cw !== undefined && parsed.cw !== null) {
this.$store.commit('ON_DISPLAY_MIN_CELL_WIDTH_CHANGED', parsed.cw)
this.$store.commit('ON_DISPLAY_MIN_CELL_WIDTH_CHANGED', parsed.cw.split(','))
}
if (parsed.ge === 1) {
this.$store.commit('ON_GPS_ENABLED_CHANGED', true)
Expand Down Expand Up @@ -173,6 +177,7 @@ export default {
hc: this.storeHideCitationMessage ? 1 : 0,
dm: this.storeDarkMode ? 1 : 0,
mi: this.storeDisplayMarkerIndicators ? 1 : 0,
hw: this.storeHomeWidgetOrder.join(','),
cw: this.storeDisplayMinCellWidth,
ge: this.storeGpsEnabled ? 1 : 0,
vf: this.storeVoiceFeedbackEnabled ? 1 : 0,
Expand Down
1 change: 1 addition & 0 deletions src/components/modals/TrialCommentModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export default {
createComment: function () {
addTrialComment(this.trial.localId, this.newCommentContent)
.then(() => {
this.$refs.input.reset()
this.newCommentContent = null
this.commentFormVisible = false
emitter.emit('trial-properties-changed', this.trial.localId)
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ const synchronizeTrial = (shareCode, transactions) => {
return axiosCall({ url: `trial/${shareCode}/transaction`, params: transactions, method: 'post' })
}

const exportToGerminate = (shareCode) => {
return axiosCall({ url: `trial/${shareCode}/export/g8`, method: 'get' })
const exportToGerminate = (shareCode, aggregate = true) => {
return axiosCall({ url: `trial/${shareCode}/export/g8?aggregate=${aggregate}`, method: 'get' })
}

const exportToShapefile = (shareCode) => {
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/changelog/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@
"type": "new",
"title": "Versuchsmerkmalimport",
"text": "Beim Erstellen eines neuen Versuches können jetzt Merkmale aus einem anderen Versuch importiert werden der auf dem aktuellen Gerät verfügbar ist."
}, {
"type": "new",
"title": "Germinate Excel Export",
"text": "Beim Exportieren in die Germinate Excel Datenvorlagen kann jetzt das Mitteln über Wertsätze und den gleichen Tag deaktiviert werden."
}, {
"type": "new",
"title": "Homepage-Ordnung",
"text": "Es kann jetzt die Anordnung der Elemente auf der Homepage geändert werden."
}, {
"type": "update",
"title": "Gelenkter Ablaub Änderung",
Expand Down
8 changes: 8 additions & 0 deletions src/plugins/changelog/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@
"type": "new",
"title": "Trial trait import",
"text": "When setting up a new trial you can now import trials from another trial that's available on your current device."
}, {
"type": "new",
"title": "Germinate Excel export",
"text": "When exporting to the Germinate Excel data templates you can now disable averaging of values across sets and on the same day."
}, {
"type": "new",
"title": "Home page order",
"text": "You can now change the order of the home page widgets from the settings page."
}, {
"type": "update",
"title": "Guided walk change",
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/i18n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
"formDescriptionSettingsTraitColorAdd": "Eine neue Merkmalsfarbe der Liste hinzufügen.",
"formLabelSettingsRestrictInputToMarked": "Eingabe beschränken auf markierte Zeilen/Spalten",
"formDescriptionSettingsRestrictInputToMarked": "Falls aktiviert, ist die Auswahl von Beeten in der Dateneingabe nur in markierten Zeilen oder Spalten möglich.",
"formLabelSettingsWidgetOrder": "Home-Widget-Ordnung",
"formDescriptionSettingsWidgetOrder": "Nutze die Griff in der oberen rechten Ecke um die Widgets auf der Homepage anzuordnen.",
"formPlaceholderTimelinePlotSearch": "Keimplasma suchen",
"formLabelStatisticsTrait": "Merkmal",
"formDescriptionStatisticsTrait": "Die Merkmale für welche die Statistiken dargestellt werden sollen.",
Expand Down Expand Up @@ -234,6 +236,8 @@
"formLabelExportBrapiTrial": "Versuch",
"formLabelExportBrapiStudy": "Studie",
"formLabelExportBrapiStudyType": "Studientyp",
"formLabelExportTrialFormatGerminateAggregate": "Durchschnittswerte",
"formDescriptionExportTrialFormatGerminateAggregate": "Entscheide ob Werte über Sätze und am gleichen Tag gemittelt werden sollen.",
"formDescriptionBrapiUrl": "Die URL des BrAPI-Endpunktes. Normalerweise in der Form <code>{URL}/brapi/v2/</code>",
"formDescriptionBrapiToken": "Ein Token kann benötigt werden für Schreiboperationen oder Zugriffsbeschränkungen",
"formLabelImageTagTraitSelector": "Merkmale zum taggen auswählen (optional)",
Expand Down Expand Up @@ -411,6 +415,10 @@
"pageSettingsCardDataCollectionSubtitle": "Einstellungen in diesem Bereich beziehen sich auf Vorlieben bei der Datensammlung.",
"pageSettingsCardVisualTitle": "Visuelle Einstellungen",
"pageSettingsCardVisualSubtitle": "Hier können die visuellen Repräsentationen innerhalb von GridScore angepasst werden.",
"pageSettingsHomeWidgetOrderBannersName": "Banner",
"pageSettingsHomeWidgetOrderBannersDescription": "Die Einstiegsbanner inklusive des Erstellen eines neuen Versuches.",
"pageSettingsHomeWidgetOrderTrialsName": "Versuche",
"pageSettingsHomeWidgetOrderTrialsDescription": "Die Liste der Versuche die lokal auf diesem Gerät verfügbar sind.",
"pageSetupGermplasmGridSidebarTitle": "Versuchsaufbau-Spezifikation",
"pageSetupGermplasmGridTableCellRowColumn": "Zeile: {row}, Spalte: {column}",
"pageSetupTraitSidebarTitle": "Merkmalsdefinitionen",
Expand All @@ -422,7 +430,7 @@
"pageTrialSetupText": "Dies ist wo ein neuer Versuch erstellt werden kann. Die Abschnitte unten werden genutzt um generelle Informationen über den Versuch angzugeben, das Layout inklusive des genutzten Keimplasmas und der Spalten- und Reihenanzahl zu definieren, und schließlich die Merkmale die aufgezeichnet werden sollen anzugeben.",
"pageTrialLayoutDimensionsTitle": "Aufbaudimensionen",
"pageTrialLayoutDimensionsText": "Nutze die Eingabefelder unten um die Anzahl an Spalten und Zeilen im Versuchsaufbau anzugeben.",
"pageTrialLayoutDimensionsFielDHubNotice": "Falls ein Versuchsaufbau von FielDHub importiert wird, bitte 'Unten nach oben' auswählen bei der Zeilenordnung.",
"pageTrialLayoutDimensionsFielDHubNotice": "Falls ein Versuchsaufbau von FielDHub importiert wird, bitte 'Unten nach oben' auswählen bei der Zeilenordnung und 'Links nach rechts' für die Spaltenordnung.",
"pageTrialLayoutGermplasmTitle": "Keimplasma-/Rep-Informationen",
"pageTrialLayoutGermplasmText": "Nutze die Tabelle unten um Keimplasmaidentifikatore und optionale Rep-Informationen pro Beet anzugeben. Das Dropdown-Menü kann genutzt werden um Daten aus anderen Tools wie FielDHub oder Excel zu importieren.",
"pageTrialLayoutCornersTitle": "Geographische Versuchseckpunkte",
Expand Down
10 changes: 9 additions & 1 deletion src/plugins/i18n/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
"formDescriptionSettingsTraitColorAdd": "Add a new trait color to the existing list.",
"formLabelSettingsRestrictInputToMarked": "Restrict input to marked rows/columns",
"formDescriptionSettingsRestrictInputToMarked": "If enabled, selecting plots on the data entry view is only possible within the marked row/column.",
"formLabelSettingsWidgetOrder": "Home widget order",
"formDescriptionSettingsWidgetOrder": "Use the handle in the top right to drag and reorder the widgets on the home page.",
"formPlaceholderTimelinePlotSearch": "Search germplasm",
"formLabelStatisticsTrait": "Trait",
"formDescriptionStatisticsTrait": "The traits for which to plot the statistics.",
Expand Down Expand Up @@ -242,6 +244,8 @@
"formLabelExportBrapiTrial": "Trial",
"formLabelExportBrapiStudy": "Study",
"formLabelExportBrapiStudyType": "Study type",
"formLabelExportTrialFormatGerminateAggregate": "Average values",
"formDescriptionExportTrialFormatGerminateAggregate": "Decide whether values should be averaged across sets and measurements on the same day.",
"formDescriptionBrapiUrl": "The URL of the BrAPI endpoint. Usually of the form <code>{URL}/brapi/v2/</code>",
"formDescriptionBrapiToken": "A token may be required for write operations or access limitations",
"formLabelMeasurementSet": "Measurement for set position {position}",
Expand Down Expand Up @@ -419,6 +423,10 @@
"pageSettingsCardDataCollectionSubtitle": "Settings in this area relate to preferences while collecting data.",
"pageSettingsCardVisualTitle": "Visual settings",
"pageSettingsCardVisualSubtitle": "This is where the visual representation within GridScore can be adjusted.",
"pageSettingsHomeWidgetOrderBannersName": "Banners",
"pageSettingsHomeWidgetOrderBannersDescription": "The 'getting started' banners including setting up a new trial.",
"pageSettingsHomeWidgetOrderTrialsName": "Trials",
"pageSettingsHomeWidgetOrderTrialsDescription": "The list of trials available locally on this device.",
"pageSetupGermplasmGridSidebarTitle": "Trial layout specification",
"pageSetupGermplasmGridTableCellRowColumn": "Row: {row}, Column: {column}",
"pageSetupTraitSidebarTitle": "Trait definition",
Expand All @@ -430,7 +438,7 @@
"pageTrialSetupText": "This is where you create a new trial. The sections below are used to provide general information about the trial, specify the layout including used germplasm, row and column count, and finally the traits you want to score need to be specified.",
"pageTrialLayoutDimensionsTitle": "Layout dimensions",
"pageTrialLayoutDimensionsText": "Use the input fields to specify the row and column count of your trial layout.",
"pageTrialLayoutDimensionsFielDHubNotice": "If you're importing a trial design from FielDHub, please make sure to select 'bottom to top' for the row order.",
"pageTrialLayoutDimensionsFielDHubNotice": "If you're importing a trial design from FielDHub, please make sure to select 'bottom to top' for the row order and 'left to right' for the column order.",
"pageTrialLayoutGermplasmTitle": "Germplasm/rep information",
"pageTrialLayoutGermplasmText": "Use the table below to enter the germplasm identifier and optional rep information for each plot. You can use the dropdown menu above the table to import data from other tools like FielDHub or Excel.",
"pageTrialLayoutCornersTitle": "Geographic trial corner points",
Expand Down
12 changes: 12 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default new Vuex.Store({
restrictInputToMarked: false,
navigationMode: NAVIGATION_MODE_DRAG,
traitColors: ['#910080', '#ff7c00', '#5ec418', '#00a0f1', '#c5e000', '#ff007a', '#222183', '#c83831', '#fff600'],
homeWidgetOrder: ['banners', 'trials'],
canvasDensity: CANVAS_DENSITY_LOW,
canvasShape: CANVAS_SHAPE_CIRCLE,
canvasSize: CANVAS_SIZE_SMALL,
Expand Down Expand Up @@ -65,6 +66,7 @@ export default new Vuex.Store({
storeRestrictInputToMarked: (state) => state.restrictInputToMarked,
storeNavigationMode: (state) => state.navigationMode,
storeTraitColors: (state) => state.traitColors,
storeHomeWidgetOrder: (state) => state.homeWidgetOrder,
storeCanvasDensity: (state) => state.canvasDensity,
storeCanvasShape: (state) => state.canvasShape,
storeCanvasSize: (state) => state.canvasSize,
Expand Down Expand Up @@ -190,6 +192,13 @@ export default new Vuex.Store({
ON_TRAIT_COLORS_CHANGED: function (state, newTraitColors) {
state.traitColors = newTraitColors
},
ON_HOME_WIDGET_ORDER_CHANGED: function (state, newHomeWidgetOrder) {
if (Object.prototype.hasOwnProperty.call(state, 'homeWidgetOrder')) {
state.homeWidgetOrder = newHomeWidgetOrder
} else {
Vue.set(state, 'homeWidgetOrder', newHomeWidgetOrder)
}
},
ON_PLAUSIBLE_CHANGED: function (state, newPlausible) {
state.plausible = newPlausible
},
Expand Down Expand Up @@ -285,6 +294,9 @@ export default new Vuex.Store({
setTraitColors: function ({ commit }, traitColors) {
commit('ON_TRAIT_COLORS_CHANGED', traitColors)
},
setHomeWidgetOrder: function ({ commit }, homeWidgetOrder) {
commit('ON_HOME_WIDGET_ORDER_CHANGED', homeWidgetOrder)
},
setPlausible: function ({ commit }, plausible) {
commit('ON_PLAUSIBLE_CHANGED', plausible)
},
Expand Down
2 changes: 1 addition & 1 deletion src/views/AboutView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<h1 class="display-4 text-center text-md-left">{{ $t('appTitle') }}</h1>
<p class="lead text-center text-md-left"><BIconTag /> {{ $t('pageAboutVersion', { version: gridScoreVersion }) }}</p>
<p class="lead text-center text-md-left" v-if="storeDeviceConfigString"><BIconLaptop /> {{ storeDeviceConfigString }}</p>
<p class="text-center text-md-left mb-0"><BIconInfoCircle /> <a href="#" @click="$refs.changelogModal.show()">{{ $t('pageAboutChangelog') }}</a></p>
<p class="text-center text-md-left mb-0"><BIconInfoCircle /> <a href="#" @click.prevent="$refs.changelogModal.show()">{{ $t('pageAboutChangelog') }}</a></p>
</b-col>
</b-row>
</div>
Expand Down
66 changes: 23 additions & 43 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,7 @@
</b-row>
</div>

<b-row>
<b-col cols=6 md=3 class="mb-4" v-for="banner in homeBanners" :key="`home-banner-${banner.id}`">
<b-card class="home-card h-100" no-body>
<b-card-img class="p-2 p-md-4 p-lg-5" :top="true" :src="require(`@/assets/img/${banner.image}`)" />
<b-card-body>
<b-card-title>{{ banner.title }}</b-card-title>
<b-card-sub-title>{{ banner.subtitle }}</b-card-sub-title>
</b-card-body>
<b-button variant="primary" class="stretched-link" :to="banner.to"><BIconCaretRight /> {{ $t('buttonSelect') }}</b-button>
</b-card>
</b-col>
</b-row>

<TrialSelector class="mb-4" />
<component v-for="c in sortedWidgets" :key="c.id" :is="c.component" class="mb-3" />

<b-card bg-variant="light" class="mb-4" v-if="!storeHideCitationMessage" no-body>
<b-card-body>
Expand All @@ -46,49 +33,42 @@

<script>
import { mapGetters } from 'vuex'
import { BIconNewspaper, BIconCaretRight } from 'bootstrap-vue'
import { BIconNewspaper } from 'bootstrap-vue'
import HomeBanners from '@/components/HomeBanners'
import TrialSelector from '@/components/TrialSelector'
const emitter = require('tiny-emitter/instance')
export default {
name: 'HomeView',
data: function () {
return {
widgets: [{
id: 'banners',
component: HomeBanners
}, {
id: 'trials',
component: TrialSelector
}]
}
},
components: {
BIconNewspaper,
BIconCaretRight,
HomeBanners,
TrialSelector
},
computed: {
...mapGetters([
'storeHideCitationMessage'
'storeHideCitationMessage',
'storeHomeWidgetOrder'
]),
homeBanners: function () {
return [{
id: 'setup',
title: this.$t('pageHomeCardTitleSetup'),
subtitle: this.$t('pageHomeCardSubtitleSetup'),
image: 'banner-setup.svg',
to: { name: 'trial-setup' }
}, {
id: 'share',
title: this.$t('pageHomeCardTitleShareData'),
subtitle: this.$t('pageHomeCardSubtitleShareData'),
image: 'banner-share.svg',
to: { name: 'trial-import' }
}, {
id: 'example',
title: this.$t('pageHomeCardTitleLoadExample'),
subtitle: this.$t('pageHomeCardSubtitleLoadExample'),
image: 'banner-load-example.svg',
to: { name: 'load-example' }
}, {
id: 'settings',
title: this.$t('pageHomeCardTitleSettings'),
subtitle: this.$t('pageHomeCardSubtitleSettings'),
image: 'banner-settings.svg',
to: { name: 'settings' }
}]
sortedWidgets: function () {
if (this.storeHomeWidgetOrder && this.storeHomeWidgetOrder.length > 0) {
return this.storeHomeWidgetOrder.map(o => this.widgets.find(w => w.id === o))
} else {
return this.widgets
}
}
},
methods: {
Expand Down
Loading

0 comments on commit 9d06c86

Please sign in to comment.