43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { createDirectus, rest, authentication, readDashboards, createDashboard, createPanel } from '@directus/sdk';
|
|
|
|
async function debugLabelFallback() {
|
|
const url = 'http://localhost:8059';
|
|
const email = 'marc@mintel.me';
|
|
const password = 'Tim300493.';
|
|
|
|
console.log(`🚀 creating Debug Label Fallback Dashboard: ${url}`);
|
|
const client = createDirectus(url).with(authentication('json')).with(rest());
|
|
|
|
try {
|
|
await client.login(email, password);
|
|
console.log('✅ Authenticated');
|
|
|
|
const dashboard = await client.request(createDashboard({
|
|
name: 'Debug Label Fallback',
|
|
icon: 'label',
|
|
color: '#0000FF'
|
|
}));
|
|
|
|
// Variant 5: Label with Markdown (Static list simulation)
|
|
// Note: Label panels don't take a collection, they just render text.
|
|
// This confirms if we can at least show SOMETHING.
|
|
await client.request(createPanel({
|
|
dashboard: dashboard.id,
|
|
name: 'Label Fallback',
|
|
type: 'label',
|
|
width: 12, height: 10, position_x: 0, position_y: 0,
|
|
options: {
|
|
text: '### Recent Feedback\n\n- User: Test Message\n- User2: Another Message'
|
|
}
|
|
}));
|
|
|
|
console.log('✅ Debug Label Dashboard Created');
|
|
|
|
} catch (e: any) {
|
|
console.error('❌ Creation failed:');
|
|
console.error(e.message);
|
|
}
|
|
}
|
|
|
|
debugLabelFallback();
|