├── .nvmrc ├── .gitmodules ├── integration-test ├── datasets │ ├── download │ │ └── .gitkeep │ ├── non_default_auth_source.js │ ├── conversion_check.js │ ├── transactions.sh │ ├── tweets.sh │ └── weather.js ├── .gitignore ├── grafana.ini ├── kind.config.template ├── queries │ ├── conversion_check │ │ └── table.json │ ├── tweets │ │ ├── timeseries-auto-time-bound-end.json │ │ ├── timeseries-auto-time-bound-start.json │ │ ├── timeseries-auto-time-sort-time-bound-end.json │ │ ├── timeseries-auto-time-sort-time-bound-start.json │ │ ├── table-inference.json │ │ └── timeseries.json │ └── weather │ │ ├── timeseries.json │ │ ├── table.json │ │ └── timeseries-date.json ├── mongodb-certs.yaml ├── datasources.yaml ├── dashboards │ ├── weather.json │ ├── retweets.json │ └── transactions.json └── run.sh ├── .eslintrc ├── tsconfig.json ├── CHANGELOG.md ├── jest-setup.js ├── .config ├── webpack │ ├── constants.ts │ ├── utils.ts │ └── webpack.config.ts ├── .eslintrc ├── .prettierrc.js ├── types │ └── custom.d.ts ├── Dockerfile ├── tsconfig.json ├── jest-setup.js ├── jest │ ├── utils.js │ └── mocks │ │ └── react-inlinesvg.tsx ├── jest.config.js └── README.md ├── examples ├── bare-metal │ ├── grafana.ini │ └── install.sh ├── docker │ ├── bitnami │ │ └── install.sh │ └── official │ │ └── install.sh ├── helm │ └── bitnami │ │ └── install.sh ├── docker-compose │ ├── bitnami │ │ └── docker-compose.yaml │ └── official │ │ └── docker-compose.yaml ├── kubectl │ ├── bitnami │ │ └── deployment.yaml │ └── official │ │ └── deployment.yaml └── test.sh ├── .prettierrc.js ├── jest.config.js ├── Magefile.go ├── docker-compose.yaml ├── pkg ├── plugin │ ├── mongodb_test.go │ ├── plugin_suite_test.go │ ├── datasource.go │ ├── documents.go │ ├── plugin.go │ ├── schema.go │ ├── plugin_test.go │ ├── types.go │ ├── mongodb.go │ └── model.go └── main.go ├── TODO.md ├── src ├── module.ts ├── plugin.json ├── img │ └── logo.svg ├── types.ts ├── datasource.ts ├── VariableQueryEditor.tsx ├── ConfigEditor.tsx └── QueryEditor.tsx ├── .gitignore ├── .github └── workflows │ ├── build-plugin.yml │ ├── builder-images.yml │ └── ci.yml ├── go.mod ├── package.json ├── README.md └── e2e ├── e2e_test.go └── e2e_suite_test.go /.nvmrc: -------------------------------------------------------------------------------- 1 | 16 -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /integration-test/datasets/download/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.config/.eslintrc" 3 | } -------------------------------------------------------------------------------- /integration-test/.gitignore: -------------------------------------------------------------------------------- 1 | kubeconfig 2 | kind.config 3 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./.config/tsconfig.json" 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.1.0 (Unreleased) 4 | 5 | Initial release. 6 | -------------------------------------------------------------------------------- /jest-setup.js: -------------------------------------------------------------------------------- 1 | // Jest setup provided by Grafana scaffolding 2 | import './.config/jest-setup'; 3 | -------------------------------------------------------------------------------- /.config/webpack/constants.ts: -------------------------------------------------------------------------------- 1 | export const SOURCE_DIR = 'src'; 2 | export const DIST_DIR = 'dist'; 3 | -------------------------------------------------------------------------------- /examples/bare-metal/grafana.ini: -------------------------------------------------------------------------------- 1 | [plugins] 2 | allow_loading_unsigned_plugins=meln5674-mongodb-community 3 | -------------------------------------------------------------------------------- /examples/bare-metal/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xeu 2 | 3 | grafana-cli --pluginUrl "${ZIP_URL}" plugins install meln5674-mongodb-community 4 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // Prettier configuration provided by Grafana scaffolding 3 | ...require("./.config/.prettierrc.js") 4 | }; -------------------------------------------------------------------------------- /integration-test/grafana.ini: -------------------------------------------------------------------------------- 1 | [plugins] 2 | allow_loading_unsigned_plugins=meln5674-mongodb-community 3 | app_mode=development 4 | 5 | [log] 6 | level=debug 7 | 8 | -------------------------------------------------------------------------------- /examples/docker/bitnami/install.sh: -------------------------------------------------------------------------------- 1 | docker run \ 2 | -d \ 3 | -p 3000:3000 \ 4 | -e GF_INSTALL_PLUGINS="meln5674-mongodb-community=${ZIP_URL}" \ 5 | -e GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=meln5674-mongodb-community \ 6 | bitnami/grafana:latest 7 | -------------------------------------------------------------------------------- /examples/helm/bitnami/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xeu 2 | 3 | helm repo add bitnami https://charts.bitnami.com/bitnami 4 | helm upgrade \ 5 | --wait --install --debug \ 6 | grafana bitnami/grafana \ 7 | --set plugins="meln5674-mongodb-community=${ZIP_URL}" 8 | -------------------------------------------------------------------------------- /examples/docker/official/install.sh: -------------------------------------------------------------------------------- 1 | docker run \ 2 | -d \ 3 | -p 3000:3000 \ 4 | -e GF_INSTALL_PLUGINS="${ZIP_URL};meln5674-mongodb-community" \ 5 | -e GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=meln5674-mongodb-community \ 6 | grafana/grafana-oss:latest 7 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // force timezone to UTC to allow tests to work regardless of local timezone 2 | // generally used by snapshots, but can affect specific tests 3 | process.env.TZ = 'UTC'; 4 | 5 | module.exports = { 6 | // Jest configuration provided by Grafana scaffolding 7 | ...require('./.config/jest.config'), 8 | }; 9 | -------------------------------------------------------------------------------- /examples/docker-compose/bitnami/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | grafana: 2 | image: bitnami/grafana:latest 3 | restart: unless-stopped 4 | ports: 5 | - "3000:3000" 6 | environment: 7 | - "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=meln5674-mongodb-community" 8 | - "GF_INSTALL_PLUGINS=meln5674-mongodb-community=${ZIP_URL}" 9 | -------------------------------------------------------------------------------- /examples/docker-compose/official/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | grafana: 2 | image: grafana/grafana-oss:latest 3 | restart: unless-stopped 4 | ports: 5 | - "3000:3000" 6 | environment: 7 | - "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=meln5674-mongodb-community" 8 | - "GF_INSTALL_PLUGINS=${ZIP_URL};meln5674-mongodb-community" 9 | -------------------------------------------------------------------------------- /integration-test/datasets/non_default_auth_source.js: -------------------------------------------------------------------------------- 1 | use non_default_auth_source; 2 | 3 | db.test.insert({"test": 1}); 4 | 5 | db.createUser({ 6 | user: "test-user", 7 | pwd: "test-password", 8 | roles: [ 9 | { role: "readWrite", db: "test"}, 10 | { role: "readWrite", db: "twitter"}, 11 | ], 12 | }); 13 | -------------------------------------------------------------------------------- /Magefile.go: -------------------------------------------------------------------------------- 1 | //+build mage 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | // mage:import 8 | build "github.com/grafana/grafana-plugin-sdk-go/build" 9 | ) 10 | 11 | // Hello prints a message (shows that you can define custom Mage targets). 12 | func Hello() { 13 | fmt.Println("hello plugin developer!") 14 | } 15 | 16 | // Default configures the default target. 17 | var Default = build.BuildAll 18 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.0' 2 | 3 | services: 4 | grafana: 5 | container_name: 'meln5674-mongodb-community' 6 | build: 7 | context: ./.config 8 | args: 9 | grafana_version: ${GRAFANA_VERSION:-9.3.8} 10 | ports: 11 | - 3000:3000/tcp 12 | volumes: 13 | - ./dist:/var/lib/grafana/plugins/meln5674-mongodb-community 14 | - ./provisioning:/etc/grafana/provisioning 15 | -------------------------------------------------------------------------------- /integration-test/kind.config.template: -------------------------------------------------------------------------------- 1 | kind: Cluster 2 | apiVersion: kind.x-k8s.io/v1alpha4 3 | name: meln5674-mongodb-community-it 4 | nodes: 5 | - role: control-plane 6 | extraMounts: 7 | - hostPath: {{ .Pwd }}/.. # This is run from ./e2e 8 | containerPath: /mnt/host/grafana-mongodb-community-plugin 9 | extraPortMappings: 10 | - containerPort: 8080 11 | hostPort: 8080 12 | listenAddress: "127.0.0.1" 13 | -------------------------------------------------------------------------------- /.config/.eslintrc: -------------------------------------------------------------------------------- 1 | /* 2 | * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ 3 | * 4 | * In order to extend the configuration follow the steps in 5 | * https://grafana.github.io/plugin-tools/docs/advanced-configuration#extending-the-eslint-config 6 | */ 7 | { 8 | "extends": ["@grafana/eslint-config"], 9 | "root": true, 10 | "rules": { 11 | "react/prop-types": "off" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.config/.prettierrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️ 3 | * 4 | * In order to extend the configuration follow the steps in .config/README.md 5 | */ 6 | 7 | module.exports = { 8 | "endOfLine": "auto", 9 | "printWidth": 120, 10 | "trailingComma": "es5", 11 | "semi": true, 12 | "jsxSingleQuote": false, 13 | "singleQuote": true, 14 | "useTabs": false, 15 | "tabWidth": 2 16 | }; -------------------------------------------------------------------------------- /pkg/plugin/mongodb_test.go: -------------------------------------------------------------------------------- 1 | package plugin_test 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/meln5674/grafana-mongodb-community-plugin/pkg/plugin" 7 | 8 | . "github.com/onsi/ginkgo/v2" 9 | . "github.com/onsi/gomega" 10 | ) 11 | 12 | var _ = Describe("ConvertGoTimeFormatToMongo", func() { 13 | It("Should convert a truncated ruby date", func() { 14 | converted, err := plugin.ConvertGoTimeFormatToMongo(time.RubyDate[4:]) 15 | Expect(err).ToNot(HaveOccurred()) 16 | Expect(converted).To(Equal("%b %d %H:%M:%S %z %Y")) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /integration-test/datasets/conversion_check.js: -------------------------------------------------------------------------------- 1 | db.createCollection( 2 | "conversion_check", 3 | ); 4 | 5 | 6 | db.conversion_check.insertMany( [ 7 | { 8 | "int": 1, 9 | "float": 2.5, 10 | "string": "Hello, world!", 11 | "bool": true, 12 | "object": { "foo": 1, "bar": 2.5, "baz": "Hello, world!" }, 13 | "array": [1,2.5,"Hello, World!"], 14 | "datetime": Date(), 15 | "timestamp": Timestamp({"t": 0, "i": 0}), 16 | "decimal": Decimal128("10000.1"), 17 | }, 18 | ]); 19 | 20 | -------------------------------------------------------------------------------- /integration-test/queries/conversion_check/table.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"test","collection":"conversion_check","queryType":"Table","timestampField":"timestamp","timestampFormat":"","labelFields":["sensorID"],"legendFormat":"","valueFields":["array"],"valueFieldTypes":["json.RawMessage"],"aggregation":"[]","autoTimeBound":false,"autoTimeSort":false,"schemaInference":true,"schemaInferenceDepth":20,"datasourceId":1,"intervalMs":20000,"maxDataPoints":1042}],"from":"1697634865461","to":"1697656465461"} 2 | -------------------------------------------------------------------------------- /pkg/plugin/plugin_suite_test.go: -------------------------------------------------------------------------------- 1 | package plugin_test 2 | 3 | import ( 4 | "testing" 5 | 6 | bsonprim "go.mongodb.org/mongo-driver/bson/primitive" 7 | 8 | . "github.com/onsi/ginkgo/v2" 9 | . "github.com/onsi/gomega" 10 | ) 11 | 12 | func TestPlugin(t *testing.T) { 13 | RegisterFailHandler(Fail) 14 | RunSpecs(t, "Plugin Suite") 15 | } 16 | 17 | func init() { 18 | // We can't do this in Before{Suite,Each} because of how DescribeTable works 19 | var err error 20 | testDecimal, err = bsonprim.ParseDecimal128("12345.6789") 21 | if err != nil { 22 | panic(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # To Do List 2 | 3 | * More test datasets and queries 4 | * Support optional fields 5 | * Schema inference 6 | * Schema backtracking 7 | * Translate integration test job to use python requests isntead of curl, parse and verify output 8 | * Translate golang time format to mongodb format, use it for auto-sort and auto-clamp 9 | * Add a way to do a variable query for databases and collections 10 | * Find suggestions for database and collection fields 11 | * Do a 1-limit query to list all fields in an aggregation pipeline, use it to do suggestions for timestamp/label/value field fields 12 | -------------------------------------------------------------------------------- /src/module.ts: -------------------------------------------------------------------------------- 1 | import { DataSourcePlugin } from '@grafana/data'; 2 | import { DataSource } from './datasource'; 3 | import { ConfigEditor } from './ConfigEditor'; 4 | import { QueryEditor } from './QueryEditor'; 5 | import { VariableQueryEditor } from './VariableQueryEditor'; 6 | import { MongoDBQuery, MongoDBDataSourceOptions } from './types'; 7 | 8 | export const plugin = new DataSourcePlugin(DataSource) 9 | .setConfigEditor(ConfigEditor) 10 | .setQueryEditor(QueryEditor) 11 | .setVariableQueryEditor(VariableQueryEditor) 12 | ; 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | node_modules/ 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # Compiled binary addons (https://nodejs.org/api/addons.html) 23 | dist/ 24 | artifacts/ 25 | work/ 26 | ci/ 27 | e2e-results/ 28 | 29 | # Editor 30 | .idea 31 | 32 | *.swp 33 | *.zip 34 | 35 | integration-test/vendor 36 | integration-test/images 37 | integration-test/groups 38 | -------------------------------------------------------------------------------- /integration-test/queries/tweets/timeseries-auto-time-bound-end.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"twitter","collection":"tweets","queryType":"Timeseries","timestampField":"created_at","timestampFormat":"Jan 02 15:04:05 -0700 2006","labelFields":["sensorID"],"legendFormat":"","valueFields":["measurement"],"valueFieldTypes":["float64"],"aggregation":"[]","autoTimeBound":true,"autoTimeSort":false,"schemaInference":true,"schemaInferenceDepth":20,"autoTimeBoundAtStart":false,"datasourceId":1,"intervalMs":5000,"maxDataPoints":880}],"from":"1429974000000","to":"1429977600000"} 2 | -------------------------------------------------------------------------------- /integration-test/queries/tweets/timeseries-auto-time-bound-start.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"twitter","collection":"tweets","queryType":"Timeseries","timestampField":"created_at","timestampFormat":"Jan 02 15:04:05 -0700 2006","labelFields":["sensorID"],"legendFormat":"","valueFields":["measurement"],"valueFieldTypes":["float64"],"aggregation":"[]","autoTimeBound":true,"autoTimeSort":false,"schemaInference":true,"schemaInferenceDepth":20,"autoTimeBoundAtStart":true,"datasourceId":1,"intervalMs":5000,"maxDataPoints":880}],"from":"1429974000000","to":"1429977600000"} 2 | -------------------------------------------------------------------------------- /integration-test/queries/tweets/timeseries-auto-time-sort-time-bound-end.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"twitter","collection":"tweets","queryType":"Timeseries","timestampField":"created_at","timestampFormat":"Jan 02 15:04:05 -0700 2006","labelFields":["sensorID"],"legendFormat":"","valueFields":["measurement"],"valueFieldTypes":["float64"],"aggregation":"[]","autoTimeBound":true,"autoTimeSort":true,"schemaInference":true,"schemaInferenceDepth":20,"autoTimeBoundAtStart":false,"datasourceId":1,"intervalMs":5000,"maxDataPoints":880}],"from":"1429974000000","to":"1429977600000"} 2 | -------------------------------------------------------------------------------- /integration-test/queries/tweets/timeseries-auto-time-sort-time-bound-start.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"twitter","collection":"tweets","queryType":"Timeseries","timestampField":"created_at","timestampFormat":"Jan 02 15:04:05 -0700 2006","labelFields":["sensorID"],"legendFormat":"","valueFields":["measurement"],"valueFieldTypes":["float64"],"aggregation":"[]","autoTimeBound":true,"autoTimeSort":true,"schemaInference":true,"schemaInferenceDepth":20,"autoTimeBoundAtStart":true,"datasourceId":1,"intervalMs":5000,"maxDataPoints":880}],"from":"1429974000000","to":"1429977600000"} 2 | -------------------------------------------------------------------------------- /integration-test/datasets/transactions.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | MONGODB_CLIENT_EXTRA_FLAGS=${MONGODB_CLIENT_EXTRA_FLAGS:-} 3 | EXTRA_FLAGS="${MONGODB_CLIENT_EXTRA_FLAGS//--tls/--ssl}" 4 | EXTRA_FLAGS="${EXTRA_FLAGS//sslCertificateKeyFile/sslPEMKeyFile}" 5 | ARGS=( -d analytics -c transactions --file /mnt/host/grafana-mongodb-community-plugin/integration-test/datasets/download/transactions.json ${EXTRA_FLAGS} ) 6 | if [ "${ALLOW_EMPTY_PASSWORD}" != "yes" ]; then 7 | ARGS+=( 8 | --username "${MONGODB_ROOT_USER}" 9 | --password "${MONGODB_ROOT_PASSWORD}" 10 | --authenticationDatabase admin 11 | ) 12 | fi 13 | mongoimport \ 14 | "${ARGS[@]}" 15 | -------------------------------------------------------------------------------- /integration-test/queries/tweets/table-inference.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"refId":"A","datasource":{"type":"meln5674-mongodb-community","uid":"P1CC9A79BDAF09793"},"database":"twitter","collection":"tweets","queryType":"Table","timestampField":"timestamp","timestampFormat":"","labelFields":["sensorID"],"valueFields":[],"valueFieldTypes":[],"aggregation":"[]","autoTimeBound":false,"autoTimeSort":false,"schemaInference":true,"schemaInferenceDepth":382,"key":"Q-62dca40d-95a4-4e76-8688-9bc0839500f3-0","datasourceId":1,"intervalMs":2000,"maxDataPoints":1271}],"range":{"from":"2023-01-16T20:51:03.726Z","to":"2023-01-16T21:51:03.726Z","raw":{"from":"now-1h","to":"now"}},"from":"1673902263726","to":"1673905863726"} 2 | -------------------------------------------------------------------------------- /examples/kubectl/bitnami/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: grafana 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: grafana 9 | template: 10 | metadata: 11 | labels: 12 | app: grafana 13 | spec: 14 | restartPolicy: Always 15 | containers: 16 | - name: grafana 17 | image: bitnami/grafana:latest 18 | env: 19 | - name: ZIP_URL 20 | value: ${ZIP_URL} # !!! You must manually set this in this file 21 | - name: GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS 22 | value: meln5674-mongodb-community 23 | - name: GF_INSTALL_PLUGINS 24 | value: meln5674-mongodb-community=$(ZIP_URL) 25 | -------------------------------------------------------------------------------- /examples/kubectl/official/deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: grafana 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: grafana 9 | template: 10 | metadata: 11 | labels: 12 | app: grafana 13 | spec: 14 | restartPolicy: Always 15 | containers: 16 | - name: grafana 17 | image: grafana/grafana-oss:latest 18 | env: 19 | - name: ZIP_URL 20 | value: ${ZIP_URL} # !!! You must manually set this in this file 21 | - name: GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS 22 | value: meln5674-mongodb-community 23 | - name: GF_INSTALL_PLUGINS 24 | value: $(ZIP_URL);meln5674-mongodb-community 25 | -------------------------------------------------------------------------------- /integration-test/queries/weather/timeseries.json: -------------------------------------------------------------------------------- 1 | {"queries":[{"database":"test","collection":"weather","timestampField":"timestamp","labelFields":["sensorID"],"valueFields":["temperature","foo"],"valueFieldTypes":["int32","int64"],"aggregation":"[{ \"$project\": { \"timestamp\": 1, \"sensorID\": \"$metadata.sensorId\", \"temperature\": \"$temp\", \"foo\": { \"$literal\" : 1621296000000 } }}]","refId":"A","key":"Q-1658634116513-0.7764272519013262-0","maxDataPoints":681,"liveStreaming":false,"showingGraph":true,"showingTable":true,"datasourceId":1,"intervalMs":300000,"orgId":1}],"range":{"from":"2021-05-18T00:00:00.000Z","to":"2021-05-19T20:00:00.000Z","raw":{"from":"2021-05-18T00:00:00.000Z","to":"2021-05-19T20:00:00.000Z"}},"from":"1621296000000","to":"1621454400000"} 2 | -------------------------------------------------------------------------------- /.config/types/custom.d.ts: -------------------------------------------------------------------------------- 1 | // Image declarations 2 | declare module '*.gif' { 3 | const src: string; 4 | export default src; 5 | } 6 | 7 | declare module '*.jpg' { 8 | const src: string; 9 | export default src; 10 | } 11 | 12 | declare module '*.jpeg' { 13 | const src: string; 14 | export default src; 15 | } 16 | 17 | declare module '*.png' { 18 | const src: string; 19 | export default src; 20 | } 21 | 22 | declare module '*.webp' { 23 | const src: string; 24 | export default src; 25 | } 26 | 27 | declare module '*.svg' { 28 | const content: string; 29 | export default content; 30 | } 31 | 32 | // Font declarations 33 | declare module '*.woff'; 34 | declare module '*.woff2'; 35 | declare module '*.eot'; 36 | declare module '*.ttf'; 37 | declare module '*.otf'; 38 | -------------------------------------------------------------------------------- /.config/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG grafana_version=latest 2 | ARG grafana_image=grafana-enterprise 3 | 4 | FROM grafana/${grafana_image}:${grafana_version} 5 | 6 | # Make it as simple as possible to access the grafana instance for development purposes 7 | # Do NOT enable these settings in a public facing / production grafana instance 8 | ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin" 9 | ENV GF_AUTH_ANONYMOUS_ENABLED "true" 10 | ENV GF_AUTH_BASIC_ENABLED "false" 11 | # Set development mode so plugins can be loaded without the need to sign 12 | ENV GF_DEFAULT_APP_MODE "development" 13 | 14 | # Inject livereload script into grafana index.html 15 | USER root 16 | RUN sed -i 's/<\/body><\/html>/