Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watcher #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.env
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,36 @@ module.exports = {
root: true,
};
```

## Watcher

The watcher pushes any changes directly to [Grafana](https://github.com/grafana/grafana).

Create a `.env` file at the top level (in the same folder as this and package.json is) with the below contents.

```env
GRAFANA_URL=
GRAFANA_ORG_ID=
GRAFANA_TOKEN=
GRAFANA_FOLDER_UID=
```

Example configuration:

```env
GRAFANA_URL=http://localhost:3100
GRAFANA_ORG_ID="1"
GRAFANA_TOKEN="glsa_BXohudtWX0kgqXaXe0mDDUzOndfsIdxz_1b6fd716"
GRAFANA_FOLDER_UID=l3KqBxCMz
```

- (new) To create service account and add a token to a service account follow this guide from Grafana [Service accounts](https://grafana.com/docs/grafana/latest/administration/service-accounts/).
- (old) To create a token follow this guide from Grafana [API Keys](https://grafana.com/docs/grafana/latest/administration/api-keys/).

Change the uid/title in the `panel.json` file.

Run

```bash
pnpm run watch
```
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- ONLY USED DURING DEV -->

<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
65 changes: 35 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "run-s validate build:rollup build:custom-properties build:html build:panel-options",
"build:rollup": "rollup -c rollup.config.js --environment NODE_ENV:production",
Expand All @@ -15,41 +16,45 @@
"lint:eslint": "eslint .",
"lint:prettier": "prettier --check .",
"typecheck": "tsc --noEmit",
"validate": "run-s typecheck lint"
"validate": "run-s typecheck lint",
"watch": "node ./scripts/watch.js"
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/preset-env": "^7.19.1",
"@babel/preset-typescript": "^7.18.6",
"@grafana/data": "^9.1.6",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"autoprefixer": "^10.4.12",
"babel-preset-solid": "^1.5.6",
"cssnano": "^5.1.13",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.1",
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@grafana/data": "^10.1.1",
"@grafana/runtime": "^10.1.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"autoprefixer": "^10.4.16",
"babel-preset-solid": "^1.8.4",
"chokidar": "^3.5.3",
"cssnano": "^6.0.1",
"dotenv": "^16.3.1",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-solid": "^0.7.3",
"eslint-plugin-unicorn": "^43.0.2",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-solid": "^0.13.0",
"eslint-plugin-unicorn": "^49.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.16",
"prettier": "^2.7.1",
"rollup": "^2.79.1",
"postcss": "^8.4.31",
"prettier": "^3.0.3",
"rollup": "^4.2.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.34.0",
"solid-js": "^1.5.6",
"tailwindcss": "^3.1.8",
"typescript": "^4.8.2",
"vite": "^3.1.3",
"vite-plugin-solid": "2.1.2",
"vite-tsconfig-paths": "^3.5.0"
"rollup-plugin-typescript2": "^0.36.0",
"solid-js": "^1.8.5",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"vite-plugin-solid": "2.7.2",
"vite-tsconfig-paths": "^4.2.1"
}
}
22 changes: 22 additions & 0 deletions panel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"panels": [
{
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"gridPos": {
"h": 34,
"w": 24,
"x": 0,
"y": 0
},
"id": 1,
"options": {},
"title": "Panel Title",
"type": "gapit-htmlgraphics-panel"
}
],
"title": "New dashboards",
"uid": "c9833241-ba3e-46d6-a0a0-75071898d0ff"
}
Loading