diff --git a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
index 98050ba..be5defa 100644
--- a/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
+++ b/nuxt4-app/app/components/metabase/MetabaseCardDisplay.vue
@@ -45,6 +45,60 @@
+
+
+
+
+
+ Configurar ParĂ¡metros
+
+
+
+
+
+
+
(null)
const error = ref(null)
const copied = ref(false)
+const showParameters = ref(false)
+const parameterValues = ref>({})
+
+// Initialize parameter values from card template tags
+const templateTags = computed(() => props.card.dataset_query?.native?.['template-tags'] || {})
+
+const hasParameters = computed(() => Object.keys(templateTags.value).length > 0)
+
+// Initialize parameters on mount
+function initializeParameters() {
+ const params: Record = {}
+ for (const [tagName, tagConfig] of Object.entries(templateTags.value)) {
+ const config = tagConfig as any
+ if (config.type === 'boolean') {
+ params[tagName] = config.default?.[0] ?? false
+ } else {
+ params[tagName] = config.default ?? ''
+ }
+ }
+ parameterValues.value = params
+}
+
+// Watch for card changes and reinitialize
+watch(() => props.card, () => {
+ initializeParameters()
+}, { immediate: true })
const exportItems = [[
{
@@ -193,6 +273,20 @@ const exportItems = [[
}
]]
+function getParameterType(key: string): string {
+ const config = templateTags.value[key] as any
+ return config?.type || 'text'
+}
+
+function getParameterLabel(key: string): string {
+ const config = templateTags.value[key] as any
+ return config?.['display-name'] || key
+}
+
+function resetParameters() {
+ initializeParameters()
+}
+
function getStatusColor(card: any) {
if (card.archived) return 'red'
if (card.dataset) return 'blue'
@@ -214,24 +308,21 @@ async function executeQuery() {
queryResult.value = null
try {
- // Extract template tags and their defaults from the card
- const templateTags = props.card.dataset_query?.native?.['template-tags'] || {}
const parameters = []
- // Build parameters from template tags
- for (const [tagName, tagConfig] of Object.entries(templateTags)) {
+ // Build parameters from current form values
+ for (const [tagName, tagConfig] of Object.entries(templateTags.value)) {
const config = tagConfig as any
let paramType = 'text'
- let paramValue = config.default
+ let paramValue = parameterValues.value[tagName]
// Determine parameter type based on tag type
if (config.type === 'date') {
paramType = 'date/single'
- // Use default value if present
- paramValue = config.default || null
+ paramValue = parameterValues.value[tagName] || null
} else if (config.type === 'boolean') {
paramType = 'category'
- paramValue = config.default || [false]
+ paramValue = [parameterValues.value[tagName]]
}
parameters.push({