Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: quick preset editor values must be set on creation (#2028) #2039

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion frontend/src/variants/components/FilterForm/QuickPresets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,30 @@ const quickPresetWrapper = computed({
},
})

const quickPresetsComplete = computed(() => {
const result = {}
for (const [name, theQuickPresets] of Object.entries(props.quickPresets)) {
let skip = false
for (const key of [
'inheritance',
'frequency',
'impact',
'quality',
'chromosomes',
'flagsetc',
]) {
if (!theQuickPresets[key]) {
skip = true
break
}
}
if (!skip) {
result[name] = theQuickPresets
}
}
return result
})

/** Refresh all presets. */
const refreshAllRefs = () => {
refreshInheritanceRef()
Expand Down Expand Up @@ -366,7 +390,7 @@ onMounted(() => {
v-model="quickPresetWrapper"
class="custom-select custom-select-sm"
>
<option v-for="(value, name) in quickPresets" :value="name">
<option v-for="(value, name) in quickPresetsComplete" :value="name">
{{ value.label ?? name }}
</option>
<option disabled>custom</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ const handleAddClicked = async (category) => {
quality: null,
chromosome: null,
flagsetc: null,
inheritance: null,
}
} else if (category === 'qualitypresets') {
payload = {
Expand Down
22 changes: 22 additions & 0 deletions frontend/src/variants/components/QueryPresets/SetQuickPresets.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup>
/** Editor component for quick presets.
*/
import { computed } from 'vue'

import { randomString } from '@/varfish/common'

/** Define props. */
Expand All @@ -15,11 +17,31 @@ const props = defineProps({
default: randomString(),
},
})

const isIncomplete = computed(() => {
for (const key of [
'inheritance',
'frequency',
'impact',
'quality',
'chromosome',
'flagsetc',
]) {
if (!props.querySettings[key]) {
return true
}
}
return false
})
</script>

<template>
<!-- eslint-disable -->
<div v-if="querySettings" class="mr-2 mt-2">
<div class="alert alert-warning" v-if="isIncomplete">
<strong>Warning!</strong> The query settings are incomplete and will not
be available in the filter form unless all values are set.
</div>
<div class="form-group">
<label :for="'inheritance' + idSuffix"> Inheritance </label>
<select
Expand Down
Loading