Skip to content

Commit

Permalink
styles(#62): pre-select first query and visualiser type in visualiser…
Browse files Browse the repository at this point in the history
… on load
  • Loading branch information
lukashornych committed Nov 4, 2023
1 parent 833d5bd commit b60ca1b
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ const queries = computed<string[]>(() => {
}
})
watch(queries, (newValue) => {
// pre-select first a query on first load
if (selectedQuery.value == undefined && newValue.length > 0) {
selectedQuery.value = newValue[0]
return
}
if (!supportsMultipleQueries.value) {
if (newValue.length > 0) {
selectedQuery.value = newValue[0]
Expand All @@ -54,7 +60,12 @@ watch(queries, (newValue) => {
} else {
if (selectedQuery.value != undefined && !newValue.includes(selectedQuery.value as string)) {
// selected query was removed
selectedQuery.value = undefined
if (newValue.length > 0) {
// pre-select next available query
selectedQuery.value = newValue[0]
} else {
selectedQuery.value = undefined
}
}
}
})
Expand Down Expand Up @@ -103,9 +114,20 @@ const visualiserTypes = computed<VisualiserType[]>(() => {
}
})
watch(visualiserTypes, (newValue) => {
// pre-select first a visualiser type on first load
if (selectedVisualiserType.value == undefined && newValue.length > 0) {
selectedVisualiserType.value = newValue[0].value
return
}
if (selectedVisualiserType.value != undefined && !newValue.map(it => it.value).includes(selectedVisualiserType.value as VisualiserTypeType)) {
// selected result-result-visualiser type was removed
selectedVisualiserType.value = undefined
// selected visualiser type was removed
if (newValue.length > 0) {
// pre-select next available visualiser type
selectedVisualiserType.value = newValue[0].value
} else {
selectedVisualiserType.value = undefined
}
}
})
const selectedVisualiserType = ref<VisualiserTypeType | undefined>()
Expand Down

0 comments on commit b60ca1b

Please sign in to comment.