Skip to content

Commit

Permalink
Analysis view: fix teleport of box & whiskers sort input when mounted
Browse files Browse the repository at this point in the history
Use a template ref to ensure we only teleport once analysis view has been mounted
  • Loading branch information
MetRonnie committed Apr 10, 2024
1 parent f65e813 commit 42c7adb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/cylc/analysis/BoxPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<template>
<Teleport
v-if="sortInputTeleportTarget"
:to="sortInputTeleportTarget"
:to="`#${sortInputTeleportTarget}`"
>
<div class="d-flex flex-grow-1 col-gap-1">
<v-select
Expand Down Expand Up @@ -91,7 +91,7 @@ export default {
type: Boolean,
default: true,
},
/** Where to teleport the sorting input (or don't render if null) */
/** ID of element to teleport the sorting input (or don't render if null) */
sortInputTeleportTarget: {
type: String,
default: null,
Expand Down
14 changes: 10 additions & 4 deletions src/views/Analysis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</v-col>
</v-row>
<div
ref="toolbar"
id="analysis-toolbar"
class="d-flex align-center flex-wrap my-2 col-gap-2 row-gap-4"
>
Expand Down Expand Up @@ -103,21 +104,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</v-defaults-provider>
</div>
<AnalysisTable
v-if="table && filteredTasks.length"
v-if="table"
:tasks="filteredTasks"
:timing-option="timingOption"
/>
<BoxPlot
v-if="!table && filteredTasks.length"
v-else
:tasks="filteredTasks"
:timing-option="timingOption"
sort-input-teleport-target="#analysis-toolbar"
:sort-input-teleport-target="toolbar?.id"
/>
</v-container>
</div>
</template>
<script>
import { ref } from 'vue'
import {
debounce,
pick,
Expand Down Expand Up @@ -246,9 +248,13 @@ export default {
*/
const table = useInitialOptions('table', { props, emit }, true)
/** @type {import('vue').Ref<HTMLElement>} template ref */
const toolbar = ref(null)
return {
tasksFilter,
table
table,
toolbar,
}
},
Expand Down

0 comments on commit 42c7adb

Please sign in to comment.