diff --git a/pkg/api/index.go b/pkg/api/index.go index 1b73acd8829..b78ee6e0a41 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -316,6 +316,19 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) { } if c.IsGrafanaAdmin { + 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"}, + } + + if setting.IsEnterprise { + children = append(children, &dtos.NavLink{Text: "Licensing", Id: "licensing", Url: setting.AppSubUrl + "/admin/licensing", Icon: "fa fa-fw fa-unlock-alt"}) + } + + children = append(children, &dtos.NavLink{Text: "Style Guide", Id: "styleguide", Url: setting.AppSubUrl + "/styleguide", Icon: "fa fa-fw fa-eyedropper"}) + cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{ Text: "Server Admin", HideFromTabs: true, @@ -323,13 +336,7 @@ func setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, error) { 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"}, - }, + Children: children, }) } diff --git a/public/app/features/admin/index.ts b/public/app/features/admin/index.ts index 7d06155b6f8..44628deb94f 100644 --- a/public/app/features/admin/index.ts +++ b/public/app/features/admin/index.ts @@ -4,6 +4,7 @@ import AdminListOrgsCtrl from './AdminListOrgsCtrl'; import AdminEditOrgCtrl from './AdminEditOrgCtrl'; import StyleGuideCtrl from './StyleGuideCtrl'; +import config from 'app/core/config'; import coreModule from 'app/core/core_module'; class AdminSettingsCtrl { @@ -35,3 +36,21 @@ coreModule.controller('AdminEditOrgCtrl', AdminEditOrgCtrl); coreModule.controller('AdminSettingsCtrl', AdminSettingsCtrl); coreModule.controller('AdminHomeCtrl', AdminHomeCtrl); coreModule.controller('StyleGuideCtrl', StyleGuideCtrl); + +if (config.buildInfo.isEnterprise) { + class AdminLicensingCtrl { + navModel: any; + + /** @ngInject */ + constructor($scope, backendSrv, navModelSrv) { + this.navModel = navModelSrv.getNav('cfg', 'admin', 'licensing', 1); + + backendSrv.get('/api/licensing/token').then(token => { + token.maxUsers = token.max_users >= 0 ? token.max_users : 'Unlimited'; + $scope.token = token; + }); + } + } + + coreModule.controller('AdminLicensingCtrl', AdminLicensingCtrl); +} diff --git a/public/app/features/admin/partials/licensing.html b/public/app/features/admin/partials/licensing.html new file mode 100644 index 00000000000..8ff4836bc4a --- /dev/null +++ b/public/app/features/admin/partials/licensing.html @@ -0,0 +1,56 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
License Details
License ID{{token.lid}} (View Details)
Licensed URL{{token.sub}}
Company{{token.company}}
Products +
{{product}}
+
Max Users{{token.maxUsers}}
License Issued{{token.nbf*1000 | date:'medium'}}
License Expires{{token.lexp*1000 | date:'medium'}}
Token Details
Token ID{{token.jti}}
Token Issued{{token.iat*1000 | date:'medium'}}
Token Expires{{token.exp*1000 | date:'medium'}}
+
diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index 9aecf53e7bb..9603be5ef88 100644 --- a/public/app/routes/routes.ts +++ b/public/app/routes/routes.ts @@ -225,6 +225,11 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { component: () => ServerStats, }, }) + .when('/admin/licensing', { + templateUrl: 'public/app/features/admin/partials/licensing.html', + controller: 'AdminLicensingCtrl', + controllerAs: 'ctrl', + }) // LOGIN / SIGNUP .when('/login', { templateUrl: 'public/app/partials/login.html',