From 7eea1744a168cd292903f4d7a3b37f4ca9046895 Mon Sep 17 00:00:00 2001 From: Roma Kosovichev Date: Thu, 11 May 2023 21:31:54 +0100 Subject: [PATCH] fix: plugin settings --- grafana/data-source/src/plugin.json | 4 ++-- grafana/floor-panel/src/components/FloorPanel.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/grafana/data-source/src/plugin.json b/grafana/data-source/src/plugin.json index a4a9e44..e35ffbf 100644 --- a/grafana/data-source/src/plugin.json +++ b/grafana/data-source/src/plugin.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json", "type": "datasource", "name": "Archilogic Grafana Datasource plugin", - "id": "archilogic-datasource", + "id": "archilogic-archilogic-datasource", "metrics": true, "streaming": true, "info": { @@ -24,4 +24,4 @@ "grafanaDependency": "^9.2.5", "plugins": [] } -} +} \ No newline at end of file diff --git a/grafana/floor-panel/src/components/FloorPanel.tsx b/grafana/floor-panel/src/components/FloorPanel.tsx index 5727bbb..f7619cc 100644 --- a/grafana/floor-panel/src/components/FloorPanel.tsx +++ b/grafana/floor-panel/src/components/FloorPanel.tsx @@ -11,7 +11,7 @@ interface Props extends PanelProps {} const HIGHLIGHT_COLOR: [number, number, number] = [100, 200, 100] export const FloorPanel: React.FC = props => { - const [floorPlan, setFloorPlan] = useState(undefined as FloorPlanEngine) + const [floorPlan, setFloorPlan] = useState(undefined as FloorPlanEngine | undefined) const [isFloorPlanLoaded, setIsFloorPlanLoaded] = useState(false) const { id, token, nodeId, colorFrom, colorTo } = props.options @@ -21,6 +21,9 @@ export const FloorPanel: React.FC = props => { const gradient = getGradients(colorFrom, colorTo) function handleInputSourceData() { + if (!floorPlan) { + return + } const nodes = getAssetsAndSpaces(floorPlan) nodes.forEach((entity: any) => { if (ids.includes(entity.id)) { @@ -33,6 +36,9 @@ export const FloorPanel: React.FC = props => { }) } function handleSpaceId() { + if (!floorPlan) { + return + } const node = getNodeById(floorPlan, nodeId) if (node) { node?.setHighlight({ fill: HIGHLIGHT_COLOR })