import { createDirectus, rest, authentication, readDashboards, readPanels, updatePanel } from '@directus/sdk'; async function fixListPanel() { const url = 'http://localhost:8059'; const email = 'marc@mintel.me'; const password = 'Tim300493.'; console.log(`🚀 Fixing List Panel Template: ${url}`); const client = createDirectus(url).with(authentication('json')).with(rest()); try { await client.login(email, password); console.log('✅ Authenticated'); const dashboards = await client.request(readDashboards({ filter: { name: { _eq: 'Feedback Operational Intelligence' } } })); const db = dashboards[0]; if (!db) throw new Error('Dashboard not found'); const panels = await client.request(readPanels({ filter: { dashboard: { _eq: db.id }, type: { _eq: 'list' } } })); const listPanel = panels[0]; if (!listPanel) throw new Error('List panel not found'); console.log(`Found Panel: ${listPanel.id}`); console.log(`Current Template: ${listPanel.options.template}`); // Try a different syntax or simple field // In some versions it's {{field}}, in others it might be just field field // Let's try to set it to just {{text}} to see if basic interpolation works // Or maybe it needs HTML? console.log('Updating template to simple {{text}} ...'); await client.request(updatePanel(listPanel.id, { options: { ...listPanel.options, template: '{{text}}' } })); console.log('✅ Panel updated'); } catch (e: any) { console.error('❌ Fix failed:'); console.error(e.message); } } fixListPanel();