JobDetail: Emit reshuffled event on tab clicks

This way the tasks table properly resizes, accommodating for the
content changes of the tab group above it.
This commit is contained in:
Francesco Siddi 2022-07-05 18:21:31 +02:00
parent 52ceba2960
commit df79864847
2 changed files with 9 additions and 2 deletions

View File

@ -1,10 +1,17 @@
<script setup> <script setup>
import { useSlots, ref, provide } from "vue"; import { useSlots, ref, provide } from "vue";
const emit = defineEmits(['clickedJobDetailsTab',])
const slots = useSlots(); const slots = useSlots();
const tabTitles = ref(slots.default().map((tab) => tab.props.title)); const tabTitles = ref(slots.default().map((tab) => tab.props.title));
const selectedTitle = ref(tabTitles.value[0]); const selectedTitle = ref(tabTitles.value[0]);
provide("selectedTitle", selectedTitle); provide("selectedTitle", selectedTitle);
function updateTabTitle(title) {
this.selectedTitle = title;
emit('clickedJobDetailsTab');
}
</script> </script>
<template> <template>
@ -15,7 +22,7 @@ provide("selectedTitle", selectedTitle);
:key="title" :key="title"
class="tab-item" class="tab-item"
:class="{ active: selectedTitle === title }" :class="{ active: selectedTitle === title }"
@click="selectedTitle = title" @click="updateTabTitle(title)"
> >
{{ title }} {{ title }}
</li> </li>

View File

@ -1,7 +1,7 @@
<template> <template>
<template v-if="hasJobData"> <template v-if="hasJobData">
<last-rendered-image ref="lastRenderedImage" :jobID="jobData.id" thumbnailSuffix="-tiny" /> <last-rendered-image ref="lastRenderedImage" :jobID="jobData.id" thumbnailSuffix="-tiny" />
<TabsWrapper> <TabsWrapper @clicked-job-details-tab="$emit('reshuffled')">
<TabItem title="Job Settings"> <TabItem title="Job Settings">
<dl v-if="hasSettings"> <dl v-if="hasSettings">
<template v-for="value, key in settingsToDisplay"> <template v-for="value, key in settingsToDisplay">