Commit e5c11691 by Torkel Ödegaard

HTTP API: GET /api/dashboards/db/:slug response changed property to to match…

HTTP API: GET /api/dashboards/db/:slug response changed property  to  to match the POST request nameing, Fixes #1928
parent 38d851eb
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
- [Issue #1891](https://github.com/grafana/grafana/issues/1891). Security: New config option to disable the use of gravatar for profile images - [Issue #1891](https://github.com/grafana/grafana/issues/1891). Security: New config option to disable the use of gravatar for profile images
- [Issue #1921](https://github.com/grafana/grafana/issues/1921). Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER) - [Issue #1921](https://github.com/grafana/grafana/issues/1921). Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER)
**Breaking changes**
- [Issue #1928](https://github.com/grafana/grafana/issues/1928). HTTP API: GET /api/dashboards/db/:slug response changed property `model` to `dashboard` to match the POST request nameing
# 2.0.3 (unreleased - 2.0.x branch) # 2.0.3 (unreleased - 2.0.x branch)
**Fixes** **Fixes**
......
...@@ -46,8 +46,8 @@ func GetDashboard(c *middleware.Context) { ...@@ -46,8 +46,8 @@ func GetDashboard(c *middleware.Context) {
} }
dash := query.Result dash := query.Result
dto := dtos.Dashboard{ dto := dtos.DashboardFullWithMeta{
Model: dash.Data, Dashboard: dash.Data,
Meta: dtos.DashboardMeta{IsStarred: isStarred, Slug: slug}, Meta: dtos.DashboardMeta{IsStarred: isStarred, Slug: slug},
} }
...@@ -108,10 +108,10 @@ func GetHomeDashboard(c *middleware.Context) { ...@@ -108,10 +108,10 @@ func GetHomeDashboard(c *middleware.Context) {
return return
} }
dash := dtos.Dashboard{} dash := dtos.DashboardFullWithMeta{}
dash.Meta.IsHome = true dash.Meta.IsHome = true
jsonParser := json.NewDecoder(file) jsonParser := json.NewDecoder(file)
if err := jsonParser.Decode(&dash.Model); err != nil { if err := jsonParser.Decode(&dash.Dashboard); err != nil {
c.JsonApiErr(500, "Failed to load home dashboard", err) c.JsonApiErr(500, "Failed to load home dashboard", err)
return return
} }
......
...@@ -45,8 +45,8 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho ...@@ -45,8 +45,8 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho
} }
func GetDashboardSnapshot(c *middleware.Context) { func GetDashboardSnapshot(c *middleware.Context) {
key := c.Params(":key")
key := c.Params(":key")
query := &m.GetDashboardSnapshotQuery{Key: key} query := &m.GetDashboardSnapshotQuery{Key: key}
err := bus.Dispatch(query) err := bus.Dispatch(query)
...@@ -63,8 +63,8 @@ func GetDashboardSnapshot(c *middleware.Context) { ...@@ -63,8 +63,8 @@ func GetDashboardSnapshot(c *middleware.Context) {
return return
} }
dto := dtos.Dashboard{ dto := dtos.DashboardFullWithMeta{
Model: snapshot.Dashboard, Dashboard: snapshot.Dashboard,
Meta: dtos.DashboardMeta{ Meta: dtos.DashboardMeta{
IsSnapshot: true, IsSnapshot: true,
Created: snapshot.Created, Created: snapshot.Created,
......
...@@ -37,9 +37,9 @@ type DashboardMeta struct { ...@@ -37,9 +37,9 @@ type DashboardMeta struct {
Created time.Time `json:"created"` Created time.Time `json:"created"`
} }
type Dashboard struct { type DashboardFullWithMeta struct {
Meta DashboardMeta `json:"meta"` Meta DashboardMeta `json:"meta"`
Model map[string]interface{} `json:"model"` Dashboard map[string]interface{} `json:"dashboard"`
} }
type DataSource struct { type DataSource struct {
......
...@@ -40,7 +40,7 @@ function (angular, $, config) { ...@@ -40,7 +40,7 @@ function (angular, $, config) {
$rootScope.performance.panelsInitialized = 0; $rootScope.performance.panelsInitialized = 0;
$rootScope.performance.panelsRendered = 0; $rootScope.performance.panelsRendered = 0;
var dashboard = dashboardSrv.create(data.model, data.meta); var dashboard = dashboardSrv.create(data.dashboard, data.meta);
// init services // init services
timeSrv.init(dashboard); timeSrv.init(dashboard);
......
...@@ -41,7 +41,7 @@ function (angular, $) { ...@@ -41,7 +41,7 @@ function (angular, $) {
}; };
$scope.initPanelScope = function(dashData) { $scope.initPanelScope = function(dashData) {
$scope.dashboard = dashboardSrv.create(dashData.model, dashData.meta); $scope.dashboard = dashboardSrv.create(dashData.dashboard, dashData.meta);
$scope.row = { $scope.row = {
height: ($(window).height() - 10) + 'px', height: ($(window).height() - 10) + 'px',
......
...@@ -13,7 +13,7 @@ function (angular, _, kbn, moment, $) { ...@@ -13,7 +13,7 @@ function (angular, _, kbn, moment, $) {
module.controller('DashFromDBCtrl', function($scope, $routeParams, backendSrv) { module.controller('DashFromDBCtrl', function($scope, $routeParams, backendSrv) {
function dashboardLoadFailed(title) { function dashboardLoadFailed(title) {
$scope.initDashboard({meta: {}, model: {title: title}}, $scope); $scope.initDashboard({meta: {}, dashboard: {title: title}}, $scope);
} }
if (!$routeParams.slug) { if (!$routeParams.slug) {
...@@ -46,7 +46,7 @@ function (angular, _, kbn, moment, $) { ...@@ -46,7 +46,7 @@ function (angular, _, kbn, moment, $) {
canSave: false, canSave: false,
canEdit: false, canEdit: false,
}, },
model: { dashboard: {
title: 'Snapshot not found' title: 'Snapshot not found'
} }
}, $scope); }, $scope);
...@@ -61,14 +61,14 @@ function (angular, _, kbn, moment, $) { ...@@ -61,14 +61,14 @@ function (angular, _, kbn, moment, $) {
} }
$scope.initDashboard({ $scope.initDashboard({
meta: { canShare: false, canStar: false }, meta: { canShare: false, canStar: false },
model: window.grafanaImportDashboard dashboard: window.grafanaImportDashboard
}, $scope); }, $scope);
}); });
module.controller('NewDashboardCtrl', function($scope) { module.controller('NewDashboardCtrl', function($scope) {
$scope.initDashboard({ $scope.initDashboard({
meta: { canStar: false, canShare: false }, meta: { canStar: false, canShare: false },
model: { dashboard: {
title: "New dashboard", title: "New dashboard",
rows: [{ height: '250px', panels:[] }] rows: [{ height: '250px', panels:[] }]
}, },
...@@ -98,7 +98,7 @@ function (angular, _, kbn, moment, $) { ...@@ -98,7 +98,7 @@ function (angular, _, kbn, moment, $) {
file_load($routeParams.jsonFile).then(function(result) { file_load($routeParams.jsonFile).then(function(result) {
$scope.initDashboard({ $scope.initDashboard({
meta: { canSave: false, canDelete: false }, meta: { canSave: false, canDelete: false },
model: result dashboard: result
}, $scope); }, $scope);
}); });
...@@ -146,7 +146,7 @@ function (angular, _, kbn, moment, $) { ...@@ -146,7 +146,7 @@ function (angular, _, kbn, moment, $) {
script_load($routeParams.jsFile).then(function(result) { script_load($routeParams.jsFile).then(function(result) {
$scope.initDashboard({ $scope.initDashboard({
meta: {fromScript: true, canDelete: false, canSave: false}, meta: {fromScript: true, canDelete: false, canSave: false},
model: result.data dashboard: result.data
}, $scope); }, $scope);
}); });
......
...@@ -34,7 +34,7 @@ define([ ...@@ -34,7 +34,7 @@ define([
beforeEach(function() { beforeEach(function() {
var dashboard = { var dashboard = {
model: { dashboard: {
rows: [ rows: [
{ {
panels: [ panels: [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment