Skip to content

Commit 7e388f8

Browse files
- CHG: Updated to vuetify 4.1.
- CHG: Moved trait stats calculation to datastore and incrementally update rather than recalculate every time. Should improve performance.
1 parent d61ef23 commit 7e388f8

52 files changed

Lines changed: 526 additions & 403 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 221 additions & 211 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"vue-qrcode-reader": "^5.7.3",
4343
"vue-router": "^4.5.1",
4444
"vue-virtual-scroller": "^2.0.0-beta.8",
45-
"vuetify": "^4.0.3"
45+
"vuetify": "^4.1.2"
4646
},
4747
"devDependencies": {
4848
"@tsconfig/node22": "^22.0.0",

src/App.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<v-menu>
3232
<template #activator="{ props }">
33-
<v-btn :icon="mdiThemeLightDark" v-bind="props" />
33+
<v-btn :icon="mdiThemeLightDark" v-bind="props" id="theme-button" />
3434
</template>
3535
<v-list>
3636
<v-list-subheader class="text-high-emphasis text-uppercase font-weight-black">{{ $t('menuTheme') }}</v-list-subheader>
@@ -145,7 +145,7 @@
145145
<v-dialog
146146
v-model="updateExists"
147147
persistent
148-
:max-width="`min(90vw, 401px)`"
148+
width="min(90vw, 401px)"
149149
>
150150
<v-card :title="$t('modalTitleAppUpdateAvailable')" :text="$t('modalTextAppUpdateAvailable')">
151151
<template #actions>
@@ -330,7 +330,8 @@
330330
// Listen for theme changes in the store
331331
watchEffect(() => {
332332
const str = isDark.value ? 'dark' : 'light'
333-
theme.change(store.storeTheme === 'system' ? str : store.storeTheme)
333+
theme.setTransitionOrigin(document.querySelector('#theme-button'))
334+
theme.change(store.storeTheme === 'system' ? str : store.storeTheme, store.storeTransitionsEnabled === true)
334335
store.setSystemTheme(str)
335336
})
336337

src/components/chart/CalendarHeatmap.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
heatmap,
3838
])
3939
40+
interface HeatmapCell {
41+
row: string
42+
column: string
43+
value: number | null
44+
}
45+
4046
const compProps = defineProps<{
4147
year: number
4248
trial: TrialPlus
@@ -62,6 +68,9 @@
6268
return []
6369
}
6470
})
71+
const heatmapMonths = computed(() => {
72+
return (months.value || []).concat().reverse()
73+
})
6574
6675
const isHorizontal = computed(() => width.value < 720)
6776
const safeTrialName = computed(() => compProps.trial ? compProps.trial.name.replace(/[^a-z0-9]/gi, '-').toLowerCase() : '')
@@ -101,9 +110,26 @@
101110
102111
let max = 0
103112
113+
const hd: { [key: string]: HeatmapCell } = {}
114+
115+
z.forEach((monthData, month) => {
116+
monthData.forEach((_, day) => {
117+
hd[`${month}|${day}`] = {
118+
row: heatmapMonths.value[month] || '',
119+
column: `${day + 1}`,
120+
value: null,
121+
}
122+
})
123+
})
124+
104125
Object.keys(cData).forEach(key => {
105126
const value = cData[key] || 0
106127
const d = new Date(key)
128+
129+
const hmd = hd[`${d.getMonth()}|${d.getDate() - 1}`]
130+
if (hmd) {
131+
hmd.value = value
132+
}
107133
// @ts-ignore
108134
z[11 - d.getMonth()][d.getDate() - 1] = value
109135

src/components/chart/FieldLayoutHeatmap.vue

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
import Plotly from 'plotly.js/lib/core'
8484
import heatmap from 'plotly.js/lib/heatmap'
8585
import scatter from 'plotly.js/lib/scatter'
86-
import { getTrialDataCached } from '@/plugins/datastore'
86+
import { getTrialDataCached, trialTraitStats } from '@/plugins/datastore'
8787
import { coreStore } from '@/stores/app'
8888
import { CellCategory, TraitDataType, type Measurement } from '@/plugins/types/gridscore'
8989
import { categoricalColors, invertHex, toCssNamedColors } from '@/plugins/color'
@@ -92,7 +92,7 @@
9292
import TraitSelect from '@/components/trait/TraitSelect.vue'
9393
import { mdiAlert, mdiInformation, mdiLandFields } from '@mdi/js'
9494
import { getDateTSIndependent, getI18nParams } from '@/plugins/formatting'
95-
import { calculateTraitStatsIndividual, createDynamicQuantiles, isSuspicious } from '@/plugins/stats'
95+
import { isSuspicious } from '@/plugins/stats'
9696
9797
// Only register the chart types we're actually using to reduce the final bundle size
9898
Plotly.register([
@@ -286,22 +286,6 @@
286286
}
287287
}
288288
289-
if (isNumericOrDate.value && store.storeSuspiciousDataPointHighlight) {
290-
if (highlightSus.value) {
291-
trait.suspiciousChecker = createDynamicQuantiles()
292-
const timepoint = (timepoints.value.length > 0 && trait.allowRepeats) ? timepoints.value[currentTimepoint.value] : undefined
293-
calculateTraitStatsIndividual(trait, trialData, timepoint, v => {
294-
if (trait.dataType === TraitDataType.date) {
295-
return (new Date(v).getTime() - minDate.getTime()) / (1000 * 60 * 60 * 24)
296-
} else {
297-
return +v
298-
}
299-
})
300-
} else {
301-
delete trait.suspiciousChecker
302-
}
303-
}
304-
305289
const catColors = ((trait.dataType === TraitDataType.categorical && restrictions) ? restrictions.categories : []) || []
306290
const colorMap = toCssNamedColors(catColors)
307291
const allValidNamedColors = Object.keys(colorMap).length === catColors.length
@@ -341,7 +325,10 @@
341325
: `${t('tooltipChartHeatmapRow', i18nParams.value)}: %{y}<br>${t('tooltipChartHeatmapColumn', i18nParams.value)}: %{x}<br>${t('tooltipChartHeatmapValue')}: %{z}<extra>%{text}</extra>`,
342326
}]
343327
344-
if (store.storeSuspiciousDataPointHighlight && trait.suspiciousChecker && trait.suspiciousChecker.validRangeInfo?.isReady) {
328+
const traitStats = trialTraitStats.value[trait.id || '']
329+
330+
if (traitStats && store.storeSuspiciousDataPointHighlight && traitStats.suspiciousChecker && traitStats.suspiciousChecker.validRangeInfo?.isReady) {
331+
console.log(traitStats)
345332
const susDots = {
346333
x: [] as number[],
347334
y: [] as number[],
@@ -356,7 +343,7 @@
356343
for (let column = 0; column < compProps.trial.layout.columns; column++) {
357344
const v = z[row]?.[column]
358345
359-
if (v !== undefined && v !== null && isSuspicious(trait.suspiciousChecker, +v)) {
346+
if (v !== undefined && v !== null && isSuspicious(traitStats.suspiciousChecker, trait.dataType === TraitDataType.date ? (+v * (1000 * 60 * 60 * 24)) : +v)) {
360347
susDots.x.push(column + 1)
361348
susDots.y.push(row + 1)
362349
}

src/components/inputs/TraitInput.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@
305305
import { mdiCalendarToday, mdiCamera, mdiCancel, mdiChevronLeft, mdiChevronRight, mdiMapMarker, mdiVideo } from '@mdi/js'
306306
import { getId } from '@/plugins/id'
307307
import { isSuspicious } from '@/plugins/stats'
308+
import { trialTraitStats } from '@/plugins/datastore'
308309
309310
const nonTtsTraitTypes = new Set([TraitDataType.gps, TraitDataType.video, TraitDataType.image, TraitDataType.date, TraitDataType.text, TraitDataType.range])
310311
@@ -332,6 +333,8 @@
332333
const input = useTemplateRef('input')
333334
const id = ref(`data-input-${getId()}`)
334335
336+
const traitStats = computed(() => trialTraitStats.value[compProps.trait.id || ''])
337+
335338
const valid = computed(() => {
336339
const mv = model.value
337340
if (mv !== undefined && mv !== null && rules.value && rules.value.length > 0) {
@@ -343,8 +346,8 @@
343346
344347
const warning = computed(() => {
345348
const mv = model.value
346-
if (mv !== undefined && mv !== null && (TraitDataType.isNumeric(compProps.trait.dataType) || compProps.trait.dataType === TraitDataType.date) && compProps.trait.suspiciousChecker && compProps.trait.suspiciousChecker.validRangeInfo?.isReady) {
347-
return isSuspicious(compProps.trait.suspiciousChecker, TraitDataType.isNumeric(compProps.trait.dataType) ? +mv : new Date(mv).getTime())
349+
if (mv !== undefined && mv !== null && (TraitDataType.isNumeric(compProps.trait.dataType) || compProps.trait.dataType === TraitDataType.date) && traitStats.value && traitStats.value.suspiciousChecker && traitStats.value.suspiciousChecker.validRangeInfo?.isReady) {
350+
return isSuspicious(traitStats.value.suspiciousChecker, TraitDataType.isNumeric(compProps.trait.dataType) ? +mv : new Date(mv).getTime())
348351
}
349352
return false
350353
})

src/components/modals/AddPersonModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-dialog v-model="dialog" max-width="min(90vw, 1024px)">
2+
<v-dialog v-model="dialog" width="min(90vw, 1024px)">
33
<v-card :title="$t('modalTitleEditPeople')">
44
<template #text>
55
<v-form @submit.prevent>

src/components/modals/AddTraitReferenceImageModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<v-dialog v-model="dialog" scrollable max-width="min(90vw, 1024px)">
3+
<v-dialog v-model="dialog" scrollable width="min(90vw, 1024px)">
44
<v-card>
55
<template #title>
66
<div class="d-flex justify-space-between">

src/components/modals/AddTrialGermplasmModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-dialog v-model="dialog" scrollable max-width="min(90vw, 1024px)">
2+
<v-dialog v-model="dialog" scrollable width="min(90vw, 1024px)">
33
<v-card :title="$t('modalTitleAddGermplasm')">
44
<template #text>
55
<p>{{ $t('modalTextAddGermplasm') }}</p>

src/components/modals/ChangelogModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<v-dialog v-model="dialog" max-width="min(90vw, 1024px)" scrollable>
2+
<v-dialog v-model="dialog" width="min(90vw, 1024px)" scrollable>
33
<v-card :title="$t('modalTitleChangelog')">
44
<template #text>
55
<p v-html="$t('modalTextChangelog')" />

0 commit comments

Comments
 (0)