39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { createDirectus, rest, authentication, readDashboards, readPanels } from '@directus/sdk';
|
|
|
|
async function inspectDashboards() {
|
|
const url = 'http://localhost:8059';
|
|
const email = 'marc@mintel.me';
|
|
const password = 'Tim300493.';
|
|
|
|
console.log(`🚀 Inspecting Dashboards: ${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({ fields: ['*'] }));
|
|
console.log('\n--- DASHBOARDS ---');
|
|
for (const db of dashboards) {
|
|
console.log(`Dashboard: ${db.name} (${db.id})`);
|
|
|
|
const panels = await client.request(readPanels({
|
|
filter: { dashboard: { _eq: db.id } },
|
|
fields: ['*']
|
|
}));
|
|
|
|
console.log(' Panels:');
|
|
panels.forEach(p => {
|
|
console.log(` - [${p.type}] ${p.name}`);
|
|
console.log(` Options: ${JSON.stringify(p.options, null, 2)}`);
|
|
});
|
|
}
|
|
|
|
} catch (e: any) {
|
|
console.error('❌ Inspection failed:');
|
|
console.error(e.message);
|
|
}
|
|
}
|
|
|
|
inspectDashboards();
|