Skip to content

Commit

Permalink
Merge pull request #4 from weekendesk/pr/use_import_instead_of_create
Browse files Browse the repository at this point in the history
use the import api endpoint instead of the create one, so we can use templating
  • Loading branch information
mbenabda authored Jan 10, 2018
2 parents 8e85e4b + d2626a4 commit 80ecc58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class Controller {
handleConfigMapDeleted(configmap) {
this.grafana
.slug(dashboardManifest(configmap))
.then((slug) => { this.grafana.deleteDashboard.bind(this.grafana); return slug; })
.then((slug) => {
console.log("deleted dashboard", slug, "because configmap", identifier(configmap), "has been deleted");
.then(this.grafana.deleteDashboard.bind(this.grafana))
.then(() => {
console.log("the dashboard managed by configmap", identifier(configmap), "has been deleted");
})
.catch((error) => {
console.error("unable to delete dashboard for configmap", identifier(configmap), error);
Expand Down
6 changes: 3 additions & 3 deletions src/grafana.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ class Grafana {

createDashboard(dashboard) {
return this.client
.post("dashboards/db", Object.assign({}, dashboard, { overwrite: false }))
.post("dashboards/import", dashboard)
.then(unwrapResponse);
}

updateDashboard(dashboard) {
updateDashboard({ dashboard }) {
return this.client
.post("dashboards/db", Object.assign({}, dashboard, { overwrite: true }))
.post("dashboards/db", { dashboard })
.then(unwrapResponse);
}

Expand Down

0 comments on commit 80ecc58

Please sign in to comment.