2015-03-02 15:24:01 -06:00
|
|
|
define([
|
2015-09-15 01:52:53 -05:00
|
|
|
'../core_module',
|
2015-03-02 15:24:01 -06:00
|
|
|
],
|
2015-09-15 01:52:53 -05:00
|
|
|
function (coreModule) {
|
2015-03-02 15:24:01 -06:00
|
|
|
"use strict";
|
|
|
|
|
2016-03-20 05:52:19 -05:00
|
|
|
coreModule.default.controller('LoadDashboardCtrl', function($scope, $routeParams, dashboardLoaderSrv, backendSrv, $location) {
|
2016-06-16 01:28:50 -05:00
|
|
|
$scope.appEvent("dashboard-fetch-start");
|
2015-03-02 15:24:01 -06:00
|
|
|
|
|
|
|
if (!$routeParams.slug) {
|
2016-03-20 05:52:19 -05:00
|
|
|
backendSrv.get('/api/dashboards/home').then(function(homeDash) {
|
|
|
|
if (homeDash.redirectUri) {
|
|
|
|
$location.path('dashboard/' + homeDash.redirectUri);
|
2016-03-17 03:38:18 -05:00
|
|
|
} else {
|
2016-03-20 05:52:19 -05:00
|
|
|
var meta = homeDash.meta;
|
|
|
|
meta.canSave = meta.canShare = meta.canStar = false;
|
|
|
|
$scope.initDashboard(homeDash, $scope);
|
2016-03-17 03:38:18 -05:00
|
|
|
}
|
2015-05-12 07:11:30 -05:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-05-12 10:39:56 -05:00
|
|
|
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug).then(function(result) {
|
2015-05-12 07:11:30 -05:00
|
|
|
$scope.initDashboard(result, $scope);
|
2015-03-02 15:24:01 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-12-16 05:21:13 -06:00
|
|
|
coreModule.default.controller('NewDashboardCtrl', function($scope) {
|
2015-05-12 07:11:30 -05:00
|
|
|
$scope.initDashboard({
|
2016-10-28 09:37:13 -05:00
|
|
|
meta: { canStar: false, canShare: false, isNew: true },
|
2015-05-12 07:11:30 -05:00
|
|
|
dashboard: {
|
|
|
|
title: "New dashboard",
|
2016-10-26 10:42:39 -05:00
|
|
|
rows: [
|
|
|
|
{
|
|
|
|
title: 'Dashboard Row',
|
|
|
|
height: '250px',
|
|
|
|
panels:[],
|
2016-10-30 12:02:46 -05:00
|
|
|
isNew: true,
|
2016-10-26 10:42:39 -05:00
|
|
|
}
|
|
|
|
]
|
2015-05-12 07:11:30 -05:00
|
|
|
},
|
|
|
|
}, $scope);
|
|
|
|
});
|
|
|
|
|
2015-03-02 15:24:01 -06:00
|
|
|
});
|