106 lines
3.1 KiB
JavaScript
106 lines
3.1 KiB
JavaScript
// This file is intended to track default widget states as a baseline for any created widgets
|
|
import AlertLevel from "src/components/Canvas/CanvasComponents/AlertLevelWidget.jsx"
|
|
import GasWidget from "src/components/Canvas/CanvasComponents/GasWidget";
|
|
|
|
// Example widgets, returns actual baseline widget
|
|
export const WIDGET_REGISTRY = {
|
|
// ***************** My Dashboard Widgets *****************
|
|
alert_level: {
|
|
key: "alert_level",
|
|
label: "Alert Level",
|
|
kind: "real",
|
|
defaults: { w: 4, h: 7, minW: 4, minH: 7, maxW: 8, maxH: 14 },
|
|
category: "generic",
|
|
},
|
|
|
|
ivans: {
|
|
key: "ivans",
|
|
label: "IVANS",
|
|
kind: "placeholder",
|
|
placeholderTitle: "IVANS",
|
|
defaults: {w: 4, h: 7, minW: 4, minH: 5, maxW: 8, maxH: 12 },
|
|
category: "generic",
|
|
},
|
|
|
|
plume_heights: {
|
|
key: "plume_heights",
|
|
label: "Plume Heights",
|
|
kind: "placeholder",
|
|
placeholderTitle: "Plume Heights",
|
|
defaults: {w: 4, h: 7, minW: 4, minH: 5, maxW: 8, maxH: 12 },
|
|
category: "generic",
|
|
},
|
|
|
|
alert_level_changes: {
|
|
key: "alert_level_changes",
|
|
label: "Alert Level Changes",
|
|
kind: "placeholder",
|
|
placeholderTitle: "Alert Level Changes",
|
|
defaults: {w: 4, h: 7, minW: 4, minH: 5, maxW: 8, maxH: 12 },
|
|
category: "generic",
|
|
},
|
|
|
|
// ***************** Gas Widgets *****************
|
|
gas_measurements: {
|
|
key: "gas_measurements",
|
|
label: "Gas Measurements",
|
|
kind: "real",
|
|
defaults: {w: 4, h: 6, minW: 4, minH: 5, maxW: 8, maxH: 12 },
|
|
category: "gas",
|
|
// ~ defaultConfig is being moved to widgetInspectorRegistry
|
|
// defaultConfig: {
|
|
// // for later filters
|
|
// rangeDays: 30,
|
|
// compound: null,
|
|
// volcano: null,
|
|
// site: null,
|
|
// },
|
|
},
|
|
|
|
gas_so2: {
|
|
key: "gas_so2",
|
|
label: "SO₂",
|
|
kind: "placeholder",
|
|
placeholderTitle: "SO2",
|
|
defaults: {w: 4, h: 7, minW: 4, minH: 5, maxW: 8, maxH: 12 },
|
|
category: "gas",
|
|
},
|
|
|
|
// Add Additional Widgets to the Registry as they are generated
|
|
// Gas Widgets
|
|
// Seismic Widgets
|
|
// Remote Sensing Widgets
|
|
// Deformation Widgets
|
|
};
|
|
|
|
// Used to define components without adding .jsx to a .js registry file
|
|
export const WIDGET_COMPONENTS = {
|
|
alert_level: AlertLevel,
|
|
gas_measurements: GasWidget, // clicking CO2 renders the temp gas widget
|
|
};
|
|
|
|
// Which widgets show up in "Add Widget" for each view
|
|
// Make sure these match the keys inside the WIDGET_REGISTRY
|
|
export const VIEW_WIDGET_KEYS = {
|
|
mydashboard: [
|
|
"alert_level",
|
|
"gas_measurements",
|
|
"ivans",
|
|
"plume_heights",
|
|
"alert_level_changes"
|
|
],
|
|
|
|
gas: [
|
|
"gas_measurements",
|
|
"gas_so2",
|
|
],
|
|
|
|
seismic: ["alert_level"],
|
|
};
|
|
|
|
export const getWidgetsForView = (view) => {
|
|
const keys = VIEW_WIDGET_KEYS[view] ?? [];
|
|
return keys
|
|
.map((k) => WIDGET_REGISTRY[k])
|
|
.filter(Boolean);
|
|
}; |