mirror of https://github.com/grafana/grafana
added an inital admin settings view, very basic right now only displays all config options in grafana.ini
parent
29607d8951
commit
e65a6cc063
@ -0,0 +1,28 @@ |
|||||||
|
package api |
||||||
|
|
||||||
|
import ( |
||||||
|
"strings" |
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/middleware" |
||||||
|
"github.com/grafana/grafana/pkg/setting" |
||||||
|
) |
||||||
|
|
||||||
|
func AdminGetSettings(c *middleware.Context) { |
||||||
|
settings := make(map[string]interface{}) |
||||||
|
|
||||||
|
for _, section := range setting.Cfg.Sections() { |
||||||
|
jsonSec := make(map[string]interface{}) |
||||||
|
settings[section.Name()] = jsonSec |
||||||
|
|
||||||
|
for _, key := range section.Keys() { |
||||||
|
keyName := key.Name() |
||||||
|
value := key.Value() |
||||||
|
if strings.Contains(keyName, "secret") || strings.Contains(keyName, "password") { |
||||||
|
value = "************" |
||||||
|
} |
||||||
|
jsonSec[keyName] = value |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
c.JSON(200, settings) |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
define([ |
||||||
|
'./accountUsersCtrl', |
||||||
|
'./datasourcesCtrl', |
||||||
|
'./apiKeysCtrl', |
||||||
|
'./importCtrl', |
||||||
|
'./accountCtrl', |
||||||
|
], function () {}); |
||||||
@ -1,18 +0,0 @@ |
|||||||
define([ |
|
||||||
'angular', |
|
||||||
], |
|
||||||
function (angular) { |
|
||||||
'use strict'; |
|
||||||
|
|
||||||
var module = angular.module('grafana.controllers'); |
|
||||||
|
|
||||||
module.controller('AdminCtrl', function($scope) { |
|
||||||
|
|
||||||
$scope.init = function() { |
|
||||||
$scope.editor = {index: 0}; |
|
||||||
}; |
|
||||||
|
|
||||||
$scope.init(); |
|
||||||
|
|
||||||
}); |
|
||||||
}); |
|
||||||
@ -0,0 +1,25 @@ |
|||||||
|
define([ |
||||||
|
'angular', |
||||||
|
], |
||||||
|
function (angular) { |
||||||
|
'use strict'; |
||||||
|
|
||||||
|
var module = angular.module('grafana.controllers'); |
||||||
|
|
||||||
|
module.controller('AdminSettingsCtrl', function($scope, backendSrv) { |
||||||
|
|
||||||
|
$scope.init = function() { |
||||||
|
$scope.accounts = []; |
||||||
|
$scope.getUsers(); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.getUsers = function() { |
||||||
|
backendSrv.get('/api/admin/settings').then(function(settings) { |
||||||
|
$scope.settings = settings; |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.init(); |
||||||
|
|
||||||
|
}); |
||||||
|
}); |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
define([ |
||||||
|
'./adminUsersCtrl', |
||||||
|
'./adminEditUserCtrl', |
||||||
|
'./adminSettingsCtrl', |
||||||
|
], function () {}); |
||||||
@ -1,10 +0,0 @@ |
|||||||
<topnav icon="fa fa-cube" title="Admin" subnav="true"> |
|
||||||
<ul class="nav"> |
|
||||||
<li class="active"><a href="admin">Settings</a></li> |
|
||||||
<li><a href="admin/users">Users</a></li> |
|
||||||
</ul> |
|
||||||
</topnav> |
|
||||||
|
|
||||||
|
|
||||||
<div class="gf-box" style="min-height: 500px"> |
|
||||||
</div> |
|
||||||
@ -0,0 +1,34 @@ |
|||||||
|
<topnav icon="fa fa-cube" title="Admin" subnav="true"> |
||||||
|
<ul class="nav"> |
||||||
|
<li class="active"><a href="admin/settings">Settings</a></li> |
||||||
|
<li><a href="admin/users">Users</a></li> |
||||||
|
<li><a href="admin/users/create">Create user</a></li> |
||||||
|
</ul> |
||||||
|
</topnav> |
||||||
|
|
||||||
|
<div class="page-container"> |
||||||
|
<div class="page"> |
||||||
|
<h2> |
||||||
|
System settings |
||||||
|
</h2> |
||||||
|
|
||||||
|
<div class="grafana-info-box span8" style="margin: 20px 0 25px 0"> |
||||||
|
These system settings are defined in grafana.ini or grafana.custom.ini (or overriden in ENV variables). |
||||||
|
To change these you currently need to restart grafana. |
||||||
|
</div> |
||||||
|
|
||||||
|
<table class="grafana-options-table"> |
||||||
|
<tr ng-repeat-start="(secName, secValue) in settings"> |
||||||
|
<td class="admin-settings-section">{{secName}}</td> |
||||||
|
<td></td> |
||||||
|
</tr> |
||||||
|
<tr ng-repeat="(keyName, keyValue) in secValue" ng-repeat-end> |
||||||
|
<td style="padding-left: 25px;">{{keyName}}</td> |
||||||
|
<td>{{keyValue}}</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,10 @@ |
|||||||
|
|
||||||
|
.admin-settings-section { |
||||||
|
color: @variable; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
td.admin-settings-key { |
||||||
|
padding-left: 20px; |
||||||
|
} |
||||||
|
|
||||||
Loading…
Reference in new issue