Merge branch 'pro' of github.com:torkelo/grafana-private into pro

Conflicts:
	src/test/test-main.js
This commit is contained in:
Torkel Ödegaard 2014-09-13 18:36:17 +02:00
commit 9b2476451e
8 changed files with 103 additions and 5 deletions

View File

@ -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() };

View File

@ -2,7 +2,7 @@ define([
'angular',
'app',
'lodash',
'../graph/timeSeries',
'components/timeSeries',
'services/panelSrv',
],
function (angular, app, _, timeSeries) {

View File

@ -42,6 +42,12 @@
<strong>Login failed:</strong> {{loginError}}
</div>
</form>
<div class="register-box text-center">
<h3>If you do not already have an account<h3>
</a> <a href="/register" class="btn btn-info btn-large">Sign up now!</a>
</div>
</div>

View File

@ -0,0 +1,51 @@
<div class="container">
<div class="login-box">
<div class="login-box-logo">
<img src="/img/logo_transparent_200x75.png">
</div>
<div class="text-center" style="margin-bottom: 50px">
<h3>Account registration</32>
</div>
<form name="loginForm" class="form-horizontal">
<div class="row-fluid">
<div class="span8">
<div class="control-group">
<label class="control-label" for="inputEmail">Email</label>
<div class="controls">
<input type="text" required ng-model="loginModel.email" id="inputEmail" placeholder="Email">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Password</label>
<div class="controls">
<input type="password" required ng-model="loginModel.password" id="inputPassword" placeholder="Password">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword2">Confirm password</label>
<div class="controls">
<input type="password" required ng-model="loginModel.password2" id="password2" placeholder="Confirm password">
</div>
</div>
</div>
<div class="span4">
<button type="submit" ng-click="register()" class="btn btn-success btn-large">
<i class="icon-lock"></i>
Sign up
</button>
</div>
</div>
<div class="alert alert-error" ng-show="loginError">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>Login failed:</strong> {{loginError}}
</div>
</form>
</div>
</div>

View File

@ -38,6 +38,7 @@ function (angular) {
$scope.emitAppEvent('setup-dashboard', dashboard);
}).then(null, function(error) {
alertSrv.set('Error', error, 'error');
$scope.emitAppEvent('setup-dashboard', {});
});
});

View File

@ -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 = {};

View File

@ -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;
});

View File

@ -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();
});