Moved Server Admin and children to separate menu item on Side Menu (#15592)

* Moved Server Admin and children to separate menu item on Side Menu

* Removed style guide after PR comments
This commit is contained in:
Hugo Häggmark 2019-03-05 13:02:41 +01:00 committed by GitHub
parent e3d08e24f3
commit d3642a3e91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 32 deletions

View File

@ -307,33 +307,26 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er
}
}
if c.OrgRole == m.ROLE_ADMIN && c.IsGrafanaAdmin {
cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{
Divider: true, HideFromTabs: true, Id: "admin-divider", Text: "Text",
})
}
if c.IsGrafanaAdmin {
cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{
Text: "Server Admin",
HideFromTabs: true,
SubTitle: "Manage all users & orgs",
Id: "admin",
Icon: "gicon gicon-shield",
Url: setting.AppSubUrl + "/admin/users",
Children: []*dtos.NavLink{
{Text: "Users", Id: "global-users", Url: setting.AppSubUrl + "/admin/users", Icon: "gicon gicon-user"},
{Text: "Orgs", Id: "global-orgs", Url: setting.AppSubUrl + "/admin/orgs", Icon: "gicon gicon-org"},
{Text: "Settings", Id: "server-settings", Url: setting.AppSubUrl + "/admin/settings", Icon: "gicon gicon-preferences"},
{Text: "Stats", Id: "server-stats", Url: setting.AppSubUrl + "/admin/stats", Icon: "fa fa-fw fa-bar-chart"},
{Text: "Style Guide", Id: "styleguide", Url: setting.AppSubUrl + "/styleguide", Icon: "fa fa-fw fa-eyedropper"},
},
})
}
data.NavTree = append(data.NavTree, cfgNode)
}
if c.IsGrafanaAdmin {
data.NavTree = append(data.NavTree, &dtos.NavLink{
Text: "Server Admin",
SubTitle: "Manage all users & orgs",
HideFromTabs: true,
Id: "admin",
Icon: "gicon gicon-shield",
Url: setting.AppSubUrl + "/admin/users",
Children: []*dtos.NavLink{
{Text: "Users", Id: "global-users", Url: setting.AppSubUrl + "/admin/users", Icon: "gicon gicon-user"},
{Text: "Orgs", Id: "global-orgs", Url: setting.AppSubUrl + "/admin/orgs", Icon: "gicon gicon-org"},
{Text: "Settings", Id: "server-settings", Url: setting.AppSubUrl + "/admin/settings", Icon: "gicon gicon-preferences"},
{Text: "Stats", Id: "server-stats", Url: setting.AppSubUrl + "/admin/stats", Icon: "fa fa-fw fa-bar-chart"},
},
})
}
data.NavTree = append(data.NavTree, &dtos.NavLink{
Text: "Help",
SubTitle: fmt.Sprintf(`%s v%s (%s)`, setting.ApplicationName, setting.BuildVersion, setting.BuildCommit),

View File

@ -2,7 +2,7 @@ export default class AdminEditOrgCtrl {
/** @ngInject */
constructor($scope, $routeParams, backendSrv, $location, navModelSrv) {
$scope.init = () => {
$scope.navModel = navModelSrv.getNav('cfg', 'admin', 'global-orgs', 1);
$scope.navModel = navModelSrv.getNav('admin', 'global-orgs', 0);
if ($routeParams.id) {
$scope.getOrg($routeParams.id);

View File

@ -6,7 +6,7 @@ export default class AdminEditUserCtrl {
$scope.user = {};
$scope.newOrg = { name: '', role: 'Editor' };
$scope.permissions = {};
$scope.navModel = navModelSrv.getNav('cfg', 'admin', 'global-users', 1);
$scope.navModel = navModelSrv.getNav('admin', 'global-users', 0);
$scope.init = () => {
if ($routeParams.id) {

View File

@ -2,7 +2,7 @@ export default class AdminListOrgsCtrl {
/** @ngInject */
constructor($scope, backendSrv, navModelSrv) {
$scope.init = () => {
$scope.navModel = navModelSrv.getNav('cfg', 'admin', 'global-orgs', 1);
$scope.navModel = navModelSrv.getNav('admin', 'global-orgs', 0);
$scope.getOrgs();
};

View File

@ -10,7 +10,7 @@ export default class AdminListUsersCtrl {
/** @ngInject */
constructor(private $scope, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'global-users', 1);
this.navModel = navModelSrv.getNav('admin', 'global-users', 0);
this.query = '';
this.getUsers();
}

View File

@ -9,7 +9,7 @@ export default class StyleGuideCtrl {
/** @ngInject */
constructor(private $routeParams, private backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'styleguide', 1);
this.navModel = navModelSrv.getNav('admin', 'styleguide', 0);
this.theme = config.bootData.user.lightTheme ? 'light' : 'dark';
}

View File

@ -11,7 +11,7 @@ class AdminSettingsCtrl {
/** @ngInject */
constructor($scope, backendSrv, navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 'server-settings', 1);
this.navModel = navModelSrv.getNav('admin', 'server-settings', 0);
backendSrv.get('/api/admin/settings').then(settings => {
$scope.settings = settings;
@ -24,7 +24,7 @@ class AdminHomeCtrl {
/** @ngInject */
constructor(navModelSrv) {
this.navModel = navModelSrv.getNav('cfg', 'admin', 1);
this.navModel = navModelSrv.getNav('admin', 0);
}
}

View File

@ -4,7 +4,7 @@ import config from 'app/core/config';
export class NewOrgCtrl {
/** @ngInject */
constructor($scope, $http, backendSrv, navModelSrv) {
$scope.navModel = navModelSrv.getNav('cfg', 'admin', 'global-orgs', 1);
$scope.navModel = navModelSrv.getNav('admin', 'global-orgs', 0);
$scope.newOrg = { name: '' };
$scope.createOrg = () => {