Skip to content

Commit e5f22c5

Browse files
Luke-Lowerynckswt
andauthored
Cd 521/update graphql parsing (#3)
* Updated Parsring for new GraphQL Query * Remove Excess Package Files * Updated documentation and interface --------- Co-authored-by: Nick Sweet <[email protected]>
1 parent 58c7480 commit e5f22c5

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ e2e-results/
3232
# Editor
3333
.idea
3434

35-
.eslintcache
35+
.eslintcache
36+
plugins/*

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
# Grafana Plugin: Map Panel
22

3-
Visualize maps provided by an s3 datasource
3+
Visualize image files for indoor maps.
44

5+
## Interface
6+
We expect the datasource to provide a parseable JSON string of an object in the shape:
57

6-
## Requirements
8+
```
9+
{
10+
layers: { cleaning: "<SOME_URL>"},
11+
mapBundle: "<SOME_URL>"
12+
}
13+
```
14+
15+
Note that this will be subject to change as we include new features (e.g. viewing multiple layers).
716

8-
- Depends on [grafanaplugin-s3-datasource](https://github.com/tailosinc/grafanaplugin-s3-datasource) -- please make sure you have that installed to the same parent directory if you want to develop this plugin!
17+
### Example Setup
18+
You can use the [infinity datasource](https://grafana.com/grafana/plugins/yesoreyeram-infinity-datasource/?tab=installation) as . Simply put it in a top-level `plugins` folder then install through administration tools.
919

1020
## Getting Started
1121

docker-compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ services:
77
context: ./.config
88
args:
99
grafana_image: ${GRAFANA_IMAGE:-grafana-enterprise}
10-
grafana_version: ${GRAFANA_VERSION:-latest}
10+
grafana_version: ${GRAFANA_VERSION:-10.0.3}
1111
ports:
1212
- 3000:3000/tcp
1313
volumes:
14-
- ./provisioning:/etc/grafana/provisioning
14+
- ./plugins:/var/lib/grafana/plugins
1515
- ./dist:/var/lib/grafana/plugins/grafanaplugin-map-panel
16-
- ../grafanaplugin-s3-datasource/dist:/var/lib/grafana/plugins/grafanaplugin-s3-datasource

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@tailosinc/grafanaplugin-map-panel",
33
"version": "1.0.4",
4-
"description": "Visualize maps provided by an s3 datasource",
4+
"description": "Visualize image files for indoor maps.",
55
"scripts": {
66
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
77
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",

src/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Grafana Plugin: Map Panel
22

3-
Visualize maps provided by an s3 datasource
3+
Visualize image files for indoor maps.
44

55
## Overview / Introduction
66

77
Panel that visualizes an indoor map (collection of layers of spatial data using the same frame of reference).
8-
9-
## Getting Started
10-
11-
This panel depends on URLs provided in a dataframe (see [grafanaplugin-s3-datasource](https://github.com/tailosinc/grafanaplugin-s3-datasource) as an example datasource).

src/components/ImageDisplayPanel.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ export const ImageDisplayPanel: React.FC<Props> = ({
1515
}) => {
1616
const styles = getStyles();
1717

18-
// TODO: we'll need get all values from the first data series into URLS to be displayed
19-
// First series will get the image to be displayed
20-
const displayUrl = data.series[0].fields[0].values.get(0);
21-
22-
// Second series will get a distinct download URL (if it exists)
23-
const downloadUrl = data.series.length > 1 ? data.series[1].fields[0].values.get(0) : displayUrl;
18+
const parsedData = JSON.parse(data.series[0].fields[0].values.get(0));
19+
const displayUrl = parsedData.layers.cleaning;
20+
const downloadUrl = parsedData.mapBundle ?? displayUrl;
2421

2522
const { states } = useMapData(displayUrl, width, height, options);
2623
const [displayDownload, setDisplayDownload] = useState(false);

src/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"keywords": [
88
"panel"
99
],
10-
"description": "Visualize maps provided by an s3 datasource",
10+
"description": "Visualize image files for indoor maps.",
1111
"author": {
1212
"name": "Tailos"
1313
},

0 commit comments

Comments
 (0)