feat: integrate feedback module
This commit is contained in:
39
scripts/add-status-panel.ts
Normal file
39
scripts/add-status-panel.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { createDirectus, rest, authentication, createPanel, readDashboards } from '@directus/sdk';
|
||||
|
||||
async function addStatusPanel() {
|
||||
const url = 'http://localhost:8059';
|
||||
const email = 'marc@mintel.me';
|
||||
const password = 'Tim300493.';
|
||||
|
||||
console.log(`🚀 Adding Status Panel: ${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) {
|
||||
await client.request(createPanel({
|
||||
dashboard: db.id,
|
||||
name: 'Dashboard Status: LIVE',
|
||||
type: 'label',
|
||||
width: 24, height: 2, position_x: 0, position_y: 24,
|
||||
options: {
|
||||
text: '### ✅ Dashboard Rendering Service Active\n\nIf you see this, the system is online and updated as of ' + new Date().toISOString()
|
||||
}
|
||||
}));
|
||||
console.log('✅ Status Panel Added');
|
||||
} else {
|
||||
console.error('❌ Dashboard not found');
|
||||
}
|
||||
|
||||
} catch (e: any) {
|
||||
console.error('❌ Failed:');
|
||||
console.error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
addStatusPanel();
|
||||
Reference in New Issue
Block a user