mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
Home dashboard per user per org works
This commit is contained in:
parent
66621d762e
commit
4fbe954a79
@ -162,7 +162,7 @@ func Register(r *macaron.Macaron) {
|
||||
|
||||
// Preferences
|
||||
r.Group("/preferences", func() {
|
||||
r.Get("/", wrap(GetPreferences))
|
||||
r.Get("/", GetPreferences)
|
||||
r.Put("/", bind(m.SavePreferencesCommand{}), wrap(SavePreferences))
|
||||
r.Post("/set-home-dash", bind(m.SavePreferencesCommand{}), wrap(SetHomeDashboard))
|
||||
})
|
||||
|
@ -7,11 +7,25 @@ function (coreModule) {
|
||||
coreModule.default.controller('LoadDashboardCtrl', function($scope, $routeParams, dashboardLoaderSrv, backendSrv) {
|
||||
|
||||
if (!$routeParams.slug) {
|
||||
backendSrv.get('/api/dashboards/home').then(function(result) {
|
||||
var meta = result.meta;
|
||||
meta.canSave = meta.canShare = meta.canStar = false;
|
||||
$scope.initDashboard(result, $scope);
|
||||
|
||||
backendSrv.get('/api/preferences').then(function(preferences) {
|
||||
if (preferences !== null && preferences.homeDashboardId !== 0) {
|
||||
backendSrv.get('/api/dashboards/id/' + preferences.homeDashboardId).then(function(dashSlug) {
|
||||
$routeParams.type = 'db';
|
||||
$routeParams.slug = dashSlug.slug;
|
||||
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
|
||||
$scope.initDashboard(result, $scope);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
backendSrv.get('/api/dashboards/home').then(function(result) {
|
||||
var meta = result.meta;
|
||||
meta.canSave = meta.canShare = meta.canStar = false;
|
||||
$scope.initDashboard(result, $scope);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user