diff --git a/src/app/controllers/p_grafanaCtrl.js b/src/app/controllers/p_grafanaCtrl.js index e9484d76d64..65bb8745195 100644 --- a/src/app/controllers/p_grafanaCtrl.js +++ b/src/app/controllers/p_grafanaCtrl.js @@ -14,7 +14,7 @@ function (angular, config, _, $, store) { $scope.grafanaVersion = grafanaVersion[0] === '@' ? 'master' : grafanaVersion; $scope.consoleEnabled = store.getBool('grafanaConsole'); - $scope.showProSideMenu = store.getBool('grafanaProSideMenu'); + //$scope.showProSideMenu = store.getBool('grafanaProSideMenu'); $rootScope.profilingEnabled = store.getBool('profilingEnabled'); $rootScope.performance = { loadStart: new Date().getTime() }; diff --git a/src/app/panels/overview/module.js b/src/app/panels/overview/module.js index 1dbc7807a8c..7a876321e0f 100644 --- a/src/app/panels/overview/module.js +++ b/src/app/panels/overview/module.js @@ -2,7 +2,7 @@ define([ 'angular', 'app', 'lodash', - '../graph/timeSeries', + 'components/timeSeries', 'services/panelSrv', ], function (angular, app, _, timeSeries) { diff --git a/src/app/partials/pro/login.html b/src/app/partials/pro/login.html index 92f1c4e8923..22340b89ffe 100644 --- a/src/app/partials/pro/login.html +++ b/src/app/partials/pro/login.html @@ -42,6 +42,12 @@ Login failed: {{loginError}} + +
+

If you do not already have an account

+ Sign up now! +

+ diff --git a/src/app/partials/pro/register.html b/src/app/partials/pro/register.html new file mode 100644 index 00000000000..b6b1f94f500 --- /dev/null +++ b/src/app/partials/pro/register.html @@ -0,0 +1,51 @@ + +
+ +
+ + + +
+

Account registration +

+ +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
+
+ + Login failed: {{loginError}} +
+
+
+ + +
diff --git a/src/app/routes/p_dashboard.js b/src/app/routes/p_dashboard.js index 08c729c2a8c..8c4b8d438de 100644 --- a/src/app/routes/p_dashboard.js +++ b/src/app/routes/p_dashboard.js @@ -38,6 +38,7 @@ function (angular) { $scope.emitAppEvent('setup-dashboard', dashboard); }).then(null, function(error) { alertSrv.set('Error', error, 'error'); + $scope.emitAppEvent('setup-dashboard', {}); }); }); diff --git a/src/app/routes/p_login.js b/src/app/routes/p_login.js index 127c4d47f81..91f9242a300 100644 --- a/src/app/routes/p_login.js +++ b/src/app/routes/p_login.js @@ -11,9 +11,43 @@ function (angular) { .when('/login', { templateUrl: 'app/partials/pro/login.html', controller : 'LoginCtrl', + }) + .when('/register', { + templateUrl: 'app/partials/pro/register.html', + controller : 'RegisterCtrl', }); }); + module.controller('RegisterCtrl', function($scope, $http, $location, $routeParams) { + $scope.loginModel = {}; + + $scope.init = function() { + if ($routeParams.logout) { + $scope.logout(); + } + }; + + $scope.register = function() { + delete $scope.registerError; + + if (!$scope.loginForm.$valid) { return; } + if ($scope.loginModel.password !== $scope.loginModel.password2) { + $scope.registerError = "Passwords do not match"; + return; + } + + $http.post('/api/register/user', $scope.loginModel).then(function() { + $location.path('/login'); + }, function(err) { + $scope.registerError = "Unexpected error: " + err; + }); + }; + + $scope.init(); + + }); + + module.controller('LoginCtrl', function($scope, $http, $location, $routeParams, alertSrv) { $scope.loginModel = {}; diff --git a/src/app/services/grafana/grafanaDatasource.js b/src/app/services/grafana/grafanaDatasource.js index 21518f95a0e..684d0abe25f 100644 --- a/src/app/services/grafana/grafanaDatasource.js +++ b/src/app/services/grafana/grafanaDatasource.js @@ -42,9 +42,14 @@ function (angular) { }; GrafanaDatasource.prototype.saveDashboard = function(dashboard) { + // remove id if title has changed + if (dashboard.title !== dashboard.originalTitle) { + dashboard.id = null; + } + return $http.post('/api/dashboard/', { dashboard: dashboard }) - .then(function() { - return { title: dashboard.title, url: '/dashboard/db/' + dashboard.title }; + .then(function(result) { + return { title: dashboard.title, url: '/dashboard/db/' + result.data.slug }; }, function(data) { throw "Failed to search: " + data; }); diff --git a/src/test/test-main.js b/src/test/test-main.js index 342f3143a9e..4c87e8dcb44 100644 --- a/src/test/test-main.js +++ b/src/test/test-main.js @@ -115,6 +115,7 @@ require([ angular.module('grafana.filters', []); require([ + 'specs/overview-ctrl-specs', 'specs/lexer-specs', 'specs/parser-specs', 'specs/gfunc-specs', @@ -133,7 +134,7 @@ require([ 'specs/templateValuesSrv-specs', 'specs/kbn-format-specs', 'specs/dashboardSrv-specs', - 'specs/dashboardViewStateSrv-specs' + 'specs/dashboardViewStateSrv-specs', ], function () { window.__karma__.start(); });