Skip to content

Commit

Permalink
Merge pull request #181 from stephenyeargin/feature/ship-typings
Browse files Browse the repository at this point in the history
Feature/ship typings
  • Loading branch information
KeesCBakker committed Apr 30, 2024
2 parents c932fe4 + 5ccf881 commit b7a302a
Show file tree
Hide file tree
Showing 7 changed files with 898 additions and 746 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"vscode": {
"extensions": [
"esbenp.prettier-vscode",
"GitHub.copilot"
"GitHub.copilot",
"streetsidesoftware.code-spell-checker"
]
}
}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ coverage.json

# Node versions (nodenv)
.node-version
.vscode/settings.json

# npm pack result
*.tgz
Expand Down
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"cSpell.words": [
"autofitpanels",
"datasource",
"gnet",
"linewidth",
"pointradius",
"sparkline",
"stephenyeargin",
"templating",
"xaxis",
"yaxes",
"yaxis",
"Yeargin"
]
}
1,585 changes: 860 additions & 725 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hubot-grafana",
"description": "Query Grafana dashboards",
"version": "6.0.0",
"version": "6.0.1",
"author": "Stephen Yeargin <stephen@yearg.in>",
"license": "MIT",
"keywords": [
Expand All @@ -18,31 +18,31 @@
"url": "https://github.com/stephenyeargin/hubot-grafana/issues"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.378.0",
"node-fetch": "^2.6.12"
"@aws-sdk/client-s3": "^3.565.0",
"node-fetch": "^2.7.0"
},
"peerDependencies": {
"hubot": ">=3 || 0.0.0-development"
},
"devDependencies": {
"@types/hubot": "^3.3.2",
"chai": "^4.3.7",
"@types/hubot": "^3.3.7",
"chai": "^4.4.1",
"eslint": "^8.45.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.27.5",
"hubot": "^7.0.0",
"hubot-mock-adapter": "^2.0.0",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"nock": "^13.3.2",
"husky": "^9.0.11",
"mocha": "^10.4.0",
"nock": "^13.5.4",
"nyc": "^15.1.0"
},
"main": "index.js",
"scripts": {
"test": "mocha \"test/**/*.js\" --reporter spec --no-experiemental-fetch --timeout 200",
"test": "mocha \"test/**/*.js\" --reporter spec --no-experimental-fetch --timeout 200",
"test-with-coverage": "nyc --reporter=text mocha \"test/**/*.js\" --reporter spec",
"bootstrap": "script/bootstrap",
"prepare": "husky install",
"prepare": "husky",
"lint": "eslint src/ test/"
},
"files": [
Expand All @@ -54,5 +54,6 @@
],
"volta": {
"node": "18.19.0"
}
},
"types": "types.d.ts"
}
12 changes: 6 additions & 6 deletions src/grafana-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ class GrafanaClient {
});
}

createGrafanaChartLink(query, uid, panel, timespan, variables) {
createGrafanaChartLink(query, uid, panel, timeSpan, variables) {
const url = new URL(`${this.host}/d/${uid}/`);

if (panel) {
url.searchParams.set('panelId', panel.id);
url.searchParams.set('fullscreen', '');
}

url.searchParams.set('from', timespan.from);
url.searchParams.set('to', timespan.to);
url.searchParams.set('from', timeSpan.from);
url.searchParams.set('to', timeSpan.to);

if (variables) {
const additionalParams = new URLSearchParams(variables);
Expand All @@ -150,7 +150,7 @@ class GrafanaClient {
return url.toString().replace('fullscreen=&', 'fullscreen&');
}

createImageUrl(query, uid, panel, timespan, variables) {
createImageUrl(query, uid, panel, timeSpan, variables) {
const url = new URL(`${this.host}/render/${query.apiEndpoint}/${uid}/`);

if (panel) {
Expand All @@ -162,8 +162,8 @@ class GrafanaClient {

url.searchParams.set('width', query.width);
url.searchParams.set('height', query.height);
url.searchParams.set('from', timespan.from);
url.searchParams.set('to', timespan.to);
url.searchParams.set('from', timeSpan.from);
url.searchParams.set('to', timeSpan.to);

if (variables) {
const additionalParams = new URLSearchParams(variables);
Expand Down
4 changes: 2 additions & 2 deletions types.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
type DashboardChart = {
imageUrl: string;
grafanaChartLink: grafanaChartLink;
grafanaChartLink: string;
title: string;
};

namespace GrafanaDashboardResponse {
declare namespace GrafanaDashboardResponse {
type Response = {
meta: Meta;
dashboard: Dashboard;
Expand Down

0 comments on commit b7a302a

Please sign in to comment.