11<template >
2- <q-dialog v-model =" showDialog" >
2+ <q-dialog v-model =" showDialog" @show = " onDialogShow " >
33 <q-card style =" display : inline-block ; width : auto ; max-width : 800px ;" >
44 <q-card-section class =" bg-primary text-white text-h6" >
55 Import Plugin Tasks
2929 v-model:selected =" selectedTasks"
3030 selection =" multiple"
3131 row-key =" name"
32+ :loading =" loading"
3233 >
3334 <template #body-cell-name =" props " >
3435 <div style =" font-size : 18px ;" >
117118 label =" No params listed"
118119 />
119120 </div >
120- <div class =" column items-end" style =" width : 142px ; padding-left : 0 ; padding-right : 0 ;" >
121+ <div
122+ class =" column items-end"
123+ :style =" {width: outputParamsWidth ? outputParamsWidth + 'px' : '172px',}"
124+ >
121125 <q-chip
122126 v-for =" (param, i) in dupliateTasksWithDifferentParams[row.name].outputParams"
123127 :key =" i"
164168</template >
165169
166170<script setup>
167- import { ref , watch , computed } from ' vue'
171+ import { ref , watch , computed , nextTick } from ' vue'
168172import * as api from ' @/services/dataApi'
169173import TableComponent from ' @/components/TableComponent.vue'
170174import * as notify from ' ../notify'
@@ -176,6 +180,10 @@ const showDialog = defineModel()
176180
177181const existingTasksCopy = ref ([])
178182
183+ const tableRef = ref ()
184+ const outputParamsWidth = ref (0 )
185+ const loading = ref (true )
186+
179187watch (() => showDialog .value , (newVal ) => {
180188 if (newVal) {
181189 tasks .value = []
@@ -186,6 +194,30 @@ watch(() => showDialog.value, (newVal) => {
186194 }
187195})
188196
197+ function getColumnWidthPxByLabel (label ) {
198+ const tableEl = (tableRef .value && tableRef .value .$el ) || null
199+ if (! tableEl) return 0
200+ const spans = tableEl .querySelectorAll (' .header-label' )
201+ for (let i = 0 ; i < spans .length ; i++ ) {
202+ const s = spans[i]
203+ if ((s .textContent || ' ' ).trim () === label) {
204+ const th = s .closest (' th' )
205+ if (th && th .getClientRects ().length > 0 && th .offsetParent !== null ) {
206+ // minus 8 to account for the left padding in the table headers
207+ return th .getBoundingClientRect ().width - 8
208+ }
209+ }
210+ }
211+ return 0
212+ }
213+
214+ function onDialogShow () {
215+ // Let QDialog/QTable finish layout in the next frame
216+ requestAnimationFrame (() => {
217+ outputParamsWidth .value = getColumnWidthPxByLabel (" Output Parameters" )
218+ })
219+ }
220+
189221const tasks = ref ([])
190222const selectedTasks = ref ([])
191223const errorMessage = ref (' ' )
@@ -231,6 +263,7 @@ async function suggestPluginTasks() {
231263 selectedTasks .value = tasks .value .filter (
232264 task => ! Object .keys (dupliateIdenticalTasks .value ).includes (task .name )
233265 )
266+ loading .value = false
234267 } catch (err) {
235268 console .warn (err)
236269 notify .error (err .response .data .message )
@@ -325,4 +358,4 @@ function deepEqual(obj1, obj2, ignoreKeys = []) {
325358}
326359
327360
328- < / script>
361+ < / script>
0 commit comments