diff --git a/src/controller.js b/src/controller.js index 498aad2..99fab25 100644 --- a/src/controller.js +++ b/src/controller.js @@ -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); diff --git a/src/grafana.js b/src/grafana.js index 1ff71b1..f783793 100644 --- a/src/grafana.js +++ b/src/grafana.js @@ -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); }