mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 18:01:40 -06:00
HTTP API: GET /api/dashboards/db/:slug response changed property to to match the POST request nameing, Fixes #1928
This commit is contained in:
parent
38d851eb98
commit
e5c1169120
@ -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 #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)
|
||||
|
||||
**Fixes**
|
||||
|
@ -46,9 +46,9 @@ func GetDashboard(c *middleware.Context) {
|
||||
}
|
||||
|
||||
dash := query.Result
|
||||
dto := dtos.Dashboard{
|
||||
Model: dash.Data,
|
||||
Meta: dtos.DashboardMeta{IsStarred: isStarred, Slug: slug},
|
||||
dto := dtos.DashboardFullWithMeta{
|
||||
Dashboard: dash.Data,
|
||||
Meta: dtos.DashboardMeta{IsStarred: isStarred, Slug: slug},
|
||||
}
|
||||
|
||||
c.JSON(200, dto)
|
||||
@ -108,10 +108,10 @@ func GetHomeDashboard(c *middleware.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
dash := dtos.Dashboard{}
|
||||
dash := dtos.DashboardFullWithMeta{}
|
||||
dash.Meta.IsHome = true
|
||||
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)
|
||||
return
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapsho
|
||||
}
|
||||
|
||||
func GetDashboardSnapshot(c *middleware.Context) {
|
||||
key := c.Params(":key")
|
||||
|
||||
key := c.Params(":key")
|
||||
query := &m.GetDashboardSnapshotQuery{Key: key}
|
||||
|
||||
err := bus.Dispatch(query)
|
||||
@ -63,8 +63,8 @@ func GetDashboardSnapshot(c *middleware.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
dto := dtos.Dashboard{
|
||||
Model: snapshot.Dashboard,
|
||||
dto := dtos.DashboardFullWithMeta{
|
||||
Dashboard: snapshot.Dashboard,
|
||||
Meta: dtos.DashboardMeta{
|
||||
IsSnapshot: true,
|
||||
Created: snapshot.Created,
|
||||
|
@ -37,9 +37,9 @@ type DashboardMeta struct {
|
||||
Created time.Time `json:"created"`
|
||||
}
|
||||
|
||||
type Dashboard struct {
|
||||
Meta DashboardMeta `json:"meta"`
|
||||
Model map[string]interface{} `json:"model"`
|
||||
type DashboardFullWithMeta struct {
|
||||
Meta DashboardMeta `json:"meta"`
|
||||
Dashboard map[string]interface{} `json:"dashboard"`
|
||||
}
|
||||
|
||||
type DataSource struct {
|
||||
|
@ -40,7 +40,7 @@ function (angular, $, config) {
|
||||
$rootScope.performance.panelsInitialized = 0;
|
||||
$rootScope.performance.panelsRendered = 0;
|
||||
|
||||
var dashboard = dashboardSrv.create(data.model, data.meta);
|
||||
var dashboard = dashboardSrv.create(data.dashboard, data.meta);
|
||||
|
||||
// init services
|
||||
timeSrv.init(dashboard);
|
||||
|
@ -41,7 +41,7 @@ function (angular, $) {
|
||||
};
|
||||
|
||||
$scope.initPanelScope = function(dashData) {
|
||||
$scope.dashboard = dashboardSrv.create(dashData.model, dashData.meta);
|
||||
$scope.dashboard = dashboardSrv.create(dashData.dashboard, dashData.meta);
|
||||
|
||||
$scope.row = {
|
||||
height: ($(window).height() - 10) + 'px',
|
||||
|
@ -13,7 +13,7 @@ function (angular, _, kbn, moment, $) {
|
||||
module.controller('DashFromDBCtrl', function($scope, $routeParams, backendSrv) {
|
||||
|
||||
function dashboardLoadFailed(title) {
|
||||
$scope.initDashboard({meta: {}, model: {title: title}}, $scope);
|
||||
$scope.initDashboard({meta: {}, dashboard: {title: title}}, $scope);
|
||||
}
|
||||
|
||||
if (!$routeParams.slug) {
|
||||
@ -46,7 +46,7 @@ function (angular, _, kbn, moment, $) {
|
||||
canSave: false,
|
||||
canEdit: false,
|
||||
},
|
||||
model: {
|
||||
dashboard: {
|
||||
title: 'Snapshot not found'
|
||||
}
|
||||
}, $scope);
|
||||
@ -61,14 +61,14 @@ function (angular, _, kbn, moment, $) {
|
||||
}
|
||||
$scope.initDashboard({
|
||||
meta: { canShare: false, canStar: false },
|
||||
model: window.grafanaImportDashboard
|
||||
dashboard: window.grafanaImportDashboard
|
||||
}, $scope);
|
||||
});
|
||||
|
||||
module.controller('NewDashboardCtrl', function($scope) {
|
||||
$scope.initDashboard({
|
||||
meta: { canStar: false, canShare: false },
|
||||
model: {
|
||||
dashboard: {
|
||||
title: "New dashboard",
|
||||
rows: [{ height: '250px', panels:[] }]
|
||||
},
|
||||
@ -98,7 +98,7 @@ function (angular, _, kbn, moment, $) {
|
||||
file_load($routeParams.jsonFile).then(function(result) {
|
||||
$scope.initDashboard({
|
||||
meta: { canSave: false, canDelete: false },
|
||||
model: result
|
||||
dashboard: result
|
||||
}, $scope);
|
||||
});
|
||||
|
||||
@ -146,7 +146,7 @@ function (angular, _, kbn, moment, $) {
|
||||
script_load($routeParams.jsFile).then(function(result) {
|
||||
$scope.initDashboard({
|
||||
meta: {fromScript: true, canDelete: false, canSave: false},
|
||||
model: result.data
|
||||
dashboard: result.data
|
||||
}, $scope);
|
||||
});
|
||||
|
||||
|
@ -34,7 +34,7 @@ define([
|
||||
|
||||
beforeEach(function() {
|
||||
var dashboard = {
|
||||
model: {
|
||||
dashboard: {
|
||||
rows: [
|
||||
{
|
||||
panels: [
|
||||
|
Loading…
Reference in New Issue
Block a user