Files
Web-Frontend/client/src/constants/widgetRegistry.jsx
T

218 lines
7.5 KiB
React

// config/widgetRegistry.js
import { lazy } from 'react';
// We assume a 12-column grid.
// w: 12 = full screen width
// w: 6 = half screen width
// w: 4 = one-third screen width
// w: 3 = one-quarter screen width
// ONE DAY DATE RANGE
const getToday = () => (new Date()).toLocaleDateString('en-CA')
// ONE WEEK DATE RANGE
const getStartDate = () => (new Date(Date.now() - 604800000)).toLocaleDateString('en-CA'); // 7 days = 604800000 = 7*24*60*60*1000
const getEndDate = () => (new Date()).toLocaleDateString('en-CA'); // 'en-CA' formats the date as YYYY-MM-DD
export const WIDGET_REGISTRY = {
"vaa_activity": {
name: "VAA 7 Day Activity",
category: "Aviation",
description: "Displays 7-day flight level timelines across multiple volcanoes.",
component: lazy(() => import('../components/widgets/VaaActivity7Day')),
// The specific settings UI for this widget
settingsComponent: lazy(() => import('../components/widgets/settings/VaaActivitySettings')),
// The baseline data every new VAA widget starts with
defaultSettings: {
// startDate: getStartDate(),
// endDate: getEndDate(),
yAxisScale: 'normal', // Options: 'normal' | 'symlog'
},
allowedSizes: {
xlarge: { w: 12, h: 12 },
}
},
"db_cache_health": {
name: "DB Cache Health",
category: "Computer Science",
description: "Bar chart showing cache table operational status.",
allowedSizes: {
small: { w: 3, h: 12 },
medium: { w: 6, h: 12 }
}
},
"ivans_alerts": {
name: "IVANS",
category: "Communications",
description: "Feed of recent IVANS reports and reviewer statuses.",
component: lazy(() => import('../components/widgets/IvansAlerts.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/IvansAlertsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
copyToClipboard: false,
activeSorts: {
timeSort: "desc",
volcanoSort: false
}
},
allowedSizes: {
small: { w: 3, h: 6 },
medium: { w: 3, h: 9 },
large: { w: 3, h: 12 },
}
},
"remote_sensing": {
name: "Remote Sensing",
category: "Remote Sensing",
description: "Feed of recent remote sensing reports.",
component: lazy(() => import('../components/widgets/RemoteSensing.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/RemoteSensingSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
copyToClipboard: false,
activeSorts: {
timeSort: "desc",
volcanoSort: false
}
},
allowedSizes: {
small: { w: 3, h: 6 },
medium: { w: 3, h: 9 },
large: { w: 3, h: 12 },
}
},
"alert_levels": {
name: "Alert Level Changes",
category: "Daily Alerts",
description: "List of 7-day alert level changes with trend arrows.",
component: lazy(() => import('../components/widgets/AlertChanges.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/AlertChangeSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
},
allowedSizes: {
small: { w: 3, h: 6 },
large: { w: 3, h: 12 }
}
},
"explosion_events": {
name: "Explosion Events",
category: "Daily Volcanic Activity",
description: "List of explosion events over a specified time period.",
component: lazy(() => import('../components/widgets/ExplosionEvents.jsx')),
// The specific settings UI for this widget
settingsComponent: lazy(() => import('../components/widgets/settings/ExplosionEventsSettings.jsx')),
// The baseline data every new VAA widget starts with
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
yAxisScale: 'normal' // Options: 'normal' | 'symlog'
},
allowedSizes: {
medium: { w: 6, h: 12 }
}
},
"plume_events": {
name: "Plume Events",
category: "Daily Volcanic Activity",
description: "Plot of explosion heights over a weeks time.",
component: lazy(() => import('../components/widgets/PlumeEvents.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/PlumeEventsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
},
allowedSizes: {
medium: { w: 6, h: 12 }
}
},
"seismic_events": {
name: "Seismic Events",
category: "Daily Volcanic Activity",
description: "Plot of number of seismic events over a weeks time.",
component: lazy(() => import('../components/widgets/SeismicEvents.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/SeismicEventsSettings.jsx')),
defaultSettings: {
startDate: getStartDate(),
endDate: getEndDate(),
},
allowedSizes: {
medium: { w: 6, h: 12 }
}
},
"llm_al_changes_quad_plot": {
name: "Alert Level Changes Quad Plot",
category: "Computer Science",
description: "Percentage of TP, TN, FP, and FN changes in viable alert levels.",
component: lazy(() => import('../components/widgets/LlmAlChangesQuadPlot.jsx')),
allowedSizes: {
medium: { w: 3, h: 12 }
}
},
"comm_coor_report": {
name: "Communication Coordinator Report",
category: "Daily Volcanic Activity",
description: "Generated Report",
component: lazy(() => import('../components/widgets/CommCoorReport.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/CommCoorReportSettings.jsx')),
defaultSettings: {
copyToClipboard: false,
downloadReport: false,
startDate: getStartDate(),
endDate: getEndDate(),
},
allowedSizes: {
medium: { w: 3, h: 12 },
}
},
"vaa_map": {
name: "VAA Polygon Projections Map",
category: "Maps",
description: "By selecting a volcano, the map will take you to it and show a polygon of the ash in 8, 12, and 18 hours",
component: lazy(() => import('../components/widgets/VaaMap.jsx')),
settingsComponent: lazy(() => import('../components/widgets/settings/VaaMapSettings.jsx')),
defaultSettings: {
position: [45.61142, -122.49630], // CVO's coordinates
startDate: getToday(),
endDate: getToday(),
data: [],
isLoading: false,
isError: undefined,
selected: undefined,
defaultVAA: undefined,
},
allowedSizes: {
medium: { w: 6, h: 12 }
}
},
"travel_gantt_chart": {
name: "Travel Gantt Chart",
category: "Communications",
description: "View upcoming travels in a gantt chart",
component: lazy(() => import('../components/widgets/TravelGanttChart.jsx')),
allowedSizes: {
medium: { w: 6, h: 12 }
}
}
};