-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
53 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
node_modules | ||
dist | ||
coverage | ||
.tmp | ||
*.log | ||
*.ini | ||
*.log.* | ||
*.log.* | ||
.tmp |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export * from './constants'; | ||
export * from './colors'; | ||
export * from './get-series'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import { floorId, token } from '@grafana-common'; | ||
import { PanelPlugin } from '@grafana/data'; | ||
import { FloorOptions } from './types'; | ||
import { FloorPanel } from './components/FloorPanel'; | ||
import { floorId, token } from '@bi-plugin-utils' | ||
import { PanelPlugin } from '@grafana/data' | ||
import { FloorOptions } from './types' | ||
import { FloorPanel } from './components/FloorPanel' | ||
|
||
export const plugin = new PanelPlugin<FloorOptions>(FloorPanel).setPanelOptions((builder) => { | ||
export const plugin = new PanelPlugin<FloorOptions>(FloorPanel).setPanelOptions(builder => { | ||
return builder | ||
.addTextInput({ | ||
path: 'id', | ||
name: 'Floor plan ID', | ||
description: 'Description of panel option', | ||
defaultValue: floorId, | ||
defaultValue: floorId | ||
}) | ||
.addTextInput({ | ||
path: 'token', | ||
name: 'Publishable Token', | ||
description: 'Description of panel option', | ||
defaultValue: token, | ||
defaultValue: token | ||
}) | ||
.addTextInput({ | ||
path: 'nodeId', | ||
name: 'Node id', | ||
description: 'Space or Asset id', | ||
defaultValue: '', | ||
defaultValue: '' | ||
}) | ||
.addColorPicker({ | ||
path: 'colorFrom', | ||
name: 'Color From', | ||
defaultValue: '#fff000', | ||
settings: { | ||
mode: 'custom', | ||
}, | ||
mode: 'custom' | ||
} | ||
}) | ||
.addColorPicker({ | ||
path: 'colorTo', | ||
name: 'Color To', | ||
defaultValue: '#000fff', | ||
}); | ||
}); | ||
defaultValue: '#000fff' | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './components'; | ||
export * from './utils/colors'; | ||
export * from './utils/nodes'; | ||
export * from './utils/nodes'; | ||
export * from './utils/constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const floorId = 'e9c82007-ae74-4b95-9174-8df619a08bd8' | ||
export const token = 'a983595e-94ee-4ecf-8cd0-1f5f1612fc96' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
import { FloorPlanEngine } from '@archilogic/floor-plan-sdk' | ||
|
||
export const getAssetsAndSpaces = (floorPlan: FloorPlanEngine) => { | ||
if (!floorPlan) return [] | ||
const { spaces, assets } = floorPlan.resources | ||
return [...spaces, ...assets] | ||
} | ||
|
||
export const getNodeByid = (floorPlan: FloorPlanEngine, id: string) => { | ||
export const getNodeById = (floorPlan: FloorPlanEngine, id: string) => { | ||
const nodes = getAssetsAndSpaces(floorPlan) | ||
return nodes.find(node => node.id === id) | ||
} | ||
|
||
export const getNodeByClick = (floorPlan: FloorPlanEngine, evt: any) => { | ||
const { nodeId } = evt | ||
if (nodeId) { | ||
return getNodeByid(floorPlan, nodeId) | ||
return getNodeById(floorPlan, nodeId) | ||
} | ||
} | ||
|
||
export const getSpaceByPosition = (floorPlan: FloorPlanEngine, position: number[]) => { | ||
const point2d = position | ||
const positionResources = floorPlan.getResourcesFromPosition(point2d as [number, number]) | ||
return positionResources.spaces ? positionResources.spaces[0] : false | ||
} |