diff --git a/public/css/map-and-reports.css b/public/css/map-and-reports.css new file mode 100644 index 00000000..bb612303 --- /dev/null +++ b/public/css/map-and-reports.css @@ -0,0 +1,24 @@ +.dashboard-container { + grid-template-areas: + 'map reports' + 'map charts'; + grid-template-columns: 2fr 1fr; + grid-template-rows: + 2fr + 3fr; +} + +/* Mobile */ +@media only screen and (max-width: 768px) and (orientation: portrait) { + .dashboard-container { + grid-template-areas: + 'map' + 'reports' + 'charts'; + grid-template-columns: 1fr; + grid-template-rows: + 2fr + 1fr + 3fr; + } +} diff --git a/public/css/ssd-and-charts.css b/public/css/ssd-and-charts.css new file mode 100644 index 00000000..72c82d63 --- /dev/null +++ b/public/css/ssd-and-charts.css @@ -0,0 +1,8 @@ +.dashboard-container { + grid-template-areas: + 'ssd' + 'charts'; + grid-template-rows: + 2fr + 1fr; +} diff --git a/public/css/widgets-and-reports.css b/public/css/widgets-and-reports.css new file mode 100644 index 00000000..f8c1bef2 --- /dev/null +++ b/public/css/widgets-and-reports.css @@ -0,0 +1,28 @@ +.dashboard-container { + grid-template-areas: + 'reports map map' + 'reports widget-rain widget-snow' + 'reports widget-temp widget-wind'; + grid-template-columns: 2fr 1fr 1fr; + grid-template-rows: + 1fr + 1fr + 1fr; +} + +/* Mobile */ +@media only screen and (max-width: 768px) and (orientation: portrait) { + .dashboard-container { + grid-template-areas: + 'reports reports' + 'widget-rain widget-snow' + 'widget-temp widget-wind' + 'map map'; + grid-template-columns: 1fr 1fr; + grid-template-rows: + 1fr + 1fr + 1fr + 1fr; + } +} diff --git a/public/dashboards.json b/public/dashboards.json new file mode 100644 index 00000000..5715cbf7 --- /dev/null +++ b/public/dashboards.json @@ -0,0 +1,80 @@ +[ + { + "id": "widgets-and-reports", + "title": "Widgets and reports", + "css": "widgets-and-reports.css", + "panels": [ + { + "id": "widget-rain" + }, + { + "id": "widget-snow" + }, + { + "id": "widget-temp" + }, + { + "id": "widget-wind" + }, + { + "id": "reports", + "reportDisplay": { + "reports": [ + { + "moduleInstanceId": "ReportHazardMapRainfallSAWS" + } + ] + } + }, + { + "id": "map" + } + ] + }, + { + "id": "map-and-reports", + "title": "Map and reports", + "css": "map-and-reports.css", + "panels": [ + { + "id": "map", + "gridDisplaySelection": { + "plotId": "hazard_map_saws" + } + }, + { + "id": "reports", + "reportDisplay": { + "reports": [ + { + "moduleInstanceId": "ReportHazardMapRainfallSAWS" + } + ] + } + }, + { + "id": "charts" + } + ] + }, + { + "id": "ssd-and-charts", + "title": "SSD and charts", + "css": "ssd-and-charts.css", + "panels": [ + { + "id": "ssd" + }, + { + "id": "charts", + "chartDisplay": { + "charts": [ + { + "moduleInstanceId": "ChartHazardMapRainfallSAWS" + } + ] + } + } + ] + } +] diff --git a/src/components/general/DashboardDisplay.vue b/src/components/general/DashboardDisplay.vue new file mode 100644 index 00000000..6392b152 --- /dev/null +++ b/src/components/general/DashboardDisplay.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/src/lib/topology/displayTabs.ts b/src/lib/topology/displayTabs.ts index ec75faf2..c0cf4d58 100644 --- a/src/lib/topology/displayTabs.ts +++ b/src/lib/topology/displayTabs.ts @@ -17,6 +17,7 @@ export interface DisplayTab { | 'data-download' | 'schematic-status-display' | 'system-monitor' + | 'dashboard' id: string title: string href?: string @@ -75,6 +76,14 @@ const displayTabs: DisplayTab[] = [ icon: 'mdi-view-dashboard', active: false, }, + { + type: 'dashboard', + id: 'dashboard', + title: 'Dashboard', + to: { name: 'TopologyDashboard' }, + icon: 'mdi-view-dashboard', + active: false, + }, ] export function displayTabsForNode(node: TopologyNode, parentNodeId?: string) { @@ -110,6 +119,10 @@ export function displayTabsForNode(node: TopologyNode, parentNodeId?: string) { tab.active = nodeHasSystemMonitor(node) tab.to.params = { ...params } break + case 'dashboard': + tab.active = true + tab.to.params = { ...params } + break } } return displayTabs.filter((tab) => tab.active) diff --git a/src/router/index.ts b/src/router/index.ts index 8bffc8eb..186bb357 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -35,6 +35,7 @@ const TimeSeriesDisplay = () => import('../components/timeseries/TimeSeriesDisplay.vue') const HtmlDisplayView = () => import('../views/HtmlDisplayView.vue') const ReportsDisplayView = () => import('../views/ReportsDisplayView.vue') +const DashboardView = () => import('../views/DashboardView.vue') const Empty = () => import('../views/Empty.vue') const routesBase: Readonly = [ @@ -181,6 +182,13 @@ export const dynamicRoutes: Readonly = [ props: true, meta: { sidebar: true }, }, + { + path: '/topology/node/:nodeId*/dashboard', + name: 'TopologyDashboard', + component: DashboardView, + props: true, + meta: { sidebar: true }, + }, { path: '/topology/node/:nodeId*/ssd/:panelId?', name: 'TopologySchematicStatusDisplay', diff --git a/src/views/DashboardView.vue b/src/views/DashboardView.vue new file mode 100644 index 00000000..7ccacb27 --- /dev/null +++ b/src/views/DashboardView.vue @@ -0,0 +1,53 @@ + + + + +