hubot-grafana 3.2.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +16 -0
- package/.github/workflows/nodejs.yml +13 -4
- package/README.md +1 -2
- package/index.js +21 -0
- package/package.json +15 -12
- package/script/bootstrap +1 -4
- package/script/test +1 -1
- package/src/grafana.js +735 -0
- package/test/adapters/rocketchat.js +3 -0
- package/test/adapters/slack.js +3 -0
- package/test/grafana-rocketchat-test.js +143 -0
- package/test/grafana-s3-test.js +83 -0
- package/test/grafana-slack-test.js +143 -0
- package/test/grafana-v8-test.js +291 -0
- package/test/mocha.opts +1 -3
- package/test/per-room-configuration-test.js +94 -0
- package/test/static-configuration-test.js +67 -0
- package/test/test_helper.js +2 -0
- package/test/timezone-test.js +71 -0
- package/index.coffee +0 -11
- package/src/grafana.coffee +0 -638
- package/test/adapters/rocketchat.coffee +0 -4
- package/test/adapters/slack.coffee +0 -4
- package/test/grafana-rocketchat-test.coffee +0 -120
- package/test/grafana-s3-test.coffee +0 -128
- package/test/grafana-slack-test.coffee +0 -115
- package/test/grafana-v8-test.coffee +0 -265
- package/test/per-room-configuration-test.coffee +0 -84
- package/test/static-configuration-test.coffee +0 -54
- package/test/test_helper.coffee +0 -2
- package/test/timezone-test.coffee +0 -58
package/.eslintrc.js
ADDED
|
@@ -8,19 +8,28 @@ jobs:
|
|
|
8
8
|
runs-on: ubuntu-latest
|
|
9
9
|
|
|
10
10
|
strategy:
|
|
11
|
+
fail-fast: false
|
|
11
12
|
matrix:
|
|
12
|
-
node-version: [
|
|
13
|
+
node-version: [16.x, 18.x, 20.x]
|
|
13
14
|
|
|
14
15
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
|
|
16
18
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
17
|
-
uses: actions/setup-node@
|
|
19
|
+
uses: actions/setup-node@v3
|
|
18
20
|
with:
|
|
19
21
|
node-version: ${{ matrix.node-version }}
|
|
20
|
-
|
|
22
|
+
|
|
23
|
+
- name: npm install, build
|
|
21
24
|
run: |
|
|
22
25
|
npm ci
|
|
23
26
|
npm run build --if-present
|
|
27
|
+
env:
|
|
28
|
+
CI: true
|
|
29
|
+
|
|
30
|
+
- name: npm test
|
|
31
|
+
run: |
|
|
24
32
|
npm test
|
|
25
33
|
env:
|
|
26
34
|
CI: true
|
|
35
|
+
|
package/README.md
CHANGED
|
@@ -60,8 +60,7 @@ export HUBOT_GRAFANA_HOST=https://play.grafana.org
|
|
|
60
60
|
export HUBOT_GRAFANA_API_KEY=abcd01234deadbeef01234
|
|
61
61
|
export HUBOT_GRAFANA_QUERY_TIME_RANGE=1h
|
|
62
62
|
export HUBOT_GRAFANA_S3_BUCKET=mybucket
|
|
63
|
-
export
|
|
64
|
-
export HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY=aBcD01234dEaDbEef01234
|
|
63
|
+
export HUBOT_GRAFANA_S3_BUCKET_REGION=us-east-1
|
|
65
64
|
export HUBOT_GRAFANA_S3_PREFIX=graphs
|
|
66
65
|
```
|
|
67
66
|
|
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
module.exports = function(robot, scripts) {
|
|
5
|
+
const scriptsPath = path.resolve(__dirname, 'src');
|
|
6
|
+
if (fs.existsSync(scriptsPath)) {
|
|
7
|
+
return (() => {
|
|
8
|
+
const result = [];
|
|
9
|
+
for (let script of Array.from(fs.readdirSync(scriptsPath).sort())) {
|
|
10
|
+
if ((scripts != null) && !Array.from(scripts).includes('*')) {
|
|
11
|
+
if (Array.from(scripts).includes(script)) { result.push(robot.loadFile(scriptsPath, script)); } else {
|
|
12
|
+
result.push(undefined);
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
15
|
+
result.push(robot.loadFile(scriptsPath, script));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
})();
|
|
20
|
+
}
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hubot-grafana",
|
|
3
3
|
"description": "Query Grafana dashboards",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"author": "Stephen Yeargin <stephen@yearg.in>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -18,29 +18,32 @@
|
|
|
18
18
|
"url": "https://github.com/stephenyeargin/hubot-grafana/issues"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"
|
|
21
|
+
"@aws-sdk/client-s3": "^3.370.0",
|
|
22
22
|
"request": "^2.88.2"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"hubot": "
|
|
25
|
+
"hubot": ">=2 <10 || 0.0.0-development"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"chai": "^4.3.7",
|
|
29
|
-
"
|
|
29
|
+
"eslint": "^8.45.0",
|
|
30
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
31
|
+
"eslint-plugin-import": "^2.27.5",
|
|
30
32
|
"hubot-test-helper": "^1.9.0",
|
|
31
|
-
"husky": "^8.0.
|
|
32
|
-
"mocha": "^10.
|
|
33
|
-
"nock": "^13.2
|
|
34
|
-
"release-it": "^
|
|
33
|
+
"husky": "^8.0.3",
|
|
34
|
+
"mocha": "^10.2.0",
|
|
35
|
+
"nock": "^13.3.2",
|
|
36
|
+
"release-it": "^16.1.0",
|
|
35
37
|
"require-dir": "^1.2.0",
|
|
36
|
-
"sinon": "^15.
|
|
38
|
+
"sinon": "^15.2.0",
|
|
37
39
|
"sinon-chai": "^3.7.0",
|
|
38
40
|
"travis-cov": "^0.2.5"
|
|
39
41
|
},
|
|
40
|
-
"main": "index.
|
|
42
|
+
"main": "index.js",
|
|
41
43
|
"scripts": {
|
|
42
44
|
"release": "release-it",
|
|
43
|
-
"test": "mocha
|
|
44
|
-
"prepare": "husky install"
|
|
45
|
+
"test": "mocha \"test/**/*.js\" --reporter spec",
|
|
46
|
+
"prepare": "husky install",
|
|
47
|
+
"lint": "eslint src/ test/"
|
|
45
48
|
}
|
|
46
49
|
}
|
package/script/bootstrap
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export NODE_ENV=development
|
|
5
5
|
|
|
6
6
|
# Load environment specific environment variables
|
|
7
|
-
if [ -f .env ]; then
|
|
7
|
+
if [ -f .env ]; then
|
|
8
8
|
source .env
|
|
9
9
|
fi
|
|
10
10
|
|
|
@@ -13,6 +13,3 @@ if [ -f .env.${NODE_ENV} ]; then
|
|
|
13
13
|
fi
|
|
14
14
|
|
|
15
15
|
npm install
|
|
16
|
-
|
|
17
|
-
# Make sure coffee and mocha are on the path
|
|
18
|
-
export PATH="node_modules/.bin:$PATH"
|
package/script/test
CHANGED