Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/enterprise' into frontend-extens…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
torkelo committed Oct 11, 2018
2 parents f4a9817 + a4f90fd commit 5b46c08
Show file tree
Hide file tree
Showing 35 changed files with 11,839 additions and 13 deletions.
16 changes: 14 additions & 2 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,7 @@ ignored = [
[[constraint]]
name = "github.com/VividCortex/mysqlerr"
branch = "master"

[[constraint]]
name = "gopkg.in/square/go-jose.v2"
version = "2.1.9"
21 changes: 14 additions & 7 deletions pkg/api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,27 @@ 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,
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"},
},
Children: children,
})
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/extensions/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package extensions

import (
_ "gopkg.in/square/go-jose.v2"
)

var IsEnterprise bool = false
19 changes: 19 additions & 0 deletions public/app/features/admin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
56 changes: 56 additions & 0 deletions public/app/features/admin/partials/licensing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<page-header model="ctrl.navModel"></page-header>

<div class="page-container page-body">
<table class="filter-table form-inline">
<tbody>
<tr>
<td colspan="2" class="admin-settings-section">License Details</td>
</tr>
<tr>
<td>License ID</td>
<td>{{token.lid}} (<a href="{{token.iss}}/licenses/{{token.lid}}" target="_blank" rel="noopener noreferer">View Details</a>)</td>
</tr>
<tr>
<td>Licensed URL</td>
<td><a href="{{token.sub}}" target="_blank" rel="noopener noreferer">{{token.sub}}</a></td>
</tr>
<tr>
<td>Company</td>
<td>{{token.company}}</td>
</tr>
<tr>
<td>Products</td>
<td>
<div ng-repeat="product in token.prod">{{product}}</div>
</td>
</tr>
<tr>
<td>Max Users</td>
<td>{{token.maxUsers}}</td>
</tr>
<tr>
<td>License Issued</td>
<td>{{token.nbf*1000 | date:'medium'}}</td>
</tr>
<tr>
<td>License Expires</td>
<td>{{token.lexp*1000 | date:'medium'}}</td>
</tr>
<tr>
<td colspan="2" class="admin-settings-section">Token Details</td>
</tr>
<tr>
<td>Token ID</td>
<td>{{token.jti}}</td>
</tr>
<tr>
<td>Token Issued</td>
<td>{{token.iat*1000 | date:'medium'}}</td>
</tr>
<tr>
<td>Token Expires</td>
<td>{{token.exp*1000 | date:'medium'}}</td>
</tr>
</tbody>
</table>
</div>
5 changes: 5 additions & 0 deletions public/app/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,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',
Expand Down
13 changes: 12 additions & 1 deletion vendor/github.com/hashicorp/yamux/mux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions vendor/github.com/hashicorp/yamux/session.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5b46c08

Please sign in to comment.